My Agile Project

  • Increase font size
  • Default font size
  • Decrease font size
Home Documentation Howto How to install PHP
Documentation

How to install PHP

E-mail Print PDF

The article explain how to install PHP on a linux server.

Prerequisites : Apache and Mysql installed.

  1. With root user, create a directory /opt/php :
    1. mkdir /opt/php
    2. chown apache:apache /opt/php
     
  2. With the apache user install the last stable version of PHP (exemple 5.2.9) in /opt/php directory.

    1. su - apache
    2. cd /opt/php
    3. tar xzvf php-5.2.9.tar.gz
    4. tar xzvf php-5.2.9.tar
    5. cd php-5.2.9
    6. ./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
    7. make
    8. make install
    9. cd ..
    10. ln -s v529 current
     

  3. Copy your php.ini :
    1. cp /opt/php/php-5.2.9/php.ini-recommended /opt/php/php.ini
     
  4. Modify your apache config file. Add the following items :
    1. <IfModule dir_module>
    2.     DirectoryIndex index.html index.php
    3. </IfModule>
    4. ...
    5. AddType application/x-gzip .gz .tgz
    6. AddType application/x-httpd-php .php
     
  5. Optionnal - Installation of pear packages PHP_CodeSniffer, PhpDocumentor and PHPUnit
    1. su - apache
    2. /opt/php/current/bin/pear upgrade-all
    3. /opt/php/current/bin/pear install PHP_CodeSniffer
    4. /opt/php/current/bin/pear install PhpDocumentor
    5. /opt/php/current/bin/pear channel-discover pear.phpunit.de
    6. /opt/php/current/bin/pear install phpunit/PHPUnit
     
Last Updated on Monday, 29 June 2009 08:11