After downloading the installation package, you must install libxml2 before installing PHP. Therefore, you can download the libxml2 installation package and compile and install it.
I'm using the Yum-y install libxml2 libxml2-devel (if this is not installed, I will find a parsing error)
Configuration :. /configure -- prefix =/usr/local/PHP -- with-apxs2 =/usr/local/Apache/bin/apxs -- With-mysql =/usr/local/MySQL -- With-config- file-Path =/usr/local/PHP -- enable-mbstring = all
This is the simplest or most basic requirement (the first three)
Make
Make install. If the following prompt is displayed, PHP installation is successful.
- Installing php sapi module: apache2handler
- /Usr/local/apache2/build/instdso. Sh sh_libtool = '/usr/lib/apr-1/build/libtool 'libphp5.la/usr/local/apache2/modules
- /Usr/lib/apr-1/build/libtool -- mode = install CP libphp5.la/usr/local/apache2/modules/
- Libtool: Install: CP. libs/libphp5.so/usr/local/apache2/modules/libphp5.so
- Libtool: Install: CP. libs/libphp5.lai/usr/local/apache2/modules/libphp5.la
- Libtool: Install: Warning: Remember to run 'libtool -- Finish/home/go_yueyue/downloads/php-5.3.6/libs'
- Chmod 755/usr/local/apache2/modules/libphp5.so
- [Activating module 'php5 'in/usr/local/apache2/CONF/httpd. conf]
- Installing php cli binary:/usr/local/bin/
- Installing php cli man page:/usr/local/man/Man1/
- Installing Build Environment:/usr/local/lib/PHP/build/
- Installing header files:/usr/local/include/PHP/
- Installing helper programs:/usr/local/bin/
- Program: phpize
- Program: PHP-config
- Installing man pages:/usr/local/man/Man1/
- Page: phpize.1
- Page: php-config.1
- Installing pear environment:/usr/local/lib/PHP/
- [Pear] archive_tar-installed: 1.3.7
- [Pear] lele_getopt-installed: 1.3.0
- [Pear] structures_graph-installed: 1.0.4
- [Pear] xml_util-installed: 1.2.1
- [Pear] pear-installed: 1.9.2
- Wrote pear system config file at:/usr/local/etc/pear. conf
- You may want to add:/usr/local/lib/PHP to your php. ini include_path
- /Home/gogo_yueyue/download/php-5.3.6/build/shtool install-c ext/phar. phar/usr/local/bin
- Ln-S-F/usr/local/bin/phar. phar/usr/local/bin/phar
- Installing PDO headers:/usr/local/include/PHP/EXT/PdO/
Therefore, we need to modify the Apache configuration file to support PHP parsing.
Addtype application/X-httpd-PHP. php. php3
Indicates that PHP files can be parsed in Apache.
Next, check the PHP dynamic connection library file generated under the Apache directory and find whether the libphp5.so file exists in the directory/usr/local/Apache/modules.
/Usr/local/Apache/bin/apachectl-M view all supported modules and check whether php5.so is supported
Create a PHP file under/usr/local/Apache/htdocs/and restart Apache to test
Problems:
When you restart Apache, the following error occurs: httpd:
Syntax Error on line 53 of/usr/local/Apache/CONF/httpd. conf: cannot load/usr/local/Apache/modules/libphp5.so into server:/usr/local/Apache/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied
Cause: There is a SELinux protection mode in Linux.
Solution:
1. Method for disabling SELinux:
VI/etc/SELinux/config change SELinux = enforcing to SELinux = disabled and restart
This method may cause risks to the server.
2. Do not disable SELinux:
# Setenforce 0
# Chcon-C-v-r-u system_u-r object_r-T textrel_shlib_t/usr/local/Apache/modules/libphp5.so
# Service httpd restart
# Setenforce 1