944,117 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 53288
  • PHP RSS
Oct 10th, 2004
0

Undefined variable: PHP_SELF

Expand Post »
I think I've done what's necessary to install mod_php in Apache, but this code fails:

----------modtest.php
<?php echo $PHP_SELF?>
------------------------

When I display modtest.php in a browser, I get:

Notice: Undefined variable: PHP_SELF in C:\Program Files\Apache Group\Apache2\htdocs\modtest.php on line 1

I've read in docs that this env var doesn't exist in the comand line version, which I've verified is working because displaying this page is successful:

-------------printinfol.php
<?php echo 'This is my first PHP web page.' ?>
-------------------------

I have this line in my http.conf file:

LoadModule php5_module "c:/php/php5apache2.dll"

and verified that file exists in that directory. Did I miss something to get mod_php to work?

Using Apach2 in WinXP Home with php5.

Thanks in advance!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
techhelpforme is offline Offline
29 posts
since Aug 2004
Oct 10th, 2004
0

Re: Undefined variable: PHP_SELF

The website that told you to use $PHP_SELF is severely out of date. Instead, use $_SERVER['PHP_SELF']
Team Colleague
Reputation Points: 63
Solved Threads: 6
Supreme Evil Overlord
Roberdin is offline Offline
282 posts
since Feb 2003
Oct 10th, 2004
0

Re: Undefined variable: PHP_SELF

Thanks Roberdin, you rock!

BTW, the "out-of-date source" is a university professor, and this is par for his course.

Just so I'm clear, is PHP_SELF deprecated for all versions of PHP or just windows versions?
Reputation Points: 10
Solved Threads: 0
Light Poster
techhelpforme is offline Offline
29 posts
since Aug 2004
Oct 10th, 2004
0

Re: Undefined variable: PHP_SELF

I did a quick google search and came up with this off of phpfreaks.com: $PHP_SELF should not be used because it will not work without register_globals being enabled. Rather, you should use $_SERVER['PHP_SELF'] for it.
Administrator
Staff Writer
Reputation Points: 1422
Solved Threads: 163
The Queen of DaniWeb
cscgal is offline Offline
13,646 posts
since Feb 2002
Feb 21st, 2010
0
Re: Undefined variable: PHP_SELF
I think I've done what's necessary to install mod_php in Apache, but this code fails:

----------modtest.php
<?php echo $PHP_SELF?>
------------------------

When I display modtest.php in a browser, I get:

Notice: Undefined variable: PHP_SELF in C:\Program Files\Apache Group\Apache2\htdocs\modtest.php on line 1

I've read in docs that this env var doesn't exist in the comand line version, which I've verified is working because displaying this page is successful:

-------------printinfol.php
<?php echo 'This is my first PHP web page.' ?>
-------------------------

I have this line in my http.conf file:

LoadModule php5_module "c:/php/php5apache2.dll"

and verified that file exists in that directory. Did I miss something to get mod_php to work?

Using Apach2 in WinXP Home with php5.

Thanks in advance!
Method 1// try to close error message from php in php.ini
Method 2// try to use $_SERVER['PHP_SELF'] instead of $PHP_SELF
Reputation Points: 10
Solved Threads: 0
Newbie Poster
thinnakornzhang is offline Offline
1 posts
since Feb 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Multi form using session :
Next Thread in PHP Forum Timeline: value of image/table





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC