Running PHP applications

Another option for creating dynamic Web content is PHP - the PHP: Hypertext Preprocessor, a very popular HTML-embedded scripting language (see

We're using mod_fastcgi to link PHP to Apache. The following list of questions and answers should help to clear things up.

PHP Wrapper

In order for your PHP website to work properly with suexec, you need to configure a PHP wrapper. The suexec feature provides users of the Apache HTTP Server the ability to run PHP under their own user ID. Normally, when a PHP program executes, it runs as the same user who is running the web server.

/!\ The apache standard suexec module does not accept implicitly (index.php) or directly called php-scripts with write permissions for group !

Please create a .htaccess file in your public_html directory with the following content and replace <account> with your personal account:

FCGIWrapper /home/<account>/public_html/.fcgi/php-wrapper .php

Please also create the .fcgi directory and create there the php-wrapper file with content:

   1 #!/bin/sh
   2 #
   3 exec /usr/bin/php-cgi
   4 #

Both files ( .htaccess and php-wrapper ) need to be readable by world:

chmod 644 .htaccess
chmod 755 .fcgi
chmod 755 .fcgi/php-wrapper

My PHP application doesn't work. What should I do?

The first thing you should do is to have a look at the error log file written by Apache. You can find the error log files under


Simply log in to webbi10(with ssh

Can I have my own PHP settings (php.ini)?

Yes you can. That's one of the advantages of our setup.

Create a .user.ini file in your public_html (touch ~/public_html/.user.ini). For a list of the parameters you can set in .user.ini, have a look at

Please note that PHP only reads the settings from your .user.ini when the PHP interpreter starts for the first time, so to make sure your changes to your .user.ini become effective, you can either wait for the next day (see the question below about the lifetime of your PHP processes) or manually kill your current PHP process(es) - they are automatically restarted by mod_fastcgi:

joe@webbi10:~> pkill -u $USER -f php 

You can use pgrep -u $USER -fl php to see whether you have any persistent PHP processes running. And make sure that you are running this command on the Web server itself (i.e. on webbi10).

What about PHP security (file permissions etc.)?

Security has definitely improved with the new setup. You no longer have to make your PHP scripts (with passwords for database access or similar) readable for the httpd user, nor does a directory have to be writable for httpd. You can set the permissions for your .php files to a mode as tight as 0400 (-r--------, for read-only access) or 0600 (-rw-------, read-write access). No fiddling with ACLs (setfacl) is required any more.

To learn more about PHP and security we recommend these URLs as starting points:

How long will "my" PHP process survive?

There is no exact answer to this question. The minimum lifetime of your PHP process depends on how many other users have concurrent PHP processes running (with the current setting, mod_fastcgi will probably first kill those which have been idle for the longest amount of time). Depending on our experience with the platform, we might modify these settings from time to time, so we can't really give you an exact answer, as stated above. The maximum lifetime of a PHP process, BTW, is 24 hours - at 0:10 a.m. every day Apache's log files are rotated, which will also result in your PHP process being shut down.

Why does my PHP based page take so long to show up in the browser?

Probably because it's the first time you open the page on this very day. Apache first checks if there is already a PHP process available which runs under your account, and if it doesn't find one, there is some overhead to get an initial process started. After the first request to a PHP based page on your Web site, the PHP performance should be much higher.

How can I use/install additional PEAR modules?

With our PHP installation, we're providing basic PEAR modules. If you require additional modules for your project, follow these steps in your login shell:

# switch to your home directory
cd ~
# download PEAR installer
wget -O installer.phar
# run the installer
php installer.phar
# the installer asks for a install prefix, we recommend /home/YOURUSERNAME/pear.
# the installer will put the pear binary (used to install modules) into the 'bin' directory
# below the install prefix. either add that directory to your PATH environment or
# call it with the absolute path to install packages, e.g. to install the HTTP_Client package:
pear install HTTP_Client
# to make your PHP application find the additional PEAR packages, you can either
# A) modify /home/YOURUSERNAME/public_html/.user.ini and set the include_path to let it
#      point to /home/YOURUSERNAME/pear/PEAR or
# B) do it inside your scripts, e.g.
# <? set_include_path(get_include_path().PATH_SEPARATOR.'/home/YOURUSERNAME/pear/PEAR'); ?>


Web/Homepage/PHP (last edited 2022-07-15 12:03:03 by stroth)