installation

Download Report

Transcript installation

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
#
#
#
#
#
#
#
cd /usr/local/src
wget http://xmlsoft.org/sources/libxml2-2.6.23-1.i386.rpm
wget http://xmlsoft.org/sources/libxml2-devel-2.6.23-1.i386.rpm
wget http://xmlsoft.org/sources/libxml2-python-2.6.23-1.i386.rpm
wget http://xmlsoft.org/sources/libxslt-1.1.15-1.i386.rpm
wget http://xmlsoft.org/sources/libxslt-devel-1.1.15-1.i386.rpm
wget http://xmlsoft.org/sources/libxslt-python-1.1.15-1.i386.rpm
• Install libxml2
#
#
#
#
#
cd /usr/local/src
rpm -e --nodeps libxml2-2.6.17-4
rpm -ivh libxml2-2.6.23-1.i386.rpm
rpm -ivh libxml2-devel-2.6.23-1.i386.rpm
rpm -ivh libxml2-python-2.6.23-1.i386.rpm
Download & Install LibXML, LibSLT 2/2
• Install libxslt
# rpm -e --nodeps libxslt-1.1.12-5
# rpm -ivh libxslt-1.1.15-1.i386.rpm
• libgcrypt-devel is needed by libxslt-devel-1.1.15-1, installed
with yast!
• Then install libxslt-devel
# rpm -ivh libxslt-devel-1.1.15-1.i386.rpm
• Verify that packages were installed proper
# rpm -qa | grep libxml2
libxml2-2.6.23-1
libxml2-devel-2.6.23-1
# rpm -qa | grep libxslt
libxslt-1.1.15-1
libxslt-devel-1.1.15-1
Download & Unzip & compile PHP5
• Download PHP5 sources
# cd /usr/local/src
# wget http://se.php.net/get/php-5.1.2.tar.gz/from/this/mirror
• Unzip PHP5 sources in /usr/local/src
cd /usr/local/src
tar xvfz php-5.1.2.tar.gz
• Configure PHP5
# cd php-5.1.2
# ./configure --with-mysql=/usr --with-apxs2 --with-sqlite
• Compile PHP5 source
# make
– Note that compiling PHP5 can take 15 to 90 minutes or more
Installing & Configuring PHP5 1/2
# make install
• Installing PHP5 binaries
• Add PHP5 libraries to libpath in /etc/ld.so.conf
# libtool --finish /usr/local/src/php-5.1.2/libs
• Find section LoadModule in Apache config file and add
after last LoadModule:
LoadModule php5_module lib/httpd/modules/libphp5.so
• Find <Directory "/usr/local/httpd/htdocs"> in Apache config
file and change first Options line to:
Options Indexes FollowSymLinks Includes MultiViews
• Find DirectoryIndex in Apache config file and change to:
DirectoryIndex index.html index.html.var index.php
• Find AddType in Apache config file and add:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Start MySQL and Apache services!
• Restart Apache
# apachectl restart
– Check logfiles for any error: tail /var/log/httpd/access_log
• Restart MySQL
# /etc/init.d/mysql restart
– 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
# chkconfig mysql on
# chkconfig httpd on
• We are now done! You should now have lastest version of:
– Apache
MySQL
PHP5
• Check that Apache can deal with PHP5 code.
– Add to /usr/local/httpd/htdocs/test.php
– Test to open:
http://www.my-site.com/test.php
<?
phpinfo();
?>