centos7安装php5.3

#创建文件夹
mkdir /usr/local/src/php  

cd /usr/local/src/php 

wget   http://cn2.php.net/distributions/php-5.3.28.tar.bz2 

#添加依赖运用 
yum install -y gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses curl openssl-devel gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel readline-devel libxslt-devel expat-devel xmlrpc-c xmlrpc-c-devel

#下载解压文件
yum install bzip2

#解压下载的php源码包
tar -xjvf php-5.3.28.tar.bz2

cd /usr/local/src/php/php-5.3.28

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --enable-sysvsem --enable-sockets --enable-pcntl --enable-mbstring --enable-mysqlnd --enable-opcache --enable-shmop --enable-zip --enable-ftp --enable-gd-native-ttf --enable-wddx --enable-soap

make

#安装
make install

cp /usr/local/php/etc/php-fpm.conf.default php-fpm.conf

cp /usr/local/src/php/php-5.3.28/php.ini-development /usr/local/php/etc/php.ini-development

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

cp /usr/local/src/php/php-5.3.28/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

#给权限
chmod +x /etc/init.d/php-fpm

加入开机启动
chkconfig --add php-fpm

设置启动等级
chkconfig --level 35 php-fpm on

cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

vim /usr/local/php/etc/php-fpm.conf 

#找到 ;pid = run/php-fpm.pid 去掉前面的分号

#启动
service php-fpm start

设置环境变量
vim /etc/profile 

底部添加
PATH=$PATH:/usr/local/php/bin

环境变量生效
source /etc/profile

php -v 查看php版本 

你可能感兴趣的:(php)