Home  >  Article  >  Backend Development  >  How to install php5 on linux

How to install php5 on linux

藏色散人
藏色散人Original
2021-05-14 09:12:482396browse

How to install php5 on Linux: first download the "php-5.6.2.tar.gz" package; then decompress it; then compile and install through "make install"; finally modify the configuration php.ini and other related files That’s it.

How to install php5 on linux

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

Linux installs two versions of php5 and php7

多版本的安装:
1.区分php安装的目录
2.fpm的配置:端口号的区分
3.nginx配置文件要区分:fastcgi_pass 127.0.0.1:9000;

Install php5

 1. 下载包
 wget http://mirrors.sohu.com/php/php-5.6.2.tar.gz
 
 2. 解压
 tar -zxvf php-5.6.2.tar.gz
 cd php-5.6.2.tar.gz
 
 3. 编译安装
 依赖的话提示缺啥就安装
 
'./configure'  '--prefix=/usr/local/php5.4.9' '--enable-fpm'  '--enable-inline-optimization' '--disable-debug' '--disable-rpath' '--enable-shared' '--enable-soap' '--with-xmlrpc' '--with-openssl' '--with-mcrypt' '--with-pcre-regex' '--with-sqlite3' '--with-zlib' '--enable-bcmath' '--with-iconv' '--with-bz2' '--enable-calendar' '--with-curl' '--with-cdb' '--enable-dom' '--enable-exif' '--enable-fileinfo' '--enable-filter' '--with-pcre-dir' '--enable-ftp' '--with-gd' '--with-openssl-dir' '--with-jpeg-dir' '--with-png-dir' '--with-freetype-dir' '--enable-gd-native-ttf' '--enable-gd-jis-conv' '--with-gettext' '--with-gmp' '--with-mhash' '--enable-json' '--enable-mbstring' '--enable-mbregex' '--enable-mbregex-backtrack' '--with-libmbfl' '--with-onig' '--with-mysql=mysqlnd' '--enable-pdo' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--with-zlib-dir' '--with-pdo-sqlite' '--with-readline' '--enable-session' '--enable-shmop' '--enable-simplexml' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-wddx' '--with-libxml-dir' '--with-xsl' '--enable-zip' '--enable-mysqlnd-compression-support' '--with-pear'

make && make install

4. fpm配置文件
 cp /usr/local/php5.6.2/etc/php-fpm.conf.default     /usr/local/php5.6.2/etc/php-fpm.conf
vim /usr/local/php5.6.2/etc/php-fpm.conf



修改用户和组、修改端口

5. 配置php.ini文件
cp php.ini-development /usr/local/php5.6.2/lib/php.ini

6. 配置fpm自启服务
cp sapi/fpm/php-fpm.service /usr/lib/systemd/system/php5-fpm.service
vim /usr/lib/systemd/system/php5-fpm.service
修改路径前缀

Recommended learning: "PHP Video Tutorial"

systemctl daemon-reload
systemctl enable php5-fpm
systemctl start php5-fpm
systemctl status php5-fpm

7. 配置nginx
修改成php5-fpm 开启的端口号
fastcgi_pass 127.0.0.1:9005;
nginx -s reload

The above is the detailed content of How to install php5 on linux. 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