分享知识 传递快乐
由于之前写过Windows整合方式,有很多相同的地方,在此就不过多重复写了,参考下面几篇文章就够用了。
Win7整合WNMP(Linux整合LNMP(Centos7.4+Nginx+PHP+MariaDB))
Linux安装MariaDB(超详细的yum安装、二进制安装)
Nginx和MariaDB配置还是很顺利,但在配置PHP时出了不少幺蛾子;下面记录一下本人遇到的问题。
1、官网下载PHP二进制包
PHP 5.2.25:https://www.php.net/releases/
2、解压tar.gz文件到指定目录下
[root@localhost ~]# mkdir /opt/mariadb
[root@localhost ~]# tar -zxvf PHP-5.2.15.tar.gz -C /opt/lnmp/bin/PHP/5.5.12
3、配置
1)配置
[root@localhost 5.5.12]# ./configure --prefix=/opt/lnmp/bin/PHP/5.5.12 --with-config-file-path=/opt/lnmp/bin/PHP/5.5.12/etc --enable-inline-optimization --disable-debug --enable-fpm --with-fpm-user=www --with-fpm-group=www --disable-rpath --enable-soap --with-libxml-dir --with-xmlrpc --with-openssl --with-mhash --with-pcre-regex --with-zlib --enable-bcmath --with-bz2 --enable-calendar --with-curl --enable-exif --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-mbstring --with-onig --enable-shared --enable-opcache --with-MysqLi=MysqLnd --with-pdo-MysqL=MysqLnd --with-readline --with-iconv --enable-pcntl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-sockets --enable-zip --enable-wddx --with-pear
2)编译安装
[root@localhost 5.5.12]# make
[root@localhost 5.5.12]# make install
或者
[root@localhost 5.5.12]# make && make install
附:
还可以使用一条命令操作全部:配置编译安装
[root@localhost 5.5.12]# ./configure --prefix=/opt/lnmp/bin/PHP/5.5.12 --with-config-file-path=/opt/lnmp/bin/PHP/5.5.12/etc --enable-inline-optimization --disable-debug --enable-fpm --with-fpm-user=www --with-fpm-group=www --disable-rpath --enable-soap --with-libxml-dir --with-xmlrpc --with-openssl --with-mhash --with-pcre-regex --with-zlib --enable-bcmath --with-bz2 --enable-calendar --with-curl --enable-exif --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-mbstring --with-onig --enable-shared --enable-opcache --with-MysqLi=MysqLnd --with-pdo-MysqL=MysqLnd --with-readline --with-iconv --enable-pcntl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-sockets --enable-zip --enable-wddx --with-pear && make && make install
如果在编译安装时出现异常请参考命令结束的最后一行,根据反馈的信息来判断系统缺少哪些依赖文件。在文章最下面提供一些常见的PHP编译时返回error解决方法。
4、启动
编译安装成功后会在PHP的安装目录下生成一个sbin的文件夹,通过PHP-fpm来启动PHP:
[root@localhost 5.5.12]# cd sbin/
[root@localhost sbin]# ./PHP-fpm
[06-Jan-2020 20:57:05] ERROR: Failed to open configuration file '/opt/lnmp/bin/PHP/5.5.12/etc/PHP-fpm.conf': No such file or directory (2)
[06-Jan-2020 20:57:05] ERROR: Failed to load configuration file '/opt/lnmp/bin/PHP/5.5.12/etc/PHP-fpm.conf'
[06-Jan-2020 20:57:05] ERROR: FPM initialization Failed
解决方法:
进入PHP的配置目录
[root@localhost etc]# cd etc/
[root@localhost etc]# cp PHP-fpm.conf.default PHP-fpm.conf
[root@localhost etc]# vim PHP-fpm.conf
pid = run/PHP-fpm.pid
打开后,保存即可。
5、查看状态
[root@localhost 5.5.12]# ps -ef | grep PHP-fpm
6、停止
[root@localhost 5.5.12]# killall -9 PHP-fpm
PHP编译时返回error解决方法:
1)Configure: error: xml2-config not found. Please check your libxml2 installation.
[root@localhost 5.5.12]# yum install libxml2 libxml2-devel
2)Configure: error: Please reinstall the BZip2 distribution
[root@localhost 5.5.12]# yum install bzip2 bzip2-devel
3)Configure: error: Please reinstall the libcurl distribution-easy.h should be in <curl-dir>/include/curl/.
[root@localhost 5.5.12]# yum install curl curl-devel
4)Configure: error: libjpeg.(also) not found.
[root@localhost 5.5.12]# yum install libjpeg libjpeg-devel
5)Configure: error: libpng.(also) not found.
[root@localhost 5.5.12]# yum install libpng libpng-devel
6)Configure: error: mcrypt.h not found. Please reinstall libmcrypt.
[root@localhost 5.5.12]# yum install libmcrypt libmcrypt-devel
[root@localhost 5.5.12]# yum install -y epel-release
[root@localhost 5.5.12]# yum install -y libmcrypt-devel
7)Configure: error: Please reinstall libmhash – I cannot find mhash.h.
[root@localhost 5.5.12]# yum install mhash-devel
8)Configure: error: jpeglib.h not found.
[root@localhost 5.5.12]# yum -y install libjpeg-devel
——————————
如有不足请留言指正
相互学习,共同进步
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。