赞
踩
yum install -y make cmake gcc gcc-c++ autoconf automake libpng-devel libjpeg-devel zlib libxml2-devel ncurses-devel bison libtool-ltdl-devel libiconv libmcrypt mhash mcrypt pcre-devel openssl-devel freetype-devel libcurl-devel
wget https://www.php.net/distributions/php-7.4.1.tar.gz
tar -zxvf php-7.4.1.tar.gz
进入解压后的文件夹中:
./configure \ --prefix=/opt/php \ --with-config-file-scan-dir=/etc/php.d \ --with-config-file-path=/opt/php/etc \ --with-mysql \ --with-mysqli \ --with-pdo_mysql \ --with-iconv-dir \ --with-zlib \ --with-libxml-dir \ --enable-xml \ --with-curl \ --enable-fpm \ --enable-mbstring \ --with-gd \ --with-openssl \ --with-mhash \ --enable-sockets \ --with-xmlrpc \ --enable-zip -enable-soap \ --with-freetype-dir \ --disable-fileinfo
报错:configure: error: Package requirements (libxml-2.0 >= 2.7.6) were not met:
No package ‘libxml-2.0’ found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
解决: yum install libxml2-devel
报错:configure: error: Package requirements (sqlite3 > 3.7.4) were not met:
No package ‘sqlite3’ found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
解决:yum install sqlite-devel
报错:configure: error: Package requirements (libcurl >= 7.15.5) were not met:
No package ‘libcurl’ found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
解决:yum install libcurl-devel
报错:configure: error: off_t undefined; check your library configuration
解决:
[root@localhost php]# echo '/usr/local/lib64
/usr/local/lib
/usr/lib
/usr/lib64'>>/etc/ld.so.conf
[root@localhost php-7]# ldconfig -v
报错:configure: error: Package requirements (oniguruma) were not met:
No package ‘oniguruma’ found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
解决:
yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-5.9.5-3.el7.x86_64.rpm
yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-devel-5.9.5-3.el7.x86_64.rpm
make && make install
cp /opt/php/sbin/php-fpm /sbin/
进入到etc目录,执行命令:
cp php-fpm.conf.default php-fpm.conf
cp php-fpm.d/www.conf.default php-fpm.d/www.conf
php-fpm -y /opt/php/etc/php-fpm.conf -R
一、在Nginx服务器的访问地址下建立一个index.php文件,文件内容如下。
<?php
echo phpinfo();
?>
二、在nginx.conf文件的server块儿中添加如下代码
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
三、在浏览器中访问该文件,如果能访问到phpinfo即安装php成功。
(1)查询已经安装了的mysql包
#rpm –qa|grep php
(2)使用yum完全卸载
# yum remove 查询出来的依赖文件
(3)手工删除所创建的目录及文件
#rm –rf /opt/php
#rm /etc/php.d
(4)手工删除所创建的软链接
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。