•
•
•
•
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
![]() |
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!
----------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!
•
•
Join Date: Feb 2003
Location: London, England
Posts: 281
Reputation:
Rep Power: 7
Solved Threads: 6
The website that told you to use $PHP_SELF is severely out of date. Instead, use $_SERVER['PHP_SELF']
•
•
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 10,950
Reputation:
Rep Power: 32
Solved Threads: 116
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
Do you run a computer-related website? Feature it in our niche link directory!
Do you run a computer-related website? Feature it in our niche link directory!
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Clean Previous Next Script for MySQL results (PHP)
- undefined variable error (PHP)
- undefined variable although register_session done (PHP)
- Variable scope/declaration/assignment query (PHP)
Other Threads in the PHP Forum
- Previous Thread: Php?
- Next Thread: phpBB 2.2 CVS Files




Linear Mode