0

I am trying to run below php file using Putty in wordpress.

php-cgi -f info.php

But this command throw this error Undefined index: SCRIPT_NAME.

Server Setting:

 #fastcgi_param  HTTPS $fastcgi_https;
 fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
 include        fastcgi_params;

Please help me to fix this issue.

Addy
  • 101
  • Could it be that `SCRIPT_NAME` and `SCRIPT_FILENAME` aren't the same thing? – mrjink Sep 06 '17 at 07:17
  • I think both are different. SCRIPT_NAME its file name and SCRIPT_FILENAME is the full path of file – Addy Sep 06 '17 at 07:19
  • You missed the intent of my comment. The undefined index is for `SCRIPT_NAME`, while you pass `SCRIPT_FILENAME` to the params. – mrjink Sep 06 '17 at 07:21
  • We are getting issue on wp-includes/load.php on line100. here is code: // Fix for Dreamhost and other PHP as CGI hosts if ( strpos( $_SERVER['SCRIPT_NAME'], 'php.cgi' ) !== false ) – Addy Sep 06 '17 at 07:26
  • I think you need: `fastcgi_param SCRIPT_NAME $document_root$fastcgi_script_name;` – mrjink Sep 06 '17 at 07:44
  • 1
    It is usually defined as `fastcgi_param SCRIPT_NAME $fastcgi_script_name;` inside the `fastcgi_params` file. – Richard Smith Sep 06 '17 at 09:29
  • I just added but didn't work for me – Addy Sep 06 '17 at 09:45

1 Answers1

0

There was an update to nginx or php (can't remember which broke it), but you need two entries in your fastcgi_params:

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;

At least, that's how -we- fixed it here. Give it a shot and let me know :)

Reverend Tim
  • 799
  • 7
  • 14