安装php5.4
[root@server src]#wget https://museum.php.net/php5/php-5.4.16.tar.gz
[root@server src]#tar -zxvf php-5.4.16.tar.gz
[root@server src]#yum install -y libxml2-devel gcc gcc-c++ curl curl-devel libpng libpng-devel freetype freetype-devel libxslt libxslt-devel zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libxml2 glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers * #安装依赖包
[root@server src]#cd php-5.4.16
[root@server php-5.4.16]#./configure --prefix=/usr/local/php/54 --with-config-file-path=/usr/local/php/54 --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-xmlrpc --with-xsl --with-zlib --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip
[root@server php-5.4.16]#make && make install
[root@server php-5.4.16]#cp php.ini-production /usr/local/php/54/php.ini
[root@server php-5.4.16]#cp ./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[root@server php-5.4.16]#chmod +x /etc/init.d/php-fpm
[root@server php-5.4.16]#cd /usr/local/php/54/etc
[root@server etc]#cp php-fpm.conf.default php-fpm.conf
[root@server etc]#vi php-fpm.conf ##去掉pid = run/php-fpm.pid前面的分号;
[root@server etc]#/usr/local/php/54/sbin/php-fpm ##手动开启php服务
[root@server src]#echo "/usr/local/php/54/sbin/php-fpm" >> /etc/rc.local #设置php开机自启
[root@server src]#chmod 777 /etc/rc.d/rc.local
CentOS7安装php5.4
于 2024-01-22 16:24:38 首次发布