The installation steps of LinuxPHP5 are described in detail. How can we install PHP5 in Linux? Here we will introduce in detail the installation of LinuxPHP5. After the server runs for a period of time, it may suddenly need to add an extension, such as curl and p. how can we install PHP5 in Linux? Here we will introduce in detail the installation of Linux PHP5. After the server runs for a period of time, it may suddenly need to add an extension, such as curl, pdo, and xmlrpc. This requires that the extension be added independently without re-compiling PHP.
The following uses curl installation as an example to describe how to install Linux PHP5.
1. install crul wget http://curl.haxx.se/download/curl-7.19.6.tar.gz tar-zxvf curl-7.19.6.tar.gz cd curl-7.19.6./configure -- prefix =/usr/local/curl
- make
- make install
2. Compile and generate extensions and enter the ext directory in the php source code directory. the source code of each extension module is stored here. select the required module, such as the curl module:
- cd curl
Run phpize to generate the compilation file. when phpize runs in the bin directory of the PHP installation directory/usr/local/php5/bin/phpize, the following error may be reported: Cannot find autoconf. please check your autoconf installation and the $ PHP_AUTOCONF environment variable is set correctly and then rerun this script. ", you need to install autoconf: yum install autoconf (RedHat or CentOS), apt-get install autoconf (Ubuntu Linux) to generate the configuration file, and compile and generate the module:
- /usr/local/php5/bin/phpize
- ./configure --with-curl=/usr/local/curl --with-php-config=/usr/local/php5/bin/php-config
-
- make
-
- make install
In this way, curl. so is copied to the corresponding PHP Directory (such as:/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626 /)
3. modify the configuration in php. ini and set the extension directory:
- extension_dir = "/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/"
Add extension module reference:
- extension = curl.so
4. check and restart Apache
- /usr/local/php/bin/php -v
When executing this command, php will check whether the configuration file is correct. if there is a configuration error, an error will be reported here. you can check the error according to the error information. The preceding steps are used to install Linux PHP5.
Why? Here we will introduce in detail the installation of Linux PHP5. After the server runs for a period of time, it may suddenly need to add an extension, such as curl, p...