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做为基础环境容器,整体已经经过优化
Windows 下使用 RunHiddenConsole 启动 nginx、php-fpm, https://www.nginx.com/resources/wiki/start/topics/examples/phpfastcgionwindows/
php-fpm。放到/etc/init.d/目录。然后执行:chmod a+x php-fpm 然后就可以/etc/init.d/php-fpm start 或者systemctl start php-fpm
nginx+php-fpm解决502 Bad Gateway.zip
php-fpm是个中间件,在需要php解释器来处理.php文本时会用到php-fpm。自从php5.3.3以后就将php-fpm集成在php内核中。PHP-FPM提供了更好的PHP进程管理方式,可以有效控制内存和进程、可以平滑重载PHP配置。 作者:...
centos5.2 源码安装nginx+php-fpm+http push,演示http push 功能,测试通过
docker-wordpress-nginx, 安装最新的wordpress,Nginx 和 PHP-FPM的Dockerfile docker-wordpress-nginx安装最新的wordpress,Nginx,php-apc和 php fpm的Dockerfile 。NB: 感谢 jbfink,他在wordpress部分做了大部分...
Fedora 15 安装 Nginx (PHP-FPM)+MySQL+PHP Web服务.docx
解决nginx+php-fpm无法上传文件问题.docx
该模板使用php-fpm为nginx创建OpenShift资源带有nginx和php-fpm的Pod的DeploymentConfig 适用于php-fpm的BuiltConfig和ImageStream(能够自定义php-fpm版本并包括自定义PHP模块) 用于nginx配置的ConfigMap 为Nginx...
Windows 下使用 RunHiddenConsole 启动 nginx、php-fpm, https://www.nginx.com/resources/wiki/start/topics/examples/phpfastcgionwindows/
主要介绍了安装配置php-fpm来搭建Nginx+PHP的生产环境的方法,php-fpm的作用是将FastCGI进程管理整合进PHP包,需要的朋友可以参考下
dlaravel, 使用 PHP-FPM的Laravel,MySQL和 Nginx 组成 Docker 如果你想要英文手册,请参考下面的链接。英文laravel英文手册。 laravel為什麼用D-Laravel用docker聽起來,好像比較潮。:p./console help (幫助,con
安装php-fpm_nginx_mysql 这个仓库会教会你如何在linux上面安装php-fpm + nginx + mysql环境,首先是nginx安装,然后是mysql安装,最后是php安装,也包含一些常见的问题及解决方法。 #欢迎补充遇到的问题
php-fpm,用于php网页解析的软件工具包,还有一些php写好的网页
然后它将打印nginx Web服务器已准备就绪,如果要使用php-fpm安装/配置MySQL或PostgreSQL,请从菜单中选择。 否则,只需按Enter键即可退出。 如果选择1 ,则将安装并配置带有扩展名MySQL和PHP-FPM(MySQL根密码为: ...
PHP-FPM 和 Nginx Docker 镜像基于对(最新)PHP-FPM和Nginx的Lightwight泊坞窗图像 图像大小只有 ~100MB ! 非常新的包 (alpine:edge) 2015-04-03: 5.6.7 1.6.2用法sudo docker run -v /data:/DATA -p 80:80 ...
php-fpm7.1包 yum localinstall -y php-fpm/*安装 包是7.1 tar 压缩 下载后tar解压 yum即可安装