PHP is a widely-used, general-purpose scripting language that is especially suited for web development.

learn more… | top users | synonyms

18
votes
2answers
48k views

What user should apache and PHP be running as? What permissions should /var/www files have?

I just spun up an Ubuntu 11.10 box and then ran apt-get install apache2 php5 to install apache2 and PHP 5 on the box. Now it is functioning as a "web server" and it loads the "It Works!" page. Now I'm ...
9
votes
2answers
344 views

Vim, context-sensitive comment/uncomment behavior

I edit a lot of PHP code with Vim, and I've run into a snag with some macros in my .vimrc. I currently use these two macros to comment/uncomment in C-style "c-style (//) comment (press the [.] key) ...
8
votes
7answers
10k views

How do I install a PHP CLI with a usable interactive prompt on Debian Wheezy?

When I install php5-cli on Debian Wheezy (currently testing), the interactive prompt is very unusable due to missing readline support (bug 341868). What's the easiest way to install a version linked ...
7
votes
1answer
575 views

Opening port 80 but remain secure

I have a standard installation of Ubuntu 10.04, and have installed the LAMP stack so I can do some web development locally. On my router I have opened port 80 so I can develop with external services ...
7
votes
2answers
379 views

Strip // Comments From Files

What's the best way to strip all code comments in a given directory? I'd like to strip out all // ... EOL comments, and /* blah \*/ (or /** ... \*/) comments as well. This is a PHP project, and I'd ...
6
votes
4answers
2k views

Case-insensitive file system for production server?

The initial situation looks like this: The corporate software is PHP-based. It is delivered by Apache 2 on a Windows 2003 Server. It is big. It is a legacy of rather unprofessional developers who ...
6
votes
3answers
249 views

Can I install PHP on a Chumby One?

I'm enjoying hacking my Chumby One. However, I'd prefer if I could run PHP on it. I have perl and python installed. Does anyone know if I can compile PHP for it or if there is a ready made distro for ...
5
votes
1answer
127 views

Vim syntax highlight certain lines

I have php files well any file type in general that I would like vim to highlight here docs sections using a different syntax highlighting. <?php echo <<<HTMLDOC <h1> I am ...
4
votes
2answers
104 views

how to know which php extensions are installed

I need to install on a lamp server exactly the same php extensions that are installed on an old server, how do to know exactly which extensions are installed in order to install the same on the new ...
4
votes
2answers
587 views

Cron reports error in php5-common job after update

After an update to php5-common this night, cron reports a sed error "invalid option -- 'z'". This problem has also been reported on the Debian mailing list. What should I do, until the problem is ...
4
votes
2answers
95 views

Who cuts off first symbol of process substituted file and for what reason?

$ type 1.sh #!/bin/bash -eu php <(echo 12) $ ./1.sh 2 $ type 2.sh #!/bin/bash -eu cat <(echo 12) $ ./2.sh 12 $ type 3.sh #!/bin/bash -eu echo 12 | php $ ./3.sh 12 $ type 4.sh #!/bin/bash -eu ...
4
votes
2answers
612 views

apache and php Segmentation fault [closed]

I have recently migrated to Archlinux. I installed Apache, php and mysql according to the Arch Linux LAMP wiki page. Now I have setup a virtual host for my new Symfony project. For every request I ...
4
votes
2answers
12k views

Execute shell script from php, as root user?

Need to execute the following line from PHP: $res = shell_exec('sudo sh /home/nicklas/cronjobs/make_account.sh username password'); The problem is nothing happens on execution. If i try to ...
4
votes
2answers
842 views

How to set secure permissions for multiple users and multiple websites?

On a Gentoo 3.2.12 server with apache2+php, there are several websites running: /www /website1 /website2 ...etc The apache user should have read-only access to all the websites. There ...
4
votes
1answer
1k views

Does segfaults mean bad memory

This is a brand new server with a new install and fresh compile of Apache/PHP with nothing crazy. Just a WordPress site hosted and I get the following. Could this just mean bad RAM? If so how can I ...
4
votes
3answers
223 views

File permissions

I have a PHP script running which makes symlinks. To confirm which user it is: file_put_contents("testFile", "test"); $user = fileowner("testFile"); unlink("testFile"); echo "running as user '" . ...
4
votes
3answers
2k views

Use start-stop-daemon for a PHP server

I'm working on a socket server written in PHP. This part of the work is done but now I need to run it as a daemon. For this I've tried to use start-stop-daemon but it doesn't work. My server is ...
3
votes
2answers
941 views

PHP interface to manage linux user accounts

I have a linux web & samba server. I need to give administrators access to manage minor accounts & groups. Is there a secure php web interface that can do this? I don't want to give them shell ...
3
votes
2answers
355 views

Updating PHP to Gaurd Against Mayhem Malware

How will making sure my PHP version is updated thwart the Mayhem Malware? Will updating PHP on my Ubuntu server prevent the Mayhem Malware from being able to make it onto the server, prevent it from ...
3
votes
2answers
356 views

Changing default permissions for wget?

I'm using a PHP script to call shell_exec and execute wget to download some files to /var/www/dir/. (Internal tool, so security isn't much of an issue) The directory has 777 permissions. But when I ...
3
votes
1answer
2k views

PHP + Exim4 on Debian - mail does not get delivered

I have a fresh Debian installation with LAMP. There is a PHP script that sends email messages to arbitrary addresses using the mail function, but it does not work - the messages don't get delivered. ...
3
votes
1answer
108 views

Where to securely place files needed by PHP in Linux filesystem (according to FHS)

I have a PHP script running on my LAMP server that requires certain files in order to produce HTML content. The script is publicly accessible (i.e. http://example.com/script.php) but the files ...
3
votes
2answers
4k views

Unable to install the php-posix package on CentOS 5.6

I have the following PHP packages installed on my CentOS 5.6 host and I am trying to install php-posix. When I run yum install php-posix I receive an error saying that php53-common conflicts with ...
3
votes
1answer
4k views

-bash: phpize: command not found on Centos 6

When I try to run phpize I get -bash: phpize: command not found I have run yum -y install php-devel but that returns: Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * ...
3
votes
3answers
1k views

Trying to update php on CentOS 5.7

Apologies in advance - I'm not a good Linux user by any stretch of the imagination. I have a CentOS 5.7 dedicated server on which I host a few websites. I currently have php 5.2.10 installed, but ...
3
votes
2answers
658 views

Installing php-cgi under Ubuntu for Cherokee web server

I have set up Cherokee web server on my server, and want to enable PHP and MySQL support for applications like Wordpress and phpBB. I have tried running these commands: sudo apt-get install php5 ...
3
votes
1answer
547 views

suexec with chrooted environment

I'm trying to get a chrooted Apache environment working running mod_fcgid with suexec. Looking at suexec log inside jail, the wrapper scripts are being executed with no problems, however, when I look ...
3
votes
1answer
2k views

Why am I getting a Non-existent class error in PHP on Fedora?

I've set up an Nginx/PHP (both installed from Yum) environment on my Fedora 15 install, but I've run into a strange issue. I have some projects that use Codeigniter (1.6), but they keep getting the ...
2
votes
3answers
9k views

Cannot install PHP packages in CentOS

In CentOS 6.3 (Edit: updated to 6.4) I can't install any PHP (MySQL, and many other) packages. For example output of yum install php-devel is: Loaded plugins: fastestmirror Loading mirror speeds ...
2
votes
2answers
493 views

Turn a bash and php script into a distributable rpm

I'm semi unix knowledgeable and I want to be able to call down an rpm from my server, run it with something like rpm -i , and have access to the script anywhere. The script is a combination awk and ...
2
votes
2answers
327 views

Does PHP exec() store the executed command anywhere?

Suppose I have the following code in a PHP web application. $encrypt ? $password = generatePassword($passwordstrength): $password=""; $estring = "7z a -p$password -mx0 packFoo.aes.7z mydir/foo"; ...
2
votes
2answers
12k views

PHP 5.5.13 on CentOS 6.5 with yum

I've got problems with installing PHP 5.5.13 (last stable build) on a CentOS 6.5 (64 bit) machine, through yum. Can somebody guide me through this a little bit? It is not a part of the CentOS, EPEL ...
2
votes
2answers
276 views

Define custom DNS server when looking up host

I'm having trouble with my current web host's DNS server which doesn't correctly resolve IP addresses for Baidu. shell_exec('host -W 2 180.76.5.168'); shell_exec('nslookup 180.76.5.168'); Is there ...
2
votes
2answers
2k views

How to set up file permissions/ownership for FTP/Apache/PHP on CentOS

I have basic understanding of chmod and CentOS file permissions. 777 stands for 111111111 and rwx for each root, group, user, etc. What I can't get my head around is setting up Apache, FTP and PHP to ...
2
votes
1answer
159 views

compiling PHP fails cause of libpcre

I'm trying to compile PHP myself as I want to use PHPBrew to switch between multiple versions of PHP. I already solved a ton of problems in the process, but with this particular one I can't get any ...
2
votes
2answers
120 views

Is there a (relatively) safe way to run CLI commands from the web?

Since I started programming LAMP apps I wanted to develop an admin control panel for my boxes. (For fun and educational purposes, otherwise I would use something already existing in the market) But ...
2
votes
2answers
1k views

Find out screen id

I want to start a program with SSH using PHP, which works fine, but now I want to kill the screen with PHP, but the only thing I know is the name of the screen. How do I find out the screen ID ...
2
votes
1answer
1k views

How to execute php file as different user securely?

I want to confirm that my thoughts are correct as this is about security matter. We have web based application which is using db2 database. db2 runs under the db2inst1 user. Now we want users of the ...
2
votes
1answer
299 views

PHP phantom cron job

I disabled all my cron jobs by putting a # in front of them. Except for one: @reboot echo "Hi I rebooted" The rest are: #0 2,14 * * * /home/backup1/mysql-backup.sh #0 * * * * mono ...
2
votes
2answers
175 views

What should I teach in my Linux class? [closed]

I'm teaching a basic Unix class using Ubuntu. We've already covered basic Unix stuff such as: bash shell scripting file and directory permissions filesystem hierarchy common commands I would like ...
2
votes
1answer
28 views

Error passing variable from bash to php

I have the following files: vars.txt C=1234567890 Ascript.php #!/usr/bin/php <?php var $C="$argv[1]"; echo "\n $C \n"; $con = mysql_connect('localhost','root','123') or die ("No connected"); ...
2
votes
1answer
470 views

Installing PHP 5.3.3-24 on CentOS 6.5 (Final)

I require a slightly older version of PHP for my server because I need to be able to exploit a CVE (CVE-2006-7243) that was patched in the newer versions. NOTE: This is a legitimate use case where ...
2
votes
1answer
681 views

I cant save files in /var/www/html

I'm running Centos 6.5 and I'm having problems saving my files to /var/www/html. The folder currently belongs to root and I have gone through everything from SELinux to configuration procedures, but ...
2
votes
1answer
209 views

how to use html tidy on Nginx

I just installed HTML tidy using the following command line: sudo apt-get install php5-tidy yet I have no idea how to use it because I thought it is an auto process that can do things by itself ...
2
votes
1answer
1k views

Executing PHP with CronJobs in CentOS 6.4 not working?

So I've spent around 2-3 hours now and some times researching, I found several of the same responses online but none seem to work! I'm trying to execute a PHP script every minute (as a test), but it ...
2
votes
1answer
577 views

Nginx not available from localhost, but available by network

Have server with installed nginx and php-fpm. Some sctript need access to part of site via curl. But it fails. I tried to run curl on server : curl -v -i alexcoder.info * About to connect() to ...
2
votes
1answer
100 views

impact of allowing Apache to execute some commands on the server

I have an Ubuntu 12 web server running apache2, I developed a graphic interface using PHP to make users able to create their own email account by themselves ( exec() function), so I used visudo to ...
2
votes
2answers
459 views

How to open process substituted file from php?

Here's what I tried to do myself: $ type 1.sh #!/bin/bash -eu php -r 'var_dump(file_get_contents($_SERVER["argv"][1]));' -- <(echo 1) $ ./1.sh PHP Warning: file_get_contents(/dev/fd/63): failed ...
2
votes
2answers
362 views

How do I change emails from: address on FreeBSD?

Emails are now sent from www@hostname, but I want them to be sent from webmaster@my-domain.com My developer said it should be in php.ini but I figured out this is true only for Win32 systems. How do ...
2
votes
1answer
86 views

PHP Bash error suppresion

I'm using a PHP script from cli, the script calls exec() a few times. There are some minor errors sometimes, which are handled by the PHP script. I'm suppressing the errors by appending 2>/dev/null ...