| | |
Undefined variable: PHP_SELF
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
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
Posts: 282
Reputation:
Solved Threads: 6
The website that told you to use $PHP_SELF is severely out of date. Instead, use $_SERVER['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.
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

Follow my Twitter feed! twitter.com/DaniWeb
And if you're interested in Internet marketing there is twitter.com/DaniWebAds
![]() |
Similar Threads
- PHP Undefined Variable Error (PHP)
- Access made to undefined variable? (Pascal and Delphi)
- send email Undefined variable: (PHP)
- Undefined variable: oCustRes (PHP)
- undefined variable error (PHP)
Other Threads in the PHP Forum
- Previous Thread: Php?
- Next Thread: phpBB 2.2 CVS Files
Views: 35248 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database dataentry date directory display download dynamic echo email error file files firstoptioninphpdroplist folder form forms freelancing function functions google href htaccess html image include insert integration ip java javascript joomla jquery limit link login loop mail menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap source space speed sql structure syntax system table tutorial tutorials update updates upload url validation validator variable video web white xml youtube







