Nginx不执行PHP文件

时间:2019-07-14 11:34:01

标签: php linux nginx debian debian-stretch

所以我试图在VPS上安装IPS,但是在我安装Nginx和PHP 7.2之后,我注意到由于某种原因我无法执行index.php,希望大家能弄清楚这一点

工作:http://51.75.73.76/forum/info.php 无法正常运作:http://51.75.73.76/forum/index.php

默认Nginx配置:

    listen 80;
    listen [::]:80;

    root /var/www/html;

    index index.php index.html index.htm index.nginx-debian.html;

    server_name 51.75.73.76; 

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.2-fpm.sock;
    }

    location ~ /\.ht {
        deny all;
    }
}

fastcgi-php.conf:

fastcgi_split_path_info ^(.+\.php)(/.+)$;

# Check that the PHP script exists before passing it
try_files $fastcgi_script_name =404;

# Bypass the fact that try_files resets $fastcgi_path_info
# see: http://trac.nginx.org/nginx/ticket/321
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;

fastcgi_index index.php;
include fastcgi.conf;

fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 512k;
fastcgi_buffers 512 16k;
fastcgi_busy_buffers_size 1m;
fastcgi_temp_file_write_size 4m;
fastcgi_max_temp_file_size 4m;
fastcgi_intercept_errors off;

fastcgi_param SCRIPT_FILENAME   $request_filename;
fastcgi_param PATH_INFO         $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED   $document_root$fastcgi_path_info;
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_param SCRIPT_NAME       $fastcgi_script_name;
fastcgi_param REQUEST_URI       $request_uri;
fastcgi_param DOCUMENT_URI      $document_uri;
fastcgi_param DOCUMENT_ROOT     $document_root;
fastcgi_param SERVER_PROTOCOL   $server_protocol;
fastcgi_param REQUEST_SCHEME    $scheme;
fastcgi_param HTTPS             $https if_not_empty;
fastcgi_param HTTP_PROXY        "";
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE   nginx/$nginx_version;
fastcgi_param REMOTE_ADDR       $remote_addr;
fastcgi_param REMOTE_PORT       $remote_port;
fastcgi_param SERVER_ADDR       $server_addr;
fastcgi_param SERVER_PORT       $server_port;
fastcgi_param SERVER_NAME       $server_name;
fastcgi_param REDIRECT_STATUS   200;

Nginx错误日志:

thrown in /var/www/html/forum/init.php on line 528" while reading response header from upstream, client: , server: 51.75.73.76, request: "GET /forum/index.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.2-fpm.sock:", host: "51.75.73.76"
2019/07/14 13:23:48 [error] 13820#13820: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function IPS\mb_internal_encoding() in /var/www/html/forum/init.php:528
Stack trace:
#0 /var/www/html/forum/init.php(1272): IPS\IPS::init()
#1 /var/www/html/forum/index.php(12): require_once('/var/www/html/f...')
#2 {main}
  thrown in /var/www/html/forum/init.php on line 528" while reading response header from upstream, client: , server: 51.75.73.76, request: "GET /forum/index.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.2-fpm.sock:", host: "51.75.73.76"
2019/07/14 13:23:51 [error] 13820#13820: *5 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function IPS\mb_internal_encoding() in /var/www/html/forum/init.php:528
Stack trace:
#0 /var/www/html/forum/init.php(1272): IPS\IPS::init()
#1 /var/www/html/forum/index.php(12): require_once('/var/www/html/f...')
#2 {main}
  thrown in /var/www/html/forum/init.php on line 528" while reading response header from upstream, client: , server: 51.75.73.76, request: "GET /forum/index.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.2-fpm.sock:", host: "51.75.73.76"
2019/07/14 13:23:52 [error] 13820#13820: *5 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function IPS\mb_internal_encoding() in /var/www/html/forum/init.php:528
Stack trace:
#0 /var/www/html/forum/init.php(1272): IPS\IPS::init()
#1 /var/www/html/forum/index.php(12): require_once('/var/www/html/f...')
#2 {main}
  thrown in /var/www/html/forum/init.php on line 528" while reading response header from upstream, client: , server: 51.75.73.76, request: "GET /forum/ HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.2-fpm.sock:", host: "51.75.73.76"

0 个答案:

没有答案