B
B
baalmor2012-10-12 13:49:54
PHP
baalmor, 2012-10-12 13:49:54

nginx+php-fpm+freebsd logs?

Hello.
After a week of agony, I give up. :)
I need help setting up the nginx+php-fpm+freebsd bundle
More specifically, I have a problem with the error logs. They, stupidly, are not written.
the input is this.
freebsd 8.3-RELEASE
PHP 5.4.7 (fpm-fcgi)
nginx version: nginx/1.2.4
FPM config

[global]<br>
pid = run/php-fpm.pid<br>
error_log = log/php-fpm.log<br>
log_level = notice<br>
emergency_restart_threshold = 5<br>
emergency_restart_interval = 2<br>
process_control_timeout = 2<br>
daemonize = yes<br>
events.mechanism = kqueue<br><br>
[puser]<br>
listen = /usr/local/www/host/tmp/php-fpm.sock;<br>
listen.backlog = -1<br>
listen.allowed_clients = 127.0.0.1<br>
listen.owner = puser<br>
listen.group = puser<br>
listen.mode = 0666<br>
user = puser<br>
group = puser<br>
pm = dynamic<br>
pm.max_children = 30<br>
pm.start_servers = 2<br>
pm.min_spare_servers = 2<br>
pm.max_spare_servers = 5<br>
pm.max_requests = 50<br>
slowlog = /usr/local/www/host/logs/fpm.log.slow<br>
request_slowlog_timeout = 1s<br>
rlimit_files = 1024<br>
rlimit_core = 0<br>
chroot = /usr/local/www/host/<br>
catch_workers_output = yes<br>
env[HOSTNAME] = $HOSTNAME<br>
env[TMP] =    /tmp<br>
env[TMPDIR] = /tmp<br>
env[TEMP] =   /tmp<br>
php_admin_value[upload_tmp_dir] = /tmp<br>
php_admin_value[cgi.fix_pathinfo] = 0<br>
php_admin_value[date.timezone]= 'Europe/Moscow'<br>
php_admin_value[memory_limit] = 320m<br>
php_admin_value[max_execution_time] = 180<br>
php_admin_flag[log_errors] = on<br>
php_admin_value[error_log]  = /usr/local/www/host/logs/fpm-err.log (пробовал и по chroot ставить, и просто файл указывал. никаких признаков жизни)<br>
php_admin_value[error_reporting] = 'E_ALL & ~E_NOTICE'<br>
php_admin_value[display_errors] = off<br>
php_admin_flag[display_startup_errors] = off<br>

nginx config
user  www;<br>
worker_processes  2;<br>
worker_rlimit_nofile 80000;<br><br>
error_log  /var/log/nginx_error.log  notice;<br><br>
#pid        logs/nginx.pid;<br><br>
events {<br>
    worker_connections  2048;<br>
    use kqueue;<br>
}<br><br>
http {<br>
    server_tokens off;<br>
    client_max_body_size 4m;<br>
    include       mime.types;<br>
    default_type  application/octet-stream;<br>
    charset utf-8;<br>
    sendfile        on;<br>
    keepalive_timeout  65;<br>
    tcp_nopush          on;<br>
    tcp_nodelay         on;<br>
    log_format IP .$remote_addr.;<br>
    log_format main '$remote_addr - $remote_user [$time_local] $request $request_body '<br>
'"$status" $body_bytes_sent "$http_referer" '<br>
'"$http_user_agent" "$http_x_forwarded_for"';<br>
    reset_timedout_connection on;<br>
    server {<br>
  listen 80;<br>
  server_name www.example.com;<br><br>
  access_log /usr/local/www/host/logs/access.log main;<br>
  error_log  /usr/local/www/host/logs/error.log error;<br>
  error_page 500 502 503 504 /errors/50x.html;<br>
  error_page 404  /errors/404.html;<br>
  root /usr/local/www/host/htdocs;<br>
  index index.php index.html index.htm;<br><br>
  location / {<br>
        index  index.html index.php;<br>
        try_files $uri /index.php?$args;<br>
    }<br><br>
   location ~ \.php$ {<br>
    fastcgi_split_path_info  ^(.+\.php)(.*)$;<br>
    fastcgi_intercept_errors on;<br>
    fastcgi_pass unix:/usr/local/www/host/tmp/php-fpm.sock;<br>
    fastcgi_index index.php;<br>
    fastcgi_param SCRIPT_FILENAME   /htdocs$fastcgi_script_name;<br>
    fastcgi_param  PATH_INFO        $fastcgi_path_info;<br>
    fastcgi_param  PATH_TRANSLATED  /htdocs$fastcgi_script_name;<br>
    include /usr/local/etc/nginx/fastcgi_params;<br>
    }<br>
}<br><br>
}<br><br>

in the index.php file, I deliberately make a mistake, for example, I put a ' (quotation mark) and ...
no reaction from the server. It throws a 500 standard error, of course, but there is no evidence of this incident in all logs other than access.log.
What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
B
baalmor, 2012-12-07
@baalmor

In short, the solution turned out to be tearfully simple.
php_admin_value[error_reporting] = 'E_ALL & ~E_NOTICE' contains quotes, but there was a note in the documentation that it is correct to specify this parameter without quotes.
Accordingly, we change to
php_admin_value[error_reporting] = E_ALL & ~E_NOTICE
and get the long-awaited log.

K
kerberos, 2012-10-12
@kerberos

I recommend to see which php.ini file is currently in use using
<?php phpinfo();
Then, in this php.ini file, put the desired value in the error_log parameter

B
baalmor, 2012-10-12
@baalmor

Tried it, no change at all.

D
Diam0n, 2012-10-12
@Diam0n

what permissions are set on the /usr/local/www/host/logs/ folder?
It is necessary that nginx can write
there and, of course, create and set write permissions to the access.log and error.log files for the www user

A
AGvin, 2012-10-12
@AGvin

Look in php.ini for at least the error_reporting and
log_errors directives
If you want to display errors in the browser use display_errors

B
baalmor, 2012-10-12
@baalmor

I discovered an amazing thing. I can't even display an error by turning on the display_error parameter
and turning off fastcgi_intercept_errors.
Those. Nothing is output at all on error. White screen of death

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question