linux下怎么安装php5
程序员文章站
2022-03-11 19:37:29
...
linux下安装php5的方法:1、下载所需版本PHP源码包;2、执行“tar xzf php-5.6.14.tar.gz”;3、编译安装;4、配置PHP即可。
本文操作环境: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的详细内容,更多请关注其它相关文章!
下一篇: PHP清理字符串中所有无用标签