Installing PHP with Suhosin patch

To install PHP from source with Suhosin patch: (on SuSE Linux for this example)

Download and unpack the latest PHP tarball from: (untar with: tar xvzf php-[version].tar.gz)

Download the matching Suhosin patch from , cd into the new PHP directory, and run:

       patch -p 1 -i ../suhosin-patch-5.2.6-

Then compile PHP with the option –enable-suhosin. I like using /usr/local/apache2 as the base path so I will remember to upgrade PHP along with apache in the future.

./configure --with-apache2=/usr/local/apache2/bin/httpd \
 --with-oci8=/oracle/product/10g \
--enable-sigchild \
--enable-force-cgi-redirect=yes \
--enable-safe-mode=yes \
--disable-inline-optimization \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql=/usr/bin/mysql \
--enable-so --with-zlib \
--enable-fastcgi --with-gettext \
--prefix=/usr/local/apache2/php5 \
--with-config-file-path=/usr/local/apache2/php5 \

make; sudo make install
  • Edit lines in Apache’s httpd.conf for php support:
DirectoryIndex index.html index.htm index.cgi initial.html \
  index.php index.jsp
# if this is the location of your php main binary
ScriptAlias /php/ "/usr/bin/"
<Location ~ /php>
AddType application/x-httpd-php .php .phtml
Action application/x-httpd-php "/php/php"
LoadModule php5_module        /usr/local/apache2/modules/
  • Set up your php.ini by copying over the provided version; tweak for memory upload settings
     cp php.ini-dist /usr/local/lib/php.ini
  • Restart Apache, and test by viewing the phpinfo.php web page, which is equal to running ‘php -i’:

You should now have PHP running.