1. Install the PHP dependency Library
The code is as follows: |
Copy code |
# Install libmcrypt Cd/usr/local/src/php-lib/libmcrypt-2.5.8 ./Configure -- prefix =/usr Make & make install # Install mhash Cd/usr/local/src/php-lib/mhash-0.9.9.9 ./Configure -- prefix =/usr Make & make install # Install mcrypt /Sbin/ldconfig # search for a shared dynamic link library Cd/usr/local/src/php-lib/mcrypt-2.6.8 ./Configure Make & make install # Install libiconv Cd/usr/local/src/php-lib/libiconv-1.14 ./Configure -- prefix =/usr/local/libiconv Make & make install |
2. Install PHP 5.2.17
The code is as follows: |
Copy code |
Cd/usr/local/src/php-5.2.17 . /Configure -- prefix =/usr/local/php -- with-apxs2 =/usr/local/apache/bin/apxs -- with-config-file-path =/etc -- with-config- file-scan-dir =/etc/php. d -- with-openssl -- with-zlib -- enable-bcmath -- with-bz2 -- with-gd -- enable-gd-native-ttf -- with-gettext -- with-mhash -- enable-mbstring -- with-mcrypt -- enable-zip -- with-iconv =/usr/local/libiconv -- with-curl -- enable-soap -- enable-sockets -- enable-ftp -- with-mysql =/ usr/local/mysql -- with-pdo-mysql =/usr/local/mysql -- without-pear |
Compilation parameter explanation:
-- Prefix =/usr/local/php: Set the installation path.
-- With-apxs2 =/usr/local/apache/bin/apxs: compile the shared Apache 2.0 Module
-- With-config-file-path =/etc: specifies the php. ini address of the configuration file.
-- With-config-file-scan-dir =/etc/php. d: specify an additional INI file directory.
-- With-openssl: OpenSSL compilation support
-- With-zlib: zlib compilation support
-- Enable-bcmath: enables the BC style precision mathematical function.
-- With-bz2: BZip2 support
-- With-gd: GD supported
-- Enable-gd-native-ttf: enable the TrueType string function.
-- With-gettext: Supports GNU gettext.
-- With-mhash: mhash supported
-- Enable-mbstring: enable multi-byte string
-- With-mcrypt: supports compiling mcrypt encryption
-- Enable-zip: enable zip read/write support
-- With-iconv =/usr/local/libiconv: iconv supported
-- With-curl: supported by CRUL
-- Enable-soap: SOAP support
-- Enable-sockets: supported by SOCKETS
-- Enable-ftp: FTP support
-- With-mysql =/usr/local/mysql: mysql support enabled
-- With-pdo-mysql =/usr/local/mysql: enables support for pdo-mysql
-- Without-pear: Do not install PEAR
For more compilation parameter explanations, see http://www.php.net/manual/zh/configure.about.php or./configure -- help.
# Copy the configuration file php. ini
The code is as follows: |
Copy code |
Cp/usr/local/src/php-5.2.17/php. ini-dist/usr/local/php/etc/php. ini # Add the php file type resolution to the/etc/httpd/conf/httpd. conf file (add it to the end of the file) Addtype application/x-httpd-php. php |
3. Restart Apache
The code is as follows: |
Copy code |
Service httpd restart # or/etc/init. d/httpd restart |