linux下怎么安装php5插图

本文操作环境:linux5.9.8系统、PHP 5.6版,DELL G3电脑

linux下怎么安装php5?

Linux 下编译安装 PHP 5.6

若系统已使用yum安装php, 先卸载php

# rpm -qa | grep php
php-mcrypt-5.3.3-3.el6.x86_64
php-pgsql-5.3.3-46.el6_6.x86_64
php-xmlrpc-5.3.3-46.el6_6.x86_64
...
# rpm -e php-mcrypt-5.3.3
....

下载 PHP 源码包

1. http://php.net/downloads.php,下载所需版本PHP 源码包后, 上传至linux服务器

2. tar xzf php-5.6.14.tar.gz

安装依赖

# yum -y install gcc bison bison-devel zlib-devel libmcrypt-devel mcrypt mhash-devel openssl-devel libxml2-devel libcurl-devel 
bzip2-devel readline-devel libedit-devel sqlite-devel

编译安装

#  ./configure \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-opcache \
--enable-fpm \
--with-mysql \
--with-mysqli \
--with-pdo-mysql \
--with-gettext \
--enable-mbstring \
--with-iconv \
--with-mcrypt \
--with-mhash \
--with-openssl \
--enable-bcmath \
--enable-soap \
--with-libxml-dir \
--enable-pcntl \
--enable-shmop \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-sockets \
--with-curl \
--with-zlib \
--enable-zip \
--with-bz2 \
--with-readline
# make
# make install

如果想重新安装:

# make clean
# make clean all
# ./configure...
# make
# make install

配置 PHP

配置文件:

# cp php.ini-development /usr/local/php56/etc/php.ini

php-fpm 服务

# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
# chmod +x /etc/init.d/php-fpm

启动 php-fpm

# service php-fpm start
Starting php-fpm  done

推荐学习:《PHP视频教程

以上就是linux下怎么安装php5的详细内容,更多请关注亿码酷站其它相关文章!



linux下怎么安装php5
—–文章转载自PHP中文网如有侵权请联系ymkuzhan@126.com删除

云服务器推荐