The article explain how to install PHP on a linux server.
Prerequisites : Apache and Mysql installed.
- With root user, create a directory /opt/php :
- mkdir /opt/php
- chown apache:apache /opt/php
- With the apache user install the last stable version of PHP (exemple 5.2.9) in /opt/php directory.
- su - apache
- cd /opt/php
- tar xzvf php-5.2.9.tar.gz
- tar xzvf php-5.2.9.tar
- cd php-5.2.9
- ./configure --with-gd --enable-sockets --with-jpeg-dir=/usr/lib --prefix=/opt/php/v529 --with-apxs2=/opt/apache/current/bin/apxs --with-config-file-path=/opt/php --with-zlib-dir=/usr/lib --with-mysql=/opt/mysql/current --with-pdo-mysql=/opt/mysql/current --with-gettext --enable-bcmath=yes --with-ttf --enable-mbstring=all --with-freetype-dir=/usr
- make
- make install
- cd ..
- ln -s v529 current
- Copy your php.ini :
- cp /opt/php/php-5.2.9/php.ini-recommended /opt/php/php.ini
- Modify your apache config file. Add the following items :
- <IfModule dir_module>
- DirectoryIndex index.html index.php
- </IfModule>
- ...
- AddType application/x-gzip .gz .tgz
- AddType application/x-httpd-php .php
- Optionnal - Installation of pear packages PHP_CodeSniffer, PhpDocumentor and PHPUnit
- su - apache
- /opt/php/current/bin/pear upgrade-all
- /opt/php/current/bin/pear install PHP_CodeSniffer
- /opt/php/current/bin/pear install PhpDocumentor
- /opt/php/current/bin/pear channel-discover pear.phpunit.de
- /opt/php/current/bin/pear install phpunit/PHPUnit





