User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 427,848 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,813 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 24936 | Replies: 3
Reply
Join Date: Aug 2004
Posts: 29
Reputation: techhelpforme is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
techhelpforme's Avatar
techhelpforme techhelpforme is offline Offline
Light Poster

Undefined variable: PHP_SELF

  #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!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2003
Location: London, England
Posts: 281
Reputation: Roberdin will become famous soon enough Roberdin will become famous soon enough 
Rep Power: 7
Solved Threads: 6
Colleague
Roberdin Roberdin is offline Offline
Supreme Evil Overlord

Re: Undefined variable: PHP_SELF

  #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  
Join Date: Aug 2004
Posts: 29
Reputation: techhelpforme is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
techhelpforme's Avatar
techhelpforme techhelpforme is offline Offline
Light Poster

Re: Undefined variable: PHP_SELF

  #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  
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 10,950
Reputation: cscgal is just really nice cscgal is just really nice cscgal is just really nice cscgal is just really nice cscgal is just really nice 
Rep Power: 32
Solved Threads: 116
Admin
Staff Writer
cscgal's Avatar
cscgal cscgal is online now Online
The Queen of DaniWeb

Re: Undefined variable: PHP_SELF

  #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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 3:17 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC