很多站长朋友们都不太清楚phpfpm出错,今天小编就来给大家整理phpfpm出错,希望对各位有所帮助,具体内容如下:
本文目录一览: 1、 CentOS Linux下启动php-fpm失败,求大神帮解决 2、 php-fpm 没有响应,僵死,求教 3、 php-fpm 找不到 php-cgi.sock 怎么办 4、 php-fpm start报错:/etc/php-fpm.conf:1: parser error : Document is empty,parser error : 5、 用“yum”安装“php-fpm”提示There are no enabled repos怎么办? CentOS Linux下启动php-fpm失败,求大神帮解决yum -y install php-fpm
报错都写了你没有/usr/local/php/sbin/php-fpm了,装个噻
php-fpm 没有响应,僵死,求教日志提示明显是脚本执行超时,这些问题通常出现的原因有:
1、大量的IO操作(文件读写、数据库操作等),代码循环逻辑没控制好,执行时间超时;
2、系统的负载过高,脚本受阻塞长时间等待超时;
3、php环境没配置好。
php-fpm 找不到 php-cgi.sock 怎么办php-fpm有两种listen方式,一种是通过端口来操作,一种是sock文件。
在nginx的server配置当中,如果设置为fastcgi_pass unix:/tmp/php-cgi.sock的话,有可能会出现502错误,这是以为nginx此项没有找到php-cgi.sock文件或者权限问题导致的,我们也可以改成fastcgi_pass:127.0.0.1:9000来修正这个错误 。
当我们用php-fpm来管理我们的php启动时,按照如下的配置,就会自动生成/tmp/php-cgi.sock文件,然后再访问的话就不回出现502 Gateway错误了。配置如下:
[global]
pid = /var/run/php-fpm.pid
error_log = /var/log/php-fpm.log
log_level = notice
[www]
listen = /tmp/php-cgi.sock
user = www
group = www
pm = dynamic
pm.max_children = 20
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
php-fpm start报错:/etc/php-fpm.conf:1: parser error : Document is empty,parser error :这个明显的是php-fpm.conf配置文件的问题,我给你份我用的
<configuration>
All relative paths in this config are relative to php's install prefix
<section name="global_options">
Pid file
<value name="pid_file">/opt/php/logs/php-fpm.pid</value>
Error log file
<value name="error_log">/opt/php/logs/php-fpm.log</value>
Log level
<value name="log_level">notice</value>
When this amount of php processes exited with SIGSEGV or SIGBUS ...
<value name="emergency_restart_threshold">10</value>
... in a less than this interval of time, a graceful restart will be initiated.
Useful to work around accidental curruptions in accelerator's shared memory.
<value name="emergency_restart_interval">1m</value>
Time limit on waiting child's reaction on signals from master
<value name="process_control_timeout">5s</value>
Set to 'no' to debug fpm
<value name="daemonize">yes</value>
</section>
<workers>
<section name="pool">
Name of pool. Used in logs and stats.
<value name="name">default</value>
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">/tmp/php-cgi.sock</value>
<value name="listen_options">
Set listen(2) backlog
<value name="backlog">-1</value>
Set permissions for unix socket, if one used.
In Linux read/write permissions must be set in order to allow connections from web server.
Many BSD-derrived systems allow connections regardless of permissions.
<value name="owner"></value>
<value name="group"></value>
<value name="mode">0666</value>
</value>
Additional php.ini defines, specific to this pool of workers.
<value name="php_defines">
<value name="sendmail_path">/usr/sbin/sendmail -t -i</value>
<value name="display_errors">1</value>
</value>
Unix user of processes
<value name="user">www</value>
Unix group of processes
<value name="group">www</value>
Process manager settings
<value name="pm">
Sets style of controling worker process count.
Valid values are 'static' and 'apache-like'
<value name="style">static</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">128</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">20</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">35</value>
</value>
</value>
The timeout (in seconds) for serving a single request after which the worker process will be terminated
Should be used when 'max_execution_time' ini option does not stop script execution for some reason
'0s' means 'off'
<value name="request_terminate_timeout">0s</value>
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">0s</value>
The log file for slow requests
<value name="slowlog">logs/slow.log</value>
Set open file desc rlimit
<value name="rlimit_files">65535</value>
Set max core size rlimit
<value name="rlimit_core">0</value>
Chroot to this directory at the start, absolute path
<value name="chroot"></value>
Chdir to this directory at the start, absolute path
<value name="chdir"></value>
Redirect workers' stdout and stderr into main error log.
If not set, they will be redirected to /dev/null, according to FastCGI specs
<value name="catch_workers_output">yes</value>
How much requests each process should execute before respawn.
Useful to work around memory leaks in 3rd party libraries.
For endless request processing please specify 0
Equivalent to PHP_FCGI_MAX_REQUESTS
<value name="max_requests">10240</value>
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</value>
Pass environment variables like LD_LIBRARY_PATH
All $VARIABLEs are taken from current environment
<value name="environment">
<value name="HOSTNAME">$HOSTNAME</value>
<value name="PATH">/usr/local/bin:/usr/bin:/bin</value>
<value name="TMP">/tmp</value>
<value name="TMPDIR">/tmp</value>
<value name="TEMP">/tmp</value>
<value name="OSTYPE">$OSTYPE</value>
<value name="MACHTYPE">$MACHTYPE</value>
<value name="MALLOC_CHECK_">2</value>
</value>
</section>
</workers>
</configuration>
用“yum”安装“php-fpm”提示There are no enabled repos怎么办?Nginx 本身就不用介绍了,目前使用 FastCGI 是最流行的模式.现在不少网站使用.我来介绍一个简单的安装方法.
先要使用第三方的源,默认的源是不存在最新的 php 的,需要 php 5.3.3 以上才有 php-fpm,所以一定要安装这些源..
配置最新 PHP 的源
如果是 CentOS 6 和 Red Hat (RHEL) 6 的 Remi 源
rpm -Uvh
rpm -Uvh
如果是 CentOS 5 和 Red Hat (RHEL) 5 的 Remi 源
rpm -Uvh
rpm -Uvh
配置 Nginx 的源
我们需要建一个新的源文件,编辑 /etc/yum.repos.d/nginx.repo 就可以了.加入如下内容
[nginx]
name=nginx repo
baseurl=
gpgcheck=0
enabled=1
安装最新的 Nginx 和 PHP(php-fpm)
安装最新的 Nginx 和 PHP .还有支持启动 FastCGI 的 php-fpm 的功能.其它都是 PHP 的一些模块了.
yum --enablerepo=remi install nginx php php-fpm php-common \
php-pear php-pdo php-mysql php-pgsql php-pecl-memcache php-gd \
php-mbstring php-mcrypt php-xml
安装 MYSql 也需要使用这个的源才行
yum --enablerepo=remi install mysql mysql-server
配置 Nginx 和 PHP-FPM
在 Nginx 加,给这些下面的注掉的内容打开,让 php 的文件支持使用 fastcgi 来通信就行了.
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
测试 Nginx 和 PHP-FPM
我们需要确认 fastcgi 是否能正常的使用,所以需要在,上面的 /usr/share/nginx/html 中加入 phpinfo.php 的测试文件.
<?php
phpinfo();
?>
这时只要打开 url 来测试这个 phpinfo.php 文件是否能正常的显示就行了.
启动和永久启动 Nginx 和 PHP-FPM
我们一定不想下次 Nginx 和 PHP-FPM 在也启动不了啦,所以我们需要加入启动中去.让系统启动后就能自动启动这些.
service nginx start
service php-fpm start
chkconfig --add nginx
chkconfig --levels 235 nginx on
chkconfig --add php-fpm
chkconfig --levels 235 php-fpm on
根据具体问题类型,进行步骤拆解/原因原理分析/内容拓展等。
具体步骤如下:/导致这种情况的原因主要是……
关于phpfpm出错的介绍到此就结束了,不知道本篇文章是否对您有帮助呢?如果你还想了解更多此类信息,记得收藏关注本站,我们会不定期更新哦。
查看更多关于phpfpm出错 php报错信息的详细内容...