我在Nginx中的服务器块无法加载我的PHP

时间:2017-07-17 21:01:57

标签: nginx server block ioncube

我希望你过得愉快。在过去的14天里,我一直在努力从数字海洋设置我的VPS,包括Apache2之后的所有基本元素,我发现Apache2不那么复杂和快,我安装了Nginx。我安装了所有必要的元素,如LEMP和Phpmyadmin等。

我在这里遇到的问题是,我似乎陷入困境,要让PHP文件在我的两个服务器块之一中工作(我有一个(example.com)作为默认服务器和另一个( test.com)没有)。来自CPVlab(跟踪工具)的php文件称为check-server-requirements.php。一个脚本,用于检查服务器是否已准备好安装CPVlab。

当我将php文件上传到/var/www/example.com或test.com/html并尝试通过((example.com)(test.com)/check-server-requirements.php)访问它时它向我显示了一个空白页面。

知道该脚本是由ioncube编码的。因此,它需要在我的服务器上安装ioncube才能运行。我也这样做了,根据ioncube的加载器脚本,它已成功安装。

在您的下方,我会找到每个服务器模块配置:

for example.com:

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

root /var/www/example.com/html;
index index.html index.htm;

# Make site accessible from http://localhost/
server_name example.com www.example.com;

location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    try_files $uri $uri/ =404;
    # Uncomment to enable naxsi on this location
    # include /etc/nginx/naxsi.rules
}

location /phpmyadmin {
        auth_basic "Admin Login";
        auth_basic_user_file /etc/nginx/pma_pass;
}

# Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
#location /RequestDenied {
#   proxy_pass http://127.0.0.1:8080;    
#}

error_page 404 /404.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;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
#   # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
#   # With php5-cgi alone:
#   fastcgi_pass 127.0.0.1:9000;
#   # With php5-fpm:
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}

对于test.com:

server {
listen 80;
listen [::]:80;

root /var/www/test.com/html;
index index.php index.htm;

# Make site accessible from http://localhost/
server_name test.com www.test.com;

location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    try_files $uri $uri/ =404;
    # Uncomment to enable naxsi on this location
    # include /etc/nginx/naxsi.rules
}

location /phpmyadmin {
        auth_basic "Admin Login";
        auth_basic_user_file /etc/nginx/pma_pass;
}

# Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
#location /RequestDenied {
#   proxy_pass http://127.0.0.1:8080;    
#}

error_page 404 /404.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;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
#   # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
#   # With php5-cgi alone:
#   fastcgi_pass 127.0.0.1:9000;
#   # With php5-fpm:
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
}

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

}

当我尝试通过域访问脚本时,这是我在error.log中找到的错误:

2017/07/17 20:54:56 [error] 1180#0: *78 FastCGI sent in stderr: "PHP message: PHP Notice:  Use of undefined constant CURLOPT_RETURNTRANSFER - assumed 'CURLOPT_RETURNTRANSFER' in /var/www/test.com/html/check-server-requirements.php on line 0
PHP message: PHP Notice:  Use of undefined constant CURLOPT_HEADER - assumed 'CURLOPT_HEADER' in /var/www/test.com/html/check-server-requirements.php on line 0

PHP message: PHP Notice:  Use of undefined constant CURLOPT_ENCODING - assumed 'CURLOPT_ENCODING' in /var/www/test.com/html/check-server-requirements.php on line 0

PHP message: PHP Notice:  Use of undefined constant CURLOPT_CONNECTTIMEOUT - assumed 'CURLOPT_CONNECTTIMEOUT' in /var/www/test.com/html/check-server-requirements.php on line 0

PHP message: PHP Notice:  Use of undefined constant CURLOPT_TIMEOUT - assumed 'CURLOPT_TIMEOUT' in /var/www/test.com/html/check-server-requirements.php on line 0

PHP message: PHP Fatal error:  Call to undefined function curl_init() in /var/www/test.com/html/check-server-requirements.php on line 0" while reading response header from upstream, client: xxx.xxx.xx.250, server: test.com, request: "GET /check-server-requirements.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "test.com"

我真的很感激这个问题的一些帮助。提前谢谢。

P.S:服务器块(域)成功运行。

0 个答案:

没有答案