Undefined variable: PHP_SELF

Reply

Join Date: Aug 2004
Posts: 29
Reputation: techhelpforme is an unknown quantity at this point 
Solved Threads: 0
techhelpforme's Avatar
techhelpforme techhelpforme is offline Offline
Light Poster

Undefined variable: PHP_SELF

 
0
  #1
Oct 10th, 2004
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!
Reply With Quote Quick reply to this message  
Join Date: Feb 2003
Posts: 282
Reputation: Roberdin will become famous soon enough Roberdin will become famous soon enough 
Solved Threads: 6
Team Colleague
Roberdin Roberdin is offline Offline
Supreme Evil Overlord

Re: Undefined variable: PHP_SELF

 
0
  #2
Oct 10th, 2004
The website that told you to use $PHP_SELF is severely out of date. Instead, use $_SERVER['PHP_SELF']
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 29
Reputation: techhelpforme is an unknown quantity at this point 
Solved Threads: 0
techhelpforme's Avatar
techhelpforme techhelpforme is offline Offline
Light Poster

Re: Undefined variable: PHP_SELF

 
0
  #3
Oct 10th, 2004
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?
Reply With Quote Quick reply to this message  
Join Date: Feb 2002
Posts: 12,057
Reputation: cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light 
Solved Threads: 128
Administrator
Staff Writer
cscgal's Avatar
cscgal cscgal is online now Online
The Queen of DaniWeb

Re: Undefined variable: PHP_SELF

 
0
  #4
Oct 10th, 2004
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.
Dani the Computer Science Gal
Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum


Views: 35248 | Replies: 3
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC