1、源码安装
安装三步曲:
前提:需要打补丁
【php-5.2.17.tar.gz】获取方式:
链接:https://pan.baidu.com/s/1kpZyyOK_AHPqkAIF71RdWg
提取码:cndo
【php-5.2.17.patch】获取方式:
链接:https://pan.baidu.com/s/1Tlg-dPDQieonsESx-ICbfQ
提取码:cndo
【php-5.2.17-fpm-0.5.14.diff.gz】获取方式:
链接:https://pan.baidu.com/s/1PZGPyV7WK4i2mLpDOPIFuA
提取码:cndo
tarz -zxvf php-5.2.17.tar.gz
gzip -cd php-5.2.17-fpm-0.5.14.diff.gz | sudo patch -d php-5.2.17 -p1
# 打patch
cd php-5.2.17/
patch -p0 -b <../php-5.2.17.patch
1> configure
注意:configure前需要检查依赖安装
2> make 或者 make -j `nproc`
注意:按要求安装相关依赖
PHP 5.2.17安装编译时报错集锦
注意通过yum list和yum provides预查找要安装的依赖包是否存在?
yum list *ldap*
yum provides *ldap*
【问题_1】
configure: error: DBA: Could not find necessary header file(s).
【解决】
yum install gdbm-devel
*************************
./configure --prefix=/usr/local/php --with-config-file-path=/usr/bin --with-mysql=/usr/include/mysql --with-mysqli=/usr/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --without-pear --with-zlib --enable-pdo --with-pdo-mysql
***********************
【问题_2】
checking whether to enable LIBXML support... yes
checking libxml2 install dir... /usr
checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.
【解决】
=># yum list libxml2
=># yum install libxml2.x86_64
=># yum list xml2-config
如果还出现configure: error: xml2-config not found. Please check your libxml2 installation错误,则可能是缺少libxml2-dev。
执行# yum list xml2-config
************************
【问题_3】
checking whether to enable JIS-mapped Japanese font support in GD... no
checking for fabsf... yes
checking for floorf... yes
configure: error: libjpeg.(a|so) not found.
【解决】
=># cp -frp /usr/lib64/libjpeg.* /usr/lib
**************************
【问题_4】
checking whether to enable JIS-mapped Japanese font support in GD... no
checking for fabsf... yes
checking for floorf... yes
checking for jpeg_read_header in -ljpeg... yes
configure: error: libpng.(a|so) not found.
【解决】
=># cp -frp /usr/lib64/libpng.* /usr/lib
*********************
【问题_5】
checking whether to enable truetype string function in GD... yes
checking whether to enable JIS-mapped Japanese font support in GD... no
checking for fabsf... yes
checking for floorf... yes
checking for jpeg_read_header in -ljpeg... yes
checking for png_write_image in -lpng... yes
If configure fails try --with-xpm-dir=<DIR>
configure: error: freetype.h not found.
【解决】
=> # yum install freetype-devel
************************
【问题_6】
checking whether to enable JavaScript Object Serialization support... yes
checking for ANSI C header files... (cached) yes
checking for LDAP support... yes
checking for LDAP Cyrus SASL support... yes
configure: error: Cannot find ldap.h
【解决】
=> # yum install openldap-devel
************************
【问题_7】
checking whether to enable JavaScript Object Serialization support... yes
checking for ANSI C header files... (cached) yes
checking for LDAP support... yes
checking for LDAP Cyrus SASL support... yes
configure: error: Cannot find ldap libraries in /usr/lib.
【解决】
=> # yum install openldap.x86_64
*************************
【问题_8】
checking whether time.h and sys/time.h may both be included... yes
checking for working alloca.h... (cached) yes
checking for alloca... (cached) yes
checking for 8-bit clean memcmp... yes
checking for mcrypt support... yes
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
【解决】
=> # yum install libmcrypt-devel
*************************
【问题_9】
checking whether time.h and sys/time.h may both be included... yes
checking for working alloca.h... (cached) yes
checking for alloca... (cached) yes
checking for 8-bit clean memcmp... yes
checking for mcrypt support... yes
checking for libmcrypt version... >= 2.5.6
checking for mcrypt_module_open in -lmcrypt... no
checking for mcrypt_module_open in -lmcrypt... yes
checking for mhash support... yes
configure: error: Please reinstall libmhash - I cannot find mhash.h
【解决】
=> # yum install mhash-devel
********************
【问题_10】
checking whether to include mime_magic support... no
checking for MING support... no
checking for mSQL support... no
checking for MSSQL support via FreeTDS... no
checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... no
checking for MySQL UNIX socket location... no
configure: error: Cannot find MySQL header files under /usr/local/mysql.
Note that the MySQL client library is not bundled anymore!
【解决】
=> -with-mysql=/usr/include/mysql,这个参数应该不对,
把它改为
--with-mysql
或
--with-mysql=/bin/mysql
********************
【问题_11】
checking whether to include mime_magic support... no
checking for MING support... no
checking for mSQL support... no
checking for MSSQL support via FreeTDS... no
checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... no
checking for MySQL UNIX socket location... no
configure: error: Cannot find MySQL header files under /bin/mysql.
Note that the MySQL client library is not bundled anymore!
【解决】
=> # find / -name mysql.h
=> # yum list mysql-devel
yum install mysql-community-devel
******************
【问题_12】
checking whether to include mime_magic support... no
checking for MING support... no
checking for mSQL support... no
checking for MSSQL support via FreeTDS... no
checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... no
checking for MySQL UNIX socket location... no
configure: error: Cannot find libmysqlclient under /usr.
Note that the MySQL client library is not bundled anymore!
**********************
【解决】
注意:
Centos和Debian对dev包的名称不同
1> CentOS => -devel => freetype-devel.x86_64 0:2.8-14.el7
2> Debian => -dev
***********************
【问题_13】
make => in error
/opt/temp/0909/php-5.2.12/ext/dom/node.c: 在函数‘dom_canonicalization’中:
/opt/temp/0909/php-5.2.12/ext/dom/node.c:1953:21: 错误:提领指向不完全类型的指针
ret = buf->buffer->use;
^
In file included from /opt/temp/0909/php-5.2.12/main/php.h:38:0,
from /opt/temp/0909/php-5.2.12/ext/dom/node.c:26:
/opt/temp/0909/php-5.2.12/ext/dom/node.c:1955:40: 错误:提领指向不完全类型的指针
RETVAL_STRINGL((char *) buf->buffer->content, ret, 1);
^
/opt/temp/0909/php-5.2.12/Zend/zend_API.h:472:14: 附注:in definition of macro ‘ZVAL_STRINGL’
char *__s=(s); int __l=l; \
^
/opt/temp/0909/php-5.2.12/ext/dom/node.c:1955:5: 附注:in expansion of macro ‘RETVAL_STRINGL’
RETVAL_STRINGL((char *) buf->buffer->content, ret, 1);
^
make: *** [ext/dom/node.lo] 错误 1
【解决】
C代码本身编译报错的话,需要从源码解决,将C代码调整或者打相应版本的patch
3> make install
2、php-fpm配置文件位置:
# ll /usr/local/php/etc/php-fpm.conf
-rw-r--r--. 1 root root 5203 9月 16 14:18 /usr/local/php/etc/php-fpm.conf
3、配置:
采用php-fpm,一般都是同nginx在同一主机下通讯,如果要跨主机走TCP,要调整以下配置:
1> listen地址放开:
Address to accept fastcgi requests on.
Valid syntax is 'ip.ad.re.ss:port' or just 'port' or '/path/to/unix/socket'
<value name="listen_address">0.0.0.0:9000</value>
2> 从php-fpm允许可访问ip配置:
Comma separated list of ipv4 addresses of FastCGI clients that allowed to connect.
Equivalent to FCGI_WEB_SERVER_ADDRS environment in original php.fcgi (5.2.2+)
Makes sense only with AF_INET listening socket.
<value name="allowed_clients">127.0.0.1,172.60.1.163</value>
4、打开php-fpm慢日志方式:
The timeout (in seconds) for serving of single request after which a php backtrace will be dumped to slow.log file
'0s' means 'off'
<value name="request_slowlog_timeout">3s</value>
The log file for slow requests
<value name="slowlog">logs/slow.log</value>
5、优化pm线程池,注意区分static还是dynamic
Process manager settings
<value name="pm">
Sets style of controling worker process count.
Valid values are 'static' and 'apache-like'
<value name="style">apache-like</value>
Sets the limit on the number of simultaneous requests that will be served.
Equivalent to Apache MaxClients directive.
Equivalent to PHP_FCGI_CHILDREN environment in original php.fcgi
Used with any pm_style.
<value name="max_children">100</value>
Settings group for 'apache-like' pm style
<value name="apache_like">
Sets the number of server processes created on startup.
Used only when 'apache-like' pm_style is selected
<value name="StartServers">5</value>
Sets the desired minimum number of idle server processes.
Used only when 'apache-like' pm_style is selected
<value name="MinSpareServers">5</value>
Sets the desired maximum number of idle server processes.
Used only when 'apache-like' pm_style is selected
<value name="MaxSpareServers">100</value>
</value>
</value>
6、采用非root用户配置
Unix user of processes
<value name="user">deploy_user</value>
Unix group of processes
<value name="group">root</value>
7、日志级别和日志文件位置
Error log file
<value name="error_log">/usr/local/php/logs/php-fpm.log</value>
Log level
<value name="log_level">debug</value>
【温馨提示】
如果您觉得满意,可以选择支持下,您的支持是我最大的动力:
分享到:
相关推荐
docker-compose php7.3.4-fpm+nginx+mysql配置
docker-compose-nginx-phpfpm-源码.rar
基于alpine的php-fpm nginx docker一键环境 可以手动替换所有版本 通过修改dockerfile,支持容器加载代码,或者挂载代码 也可以支持k8s做为基础环境容器,整体已经经过优化
PHP-FPM是PHP FastCGI的进程管理器,它允许Web服务器(如Apache或Nginx)通过FastCGI接口与PHP解释器进行通信,从而处理PHP脚本。在Web开发中,PHP通常被用作服务器端编程语言,用于生成动态网页内容。 PHP-FPM的...
【Fedora 15 安装 Nginx (PHP-FPM) + MySQL + PHP Web服务】 在Fedora 15操作系统上搭建一个完整的Web服务环境,通常包括Nginx(一个高性能的HTTP服务器和反向代理服务器)、PHP-FPM(PHP FastCGI进程管理器)以及...
本教程将详细介绍如何在`CentOS 5.2`操作系统上,通过源码安装`Nginx`、`PHP-FPM`,并实现`HTTP Push`功能,以及如何进行测试验证。 首先,让我们了解这些技术的基本概念: 1. **Nginx**:Nginx是一款高性能的HTTP...
Windows 下使用 RunHiddenConsole 启动 nginx、php-fpm, https://www.nginx.com/resources/wiki/start/topics/examples/phpfastcgionwindows/
在Linux环境下,安装PHP-FPM之后,需要配置其与Web服务器(如Nginx或Apache)的协作。PHP-FPM通常以守护进程的方式运行,监听特定端口(默认为9000),Web服务器通过FastCGI接口发送请求给PHP-FPM,然后由PHP-FPM...
php-fpm。放到/etc/init.d/目录。然后执行:chmod a+x php-fpm 然后就可以/etc/init.d/php-fpm start 或者systemctl start php-fpm
在构建PHP运行环境时,尤其是针对CentOS 64位操作系统,我们需要安装并配置一系列的组件,以便让PHP能够与Nginx web服务器协同工作...如果选择手动编译,你需要先安装必要的依赖,如`yum install php54 php54-php-fpm ...
nginx+php-fpm解决502 Bad Gateway.zip
在IT领域,尤其是在服务器管理与Web开发中,安装和配置Nginx以及PHP-FPM是常见的操作。这里我们将深入探讨如何在Debian系统上,特别是友善之臂NanoPC-T2这款嵌入式设备上,进行这项工作。 首先,让我们了解Nginx。...
php-fpm是个中间件,在需要php解释器来处理.php文本时会用到php-fpm。自从php5.3.3以后就将php-fpm集成在php内核中。PHP-FPM提供了更好的PHP进程管理方式,可以有效控制内存和进程、可以平滑重载PHP配置。 作者:...
8. 阅读官方文档:遇到问题时,查阅PHP官方文档关于Opcache的安装和配置,以及阅读Nginx的配置指南,可以获得更深入的了解和解决思路。 9. 社区支持:在面对复杂问题时,可以寻求社区的帮助,比如在Stack Overflow...
本文将详细讲解如何安装配置php-fpm,以及如何与Nginx配合,构建一个生产级别的PHP环境。 首先,理解php-fpm的核心概念。PHP-FPM,全称FastCGI Process Manager,是一个用于管理PHP FastCGI进程的工具。它的出现...
lnmp的Docker安装,PHP-7.3-FPM,nginx最新版本,mysql-8.0_docker_lnmp
PHP-FPM是PHP的一个扩展,它提供了更高效、更灵活的PHP进程管理方式,使得Nginx等Web服务器可以通过FastCGI接口与PHP交互。以下是对`php-fpm.conf`配置文件中主要选项的中文翻译和注释: 1. **[global]**:全局设置...
解决nginx+php-fpm无法上传文件问题 一、nginx配置文件中的client_max_body_size设置 在nginx配置文件中,client_max_body_size指令用于设置客户端能够上传的最大文件大小。默认情况下,该值设置为1M,导致上传大...
3. **安装PHP**:CentOS 7通常使用Remi仓库来安装最新版本的PHP,先安装Remi仓库`sudo yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm`,然后安装PHP`sudo yum install php php-fpm ...
### Nginx+php-fpm优化技巧总结 #### 一、引言 随着互联网应用的不断发展壮大,服务器的性能优化成为提升用户体验的关键因素之一。在众多高性能架构中,Nginx+php-fpm的组合因其高效稳定而备受青睐。本文将深入探讨...