Jump to content

php-fpm and nginx - include_once problem


Recommended Posts

Hello,

 

It's been awhile since i've used Nginx and a website that I am running on the server uses include_once to include the header, sidebar and footer. The problem is they don't actually load under Nginx and was wondering if anyone else encountered this and knows how to solve this? Nothing logs into the php error log related to it.

 

Here is the conf file.

 

server {
        listen       80;
        server_name  _;

        #charset koi8-r;

        access_log /home/web/logs/host.access.log  main;

        location / {
            root   /home/web/public_html;
          index index.php index.html index.htm;
        }

        error_page  404              /404.html;
        location = /404.html {
            root   /usr/share/nginx/html;
        }
        location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
		access_log        off;
		expires           30d;
		root /home/web/public_html;
	}
    

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
       }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
	location ~ .php$ {
		fastcgi_split_path_info ^(.+\.php)(.*)$;
		fastcgi_pass   127.0.0.1:9000;
		fastcgi_param PHP_VALUE "error_log=/home/web/logs/php.error.log";
		fastcgi_index  index.php;
		fastcgi_param  SCRIPT_FILENAME  /home/web/public_html$fastcgi_script_name;
		include fastcgi_params;
		fastcgi_param  QUERY_STRING     $query_string;
		fastcgi_param  REQUEST_METHOD   $request_method;
		fastcgi_param  CONTENT_TYPE     $content_type;
		fastcgi_param  CONTENT_LENGTH   $content_length;
		fastcgi_intercept_errors        on;
		fastcgi_ignore_client_abort     off;
		fastcgi_connect_timeout 60;
		fastcgi_send_timeout 50;
		fastcgi_read_timeout 50;
		fastcgi_buffer_size 128k;
		fastcgi_buffers 4 256k;
		fastcgi_busy_buffers_size 256k;
		fastcgi_temp_file_write_size 256k;
	}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /\.ht {
            deny  all;
        }
    }

Link to comment
Share on other sites

looks very odd to me, maybe you're not using an absolute path in the include function? But that doesn't explain why php doesn't show any error if it can't find the file

 

just an attempt

 

try to change nginx settings like this

 

fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

 

I remember that when the config settings are wrong and you try to open a non-existent php file it will return a black page

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.