Home>Article>Backend Development> How to compile and install php5.2

How to compile and install php5.2

藏色散人
藏色散人 Original
2022-01-28 09:33:01 2460browse

How to compile and install php5.2: 1. Download php; 2. Download php-fpm; 3. Install the required dependency packages; 4. Install PHP through "make install".

How to compile and install php5.2

The operating environment of this article: linux5.9.8 system, PHP5.2 version, DELL G3 computer

How to compile and install php5.2 ?

Compile and install php5.2.17

Previously, PHP installation was directly installed by YUM, but due to business needs of the company, the program requires php5.2.x. Supported, so I started compiling and installing

1. First download php

wget -c http://us3.php.net/get/php-5.2.17.tar.gz/from/this/mirror

Because I am using lnmp here, I need to use the fastcgi manager. Here I am using php-fpm. php5.2 does not integrate php-fpm by default, so it needs to be patched. For the understanding, configuration and application of php-fpm, please see http://shuoduanzi.com/?p=288

2. Download php-fpm

wget -c http://php-fpm.org/downloads/php-5.2.17-fpm-0.5.14.diff.gz

3. Install the required dependency packages. Here I install them with YUM

4. Okay, now look at the installation script

#!/bin/bash ############下载php和fpm补丁 cd /opt wget -c http://us3.php.net/get/php-5.2.17.tar.gz/from/this/mirror tar zxvf php-5.2.17.tar.gz cd php-5.2.17 wget -c http://php-fpm.org/downloads/php-5.2.17-fpm-0.5.14.diff.gz gzip -d php-5.2.17-fpm-0.5.14.diff.gz patch -p1 < php-5.2.17-fpm-0.5.14.diff ############安装所依赖的库,其实这里还依赖其它库,但是在安装这些库的时候,本身它们也有依赖,它们所依赖的库也正是我们安装php所需要的库。 yum install libxml2 libxml2-devel \ openssl openssl-devel \ curl curl-devel \ libjpeg libjpeg-devel \ gd gd-devel \ bzip2 bzip2-devel \ libmcrypt libmcrypt-devel \ libmhash libmhash-devel \ mysql mysql-devel -y ###########开始安装php cd /opt/php-5.2.17 ./configure --prefix=/usr/local/php --enable-fastcgi --enable-zip --enable-fpm --enable-gd-native-ttf --with-config-file-path=/usr/local/php/etc --with-config-file-scan-dir=/usr/local/php/etc/php.d --with-bz2 --with-curl --with-libxml-dir --with-gd --with-jpeg-dir --with-freetype-dir --with-png-dir --with-mcrypt --with-mhash --enable-mbstring --with-kerberos --with-gettext --enable-bcmath --with-mysql --with-mysqli --with-sqlite --enable-pdo --with-pdo-mysql --with-openssl --enable-ftp --with-pear --with-zlib --enable-inline-optimization --enable-calendar --enable-magic-quotes --enable-sockets --enable-sysvsem --enable-sysvshm --enable-sysvmsg --disable-debug make make test make install

Supplementary content:

This is the compilation method when I use nginx php, but in the case of apache php, you cannot add the two parameters --enable-fastcgi --enable-fpm, otherwise an error will be reported when apache starts after installation.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to compile and install php5.2. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn