Jump to content

php weirdness


jwwceo

Recommended Posts

Hey all. Last night, something on my server happened, and now my scripts aren't working like they should.

 

It looks like my $_SERVER array is broken. When I echo $_SERVER['PHP_SELF'] I get the following:

 

[php_SELF] => /cgi-bin/php5.cgi

 

same thing for

 

[sCRIPT_NAME] => /cgi-bin/php5.cgi

 

I use the SELF variable in some script, so I need it to be working,

 

any ideas?? is this possibly a virus??

 

James

Link to comment
Share on other sites

Sorry if I'm not being clear.

 

the problem is that the variable is not holding the right name. This file is called home.php, not php5.cgi.

 

It is not returning the correct name, and that is breaking all my scripts where I use PHP_SELF.

 

JAmes

 

 

Link to comment
Share on other sites

you made cgi file? not need maybe? delete no?

 

PHPRC=$DOCUMENT_ROOT/../etc/php5  path to php = DOCUMENT_ROOT + /../etc/php5

export PHPRC = Path to php.ini (environmental variable) export =? output

umask 022  = CHMOD 644 which means (read/write files/read files)

SCRIPT_FILENAME = $PATH_TRANSLATED  ($PATH_TRANSLATED = ???)

export SCRIPT_FILENAME (output that?)

exec /user/bin/php5-cgi  (run php5-cgi.exe)

 

probably some kind of a script to run it in silent mode kinda like services on XP..

Link to comment
Share on other sites

Is this server run by you or by someone else?  If someone else runs it they may have reconfigured how php runs.  Or even upgraded from php 4 to php 5.

 

If the server is yours, it may have been affected by a change to the webserver, even if you didn't modify php itself.

 

The short answer is that $_SERVER variables are not really guaranteed by php to hold any specific value.  PHP relies on the web server to pass those values through, which is why they are called $_SERVER variables .. If the web server gives php different values, then that's what your script will get.

 

The manual says this:

 

$_SERVER is an array containing information such as headers, paths, and script locations. The entries in this array are created by the web server. There is no guarantee that every web server will provide any of these; servers may omit some, or provide others not listed here. That said, a large number of these variables are accounted for in the » CGI 1.1 specification, so you should be able to expect those.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.