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

learn more… | top users | synonyms

12
votes
2answers
39k 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
333 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
6answers
8k 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
519 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
332 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
239 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
115 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
89 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
569 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
688 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
3answers
168 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
1k 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
868 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
75 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
138 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
2answers
9k 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 ...
3
votes
1answer
99 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
1answer
702 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 ...
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
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
609 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
407 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
1k 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
6k 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
422 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
249 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
1k 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
1answer
53 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
670 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
815 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
279 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
171 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
61 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
119 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
175 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
2answers
351 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
306 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
80 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 ...
2
votes
1answer
933 views

Running MPlayer through a PHP script

I'm trying to open an MPlayer instance on my server from a PHP script (using PHP's system() function). I've looked into making mplayer a slave ( http://www.mplayerhq.hu/DOCS/tech/slave.txt ) but when ...
2
votes
1answer
811 views

Debian lenny 5 install php-dev

I'm trying to install apt-get install php5-dev but when I run the command Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be ...
2
votes
2answers
1k views

Fixing debian installer

I have a VPS with Debian GNU/Linux on it. I'm trying to install a PHP file manager so that people could access it and download stuff into a directory. I don't have anything in my /bin about PHP so ...
2
votes
3answers
2k views

installing ffmpeg-php on centos

With the help of this guide, I am trying to install ffmpeg using these commands: # cd ffmpeg-php/branches/ffmpeg-php/ffmpeg-php-0.6.1/ # replace 'PIX_FMT_RGBA32' 'PIX_FMT_RGB32' -- * # phpize # ...
2
votes
2answers
175 views

High Idle CPU / Low CPU Load average

After removing APC (alternative php cache), I noticed that there are less pagination access and less dirty pages but in the same time: High idle CPU Very low CPU load (relatively to the time before ...
2
votes
1answer
150 views

kill process in script while writing file behavior

in my php script which runs as a cron job, I have foreach($sites as $site) { exec('./wkhtmltoimage-amd64 ' . $site . ' somefile.png'); exec('./zopflipng -y somefile.png somefile.png'); } ...
2
votes
1answer
491 views

nginx php-fpm index.php doesn't load

I have a quite simple setup with nginx and php-fpm, howsoever when I try to access my website with my-website.com I get a 403 forbidden error, If I access my-website.com/index.php everything works ...
2
votes
1answer
507 views

Securest way to authenticate users against /etc/shadow using PHP?

This question became important to me, since I'm setting up a Horde environment and want to use the system accounts. Doing some search I found mainly 4 ways of doing that, which all seem to have some ...
2
votes
2answers
3k views

Fatal error: Class 'HttpRequest' not found

Whilst trying to make this request I have this error. I have tried to run "sudo pecl install pecl_http" but always fails. Could not find curl/curl.h After I have tired(yum instead of apt-get ...
2
votes
2answers
4k views

How can I install php5-curl on Ubuntu 12.04 LTS (GNU/Linux 3.2.0-24-generic x86_64)

I have a working server running Ubuntu 12.04 LTS (GNU/Linux 3.2.0-24-generic x86_64), including apache and php. Now I want to add curl support for php by running this: apt-get install php5-curl ...