Installation of PHP5 Objectives –Install PHP5 with support for Apache and MySQL Contents –Installing latest dependencies LibXML & LibSLT –Compiling and installing PHP5 for MySQL & Apache –Configure PHP5 –Add PHP support in Apache Practical –Install PHP5 Summary
Download & Install LibXML, LibSLT 1/2 Download latest LibXML and LibSLT Install libxml2 # cd /usr/local/src # wget # wget # wget # wget # wget # wget # cd /usr/local/src # wget # wget # wget # wget # wget # wget # cd /usr/local/src # rpm -e --nodeps libxml # rpm -ivh libxml i386.rpm # rpm -ivh libxml2-devel i386.rpm # rpm -ivh libxml2-python i386.rpm # cd /usr/local/src # rpm -e --nodeps libxml # rpm -ivh libxml i386.rpm # rpm -ivh libxml2-devel i386.rpm # rpm -ivh libxml2-python i386.rpm
Download & Install LibXML, LibSLT 2/2 Install libxslt libgcrypt-devel is needed by libxslt-devel , installed with yast! Then install libxslt-devel Verify that packages were installed proper # rpm -e --nodeps libxslt # rpm -ivh libxslt i386.rpm # rpm -e --nodeps libxslt # rpm -ivh libxslt i386.rpm # rpm -qa | grep libxml2 libxml libxml2-devel # rpm -qa | grep libxslt libxslt libxslt-devel # rpm -qa | grep libxml2 libxml libxml2-devel # rpm -qa | grep libxslt libxslt libxslt-devel # rpm -ivh libxslt-devel i386.rpm
Download & Unzip & compile PHP5 Download PHP5 sources Unzip PHP5 sources in /usr/local/src Configure PHP5 Compile PHP5 source –Note that compiling PHP5 can take 15 to 90 minutes or more # cd /usr/local/src # wget # cd /usr/local/src # wget # cd php #./configure --with-mysql=/usr --with-apxs2 --with-sqlite # cd php #./configure --with-mysql=/usr --with-apxs2 --with-sqlite cd /usr/local/src tar xvfz php tar.gz cd /usr/local/src tar xvfz php tar.gz # make
Installing & Configuring PHP5 1/2 Installing PHP5 binaries Add PHP5 libraries to libpath in /etc/ld.so.conf Find section LoadModule in Apache config file and add after last LoadModule: Find in Apache config file and change first Options line to: Find DirectoryIndex in Apache config file and change to: Find AddType in Apache config file and add: # make install Options Indexes FollowSymLinks Includes MultiViews # libtool --finish /usr/local/src/php-5.1.2/libs DirectoryIndex index.html index.html.var index.php LoadModule php5_module lib/httpd/modules/libphp5.so AddType application/x-httpd-php.php AddType application/x-httpd-php-source.phps AddType application/x-httpd-php.php AddType application/x-httpd-php-source.phps
Start MySQL and Apache services! Restart Apache –Check logfiles for any error: tail /var/log/httpd/access_log Restart MySQL –Check logfiles for any error: tail /var/log/messages Create a small start/stop script for apache! Make Apache and MySQL start at boot time We are now done! You should now have lastest version of: –ApacheMySQLPHP5 Check that Apache can deal with PHP5 code. –Add to /usr/local/httpd/htdocs/test.php –Test to open: # /etc/init.d/mysql restart # chkconfig mysql on # chkconfig httpd on # chkconfig mysql on # chkconfig httpd on # apachectl restart <? phpinfo(); ?> <? phpinfo(); ?>