Security Alert! The PHP CGI cannot be accessed directly - Page 2 Security Alert! The PHP CGI cannot be accessed directly - Page 2
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Security Alert! The PHP CGI cannot be accessed directly

Started by nikita, June 13, 2004, 08:10:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nikita

ok i've replaced :

Quote$PHP_SELF = isset($HTTP_SERVER_VARS['REDIRECT_URL']) ? $HTTP_SERVER_VARS['REDIRECT_URL'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];

by

Quote$PHP_SELF = $_SERVER['PHP_SELF'] ? $HTTP_SERVER_VARS['REDIRECT_URL'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];

i don't know if i had to keep the ; so i try :

Quote$PHP_SELF = $_SERVER['PHP_SELF']; ? $HTTP_SERVER_VARS['REDIRECT_URL'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];

i try that too :

Quote$PHP_SELF = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['REDIRECT_URL'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];


and it's the same problem  :\'(

i can ask to my server admin if there is an information you need.

Joachim Müller

Try changing $PHP_SELF = isset($HTTP_SERVER_VARS['REDIRECT_URL']) ? $HTTP_SERVER_VARS['REDIRECT_URL'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];to$PHP_SELF = isset($HTTP_SERVER_VARS['REDIRECT_URL']) ? $HTTP_SERVER_VARS['REDIRECT_URL'] : $_SERVER['PHP_SELF'];

GauGau

nikita


hollandy2k

Hello,

I have the same problem withe the language files. When i select another language i get :

Security Alert! The PHP CGI cannot be accessed directly.
This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.
This in on my phpinfo:

_SERVER["PHP_SELF"] /foto/phpinfo.php 

REDIRECT_STATUS 200
REDIRECT_URL /foto/phpinfo.php

Mirjam

Joachim Müller

I'm not sure what to advice except playing with the vars in init.inc.php to find one you actually have on your server.

GauGau

cjkline83

I'm confused as to what exactly to modify.

I've edited init.inc.php to state the following:
Quote$PHP_SELF = isset($HTTP_SERVER_VARS['REDIRECT_URL']) ? $HTTP_SERVER_VARS['REDIRECT_URL'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];

But its still not working. http://cjkline83.shacknet.nu/cm

Tranz

#26
I ran into the same problem I guess after upgrading PHP on my computer; the installation came with a different php.ini file.

$_SERVER["SCRIPT_NAME"] was pointing to php/php.exe so that broke the language and theme selectors for me.

I eventually fixed it by changing a setting in php.ini. Since not everyone can edit php.ini, this won't be very helpful for everyone, but I'll share it anyway.

It turned out that my new php.ini file commented out
; cgi.fix_pathinfo=1

I removed the semi-colon to enable that line and recompiled php and it worked. My selectors worked again.

Also note that I am using Apache, and PHP as cgi.

wilq

Hello
unluckly I become one of those who have got same problem.
I tried suggested solutions but without result.

Did any body move forrward ??

My web is at: www.komsad.com/piotrw changing them or lang We get Security alert ...

Joachim Müller

try contacting your webhost for support (send them the url of this thread as well).

Joachim

drsirius

Quote from: hyperion on June 22, 2004, 02:26:07 AM
In include/init.inc.php, change $PHP_SELF to:


$PHP_SELF = $_SERVER['PHP_SELF'];


@GauGau,

I've noticed that this is the only self variable that the PHP-CGI binaries seem to create. It might be a good idea to put a note for PHP-CGI users in the documentation.

I had the same problem there my webhost uses the php.cgi
however I did not find this in the documentation and spent some time searching the forum

maybe it would be wise to add a reference for cgi hosted people and keep up the good work  ;)

Wega

Quote from: TranzNDance on November 30, 2004, 11:29:49 PM
I ran into the same problem I guess after upgrading PHP on my computer; the installation came with a different php.ini file.

$_SERVER["SCRIPT_NAME"] was pointing to php/php.exe so that broke the language and theme selectors for me.

I eventually fixed it by changing a setting in php.ini. Since not everyone can edit php.ini, this won't be very helpful for everyone, but I'll share it anyway.

It turned out that my new php.ini file commented out
; cgi.fix_pathinfo=1

I removed the semi-colon to enable that line and recompiled php and it worked. My selectors worked again.

Also note that I am using Apache, and PHP as cgi.

I did so, but then I'v got some errorrs on the header of the page
Notice: Undefined index: PATH_TRANSLATED in C:\www\coppermine\index.php on line 21

Notice: Undefined offset: -1 in C:\www\coppermine\index.php on line 22

Warning: Cannot modify header information - headers already sent by (output started at C:\www\coppermine\index.php:21) in C:\www\coppermine\themes\igames\theme.php on line 825

Warning: Cannot modify header information - headers already sent by (output started at C:\www\coppermine\index.php:21) in C:\www\coppermine\themes\igames\theme.php on line 826

Warning: Cannot modify header information - headers already sent by (output started at C:\www\coppermine\index.php:21) in C:\www\coppermine\include\functions.inc.php on line 51

I removed those lines (21)
// Check if standalone is installed in a portal like phpNuke (added by DJMaze)
$DIR=preg_split("/[\/\\\]/",dirname($_SERVER['PATH_TRANSLATED']));
if ($DIR[count($DIR)-2] == "modules") {
    echo "<html><body><h1>ERROR</h1>You installed the standalone Coppermine into your Nuke portal.<br>".
         "Please download and install a CPG Port: <a href=\"http://sourceforge.net/project/showfiles.php?group_id=89658\">CPG for PostNuke OR CPG for PHPnuke</a></body></html>";
    die();
} // end check

and ewerything works fine now.