1

I'm experiencing the weirdest problem. I've been working on a file upload problem for the last few days and have been using phpinfo() to track changes to INI settings. The last time I touched it was two days ago... it all worked then.

Today, phpinfo() is causing a 503 Service Temporarily Unavailable error. Here's the weird part: the website works fine! I's PHP + MySQL driven and I can move around in it just fine (well... other than the issues I'm working on). But as soon as I add phpinfo() to show up as the first thing in the <body> block... I get the error.

I've even tried creating a one-line file: <?php phpinfo(); ?> This dies with a 503 error, too.

The error log contains this:

[Fri Sep 15 14:22:31.192593 2017] [proxy_fcgi:error] [pid 2695] (104)Connection reset by peer: [client 67.161.220.240:44230] AH01075: Error dispatching request to :

I've restarted Apache and Nginx with no errors. Does anyone have an idea about what service or some such might have died on my machine to cause this?

NGINX Config File

#user  nginx;
worker_processes  1;

#error_log  /var/log/nginx/error.log;
#error_log  /var/log/nginx/error.log  notice;
#error_log  /var/log/nginx/error.log  info;

#pid        /var/run/nginx.pid;

include /etc/nginx/modules.conf.d/*.conf;

events {
    worker_connections  1024;
}


http {
include       mime.types;
default_type  application/octet-stream;

#log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
#                  '$status $body_bytes_sent "$http_referer" '
#                  '"$http_user_agent" "$http_x_forwarded_for"';

#access_log  /var/log/nginx/access.log  main;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;
#tcp_nodelay        on;

#gzip  on;
#gzip_disable "MSIE [1-6]\.(?!.*SV1)";

server_tokens off;

include /etc/nginx/conf.d/*.conf;
}

# override global parameters e.g. worker_rlimit_nofile
include /etc/nginx/*global_params;
JBH
  • 1,823
  • 1
  • 19
  • 30
  • Are you hosting your own site, and if so do you manage the PHP installation? `phpinfo` is often viewed as a security hole and turned off by SysAdmins – jhenderson2099 Sep 15 '17 at 22:04
  • Side note, you don't have to echo phpinfo(). It echos itself. (But that shouldn't cause this problem, just fyi.) – Don't Panic Sep 15 '17 at 22:06
  • Show nginx configuration. The php part. – sensorario Sep 15 '17 at 22:11
  • @sensorario, added. – JBH Sep 15 '17 at 22:17
  • @jhenderson2099, I host my own site. As mentioned, this all worked two days ago. – JBH Sep 15 '17 at 22:18
  • @Don'tPanic. :-} You're correct. It's not working without the `echo`, either. – JBH Sep 15 '17 at 22:18
  • Have you updated you PHP version recently? If you haven't, then, if you create a new, simple PHP application under the same site, and dump `phpinfo` does that work? If 'yes', then it is specific to your application (perhaps a syntax error). If 'no' then `phpinfo` has been disabled for the entire instance. – jhenderson2099 Sep 15 '17 at 22:51
  • @jhenderson2099, I have not updated PHP recently. I have a single php file (`test.php`) in the domain webroot with ``. I can execute `php -f test.php` and it works fine, but if I try to access it via `http://example.com/test.php` I get the 503 error. I've never disabled phpinfo before and don't understand why it would be disabled. I don't even know how to do it. – JBH Sep 15 '17 at 23:02
  • After doing some research, I don't think that `phpinfo` is disabled. If it was, then it should just be an empty string. An HTTP 503 means 'Service Unavailable'. Can you access any other PHP functions (e.g. `phpversion`) via the web server and or `php -f`? – jhenderson2099 Sep 15 '17 at 23:17
  • Also, do you have any PHP extensions that you might be using? – jhenderson2099 Sep 15 '17 at 23:19
  • @jhenderson2099 `phpversion()` works just fine. No 503 error. It appears to only be `phpinfo()`. Remember, the site itself is written in PHP and it's working fine. I do have extensions, such as ImageMagick, which I use on my site. I just tested the image upload function (which uses ImageMagick) and it's working fine. – JBH Sep 15 '17 at 23:21
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/154571/discussion-between-jhenderson2099-and-jbh). – jhenderson2099 Sep 15 '17 at 23:23

2 Answers2

1

Is it possible that this is the problem: Apache, FastCGI - Error 503

(i.e. a Fast CGI configuration issue?)

jhenderson2099
  • 956
  • 8
  • 17
-1

I solved this by logging into PLESK. I went to Tools & Settings -> Services Management.

Then I restarted PHP-FPM 5.6.33 service (this may vary depending on the version of PHP you are running).

After a re-start, phpinfo()worked fine. I'm not sure what the issue was. As you experienced, my website was working fine but it may have been causing other issues I'm not aware of.

BSMP
  • 4,596
  • 8
  • 33
  • 44