f



why does $_SERVER['PHP_SELF'] say /test.php/test.php for test.php?

I have a PHP script at 127.0.0.1/test.php.  It's contents are as
follows:

<?php
echo $_SERVER['PHP_SELF'];
?>

And it's output isn't test.php, as I'd expect, or /test.php, but
rather, /test.php/test.php.  Why?  And how do I fix it?
0
terra1024 (490)
10/6/2010 4:53:16 AM
comp.lang.php 32646 articles. 0 followers. Post Follow

4 Replies
2288 Views

Similar Articles

[PageSpeed] 41

El 06/10/2010 6:53, yawnmoth escribi�/wrote:
> I have a PHP script at 127.0.0.1/test.php.  It's contents are as
> follows:
>
> <?php
> echo $_SERVER['PHP_SELF'];
> ?>
>
> And it's output isn't test.php, as I'd expect, or /test.php, but
> rather, /test.php/test.php.  Why?  And how do I fix it?

What output do you get if you change it to this?

<?php
echo '[' . $_SERVER['PHP_SELF'] . ']';
?>

What do your other $_SERVER values look like?

<?php
print_r($_SERVER);
?>

-- 
-- http://alvaro.es - �lvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programaci�n web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
0
10/6/2010 7:30:28 AM
On 06/10/10 09:30, "�lvaro G. Vicario" wrote:
> El 06/10/2010 6:53, yawnmoth escribi�/wrote:
>> I have a PHP script at 127.0.0.1/test.php.  It's contents are as
>> follows:
>>
>> <?php
>> echo $_SERVER['PHP_SELF'];
>> ?>
>>
>> And it's output isn't test.php, as I'd expect, or /test.php, but
>> rather, /test.php/test.php.  Why?  And how do I fix it?
> 
> What output do you get if you change it to this?
> 
> <?php
> echo '[' . $_SERVER['PHP_SELF'] . ']';
> ?>
> 
> What do your other $_SERVER values look like?
> 
> <?php
> print_r($_SERVER);
> ?>
> 

Probably the same. It's a known bug.

Best regards,
-- 
Willem Bogaerts

Application smith
Kratz B.V.
http://www.kratz.nl/
0
10/6/2010 8:48:56 AM
On 2010-10-06 06:53, yawnmoth wrote:
> I have a PHP script at 127.0.0.1/test.php.  It's contents are as
> follows:
>
> <?php
> echo $_SERVER['PHP_SELF'];
> ?>
>
> And it's output isn't test.php, as I'd expect, or /test.php, but
> rather, /test.php/test.php.  Why?  And how do I fix it?

Seems like a bug. What's your platform?


/August

-- 
The competent programmer is fully aware of the limited size of his own 
skull. He therefore approaches his task with full humility, and avoids 
clever tricks like the plague. --Edsger Dijkstra
0
fusionfile (195)
10/6/2010 12:04:03 PM
El 06/10/2010 10:48, Willem Bogaerts escribi�/wrote:
> On 06/10/10 09:30, "�lvaro G. Vicario" wrote:
>> El 06/10/2010 6:53, yawnmoth escribi�/wrote:
>>> I have a PHP script at 127.0.0.1/test.php.  It's contents are as
>>> follows:
>>>
>>> <?php
>>> echo $_SERVER['PHP_SELF'];
>>> ?>
>>>
>>> And it's output isn't test.php, as I'd expect, or /test.php, but
>>> rather, /test.php/test.php.  Why?  And how do I fix it?
>>
>> What output do you get if you change it to this?
>>
>> <?php
>> echo '[' . $_SERVER['PHP_SELF'] . ']';
>> ?>
>>
>> What do your other $_SERVER values look like?
>>
>> <?php
>> print_r($_SERVER);
>> ?>
>>
>
> Probably the same. It's a known bug.

Ah, yep:

http://bugs.php.net/bug.php?id=49825



-- 
-- http://alvaro.es - �lvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programaci�n web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
0
10/6/2010 12:30:35 PM
Reply:

Similar Artilces:

$_SERVER['SCRIPT_FILENAME'] = '/php/php.exe'???
Hi, I am trying to use script filename to give me the entire path and filename of the current page. For some reason though it is giving me the value of '/php/php.exe'. Why might this be? In my Apache http.conf file I do have the line: Action application/x-httpd-php "/php/php.exe" Might this have something to do with it? Cheers Burnsy bissatch@yahoo.co.uk wrote: > Hi, > > I am trying to use script filename to give me the entire path and > filename of the current page. For some reason though it is giving me > the value of '/php/php.exe'. Why migh...

Fatal error: main(): Failed opening required 'DB.php' (include_path='.:/usr/lib/php:/usr/local/lib/php')
I installed PEAR HTTP_Upload to my new server and now im getting this error when runnign the script. any help? Maximus wrote: > I installed PEAR HTTP_Upload to my new server > and now im getting this error when runnign the script. > > > any help? > permissions problem? where is DB.php located? does DB.php reside in the include_path directories? The message is self explanatory. -- Michael Austin. DBA Consultant Donations welcomed. Http://www.firstdbasource.com/donations.html :) Try on your command line as root: >pear install DB Alex http://prepared-stateme...

Failed opening required 'PEAR.php' (include_path='F:\www\include') in F:\Program Files\PHP\PEAR\Text\CAPTCHA.php on line 22
Hi, Guys=EF=BC=8Cwhen I run my site ,I got some errors: Warning: require_once(PEAR.php) [function.require-once]: failed to open stream: No such file or directory in F:\Program Files\PHP\PEAR \Text\CAPTCHA.php on line 22 Fatal error: require_once() [function.require]: Failed opening required 'PEAR.php' (include_path=3D'F:\www\include') in F:\Program Files \PHP\PEAR\Text\CAPTCHA.php on line 22 It appears that it cann't find the pear.php ,but i checked my dir,and this file was there,and also I have my php.ini file checked,the include_path=3Dinclude_path=3D".;F:\Progr...

test test test test test test
test test test test test test test ...

TESTING TESTING TESTING TESTING TESTING
TESTING TESTING TESTING TESTING TESTING ...

test test test test
...

HELP!! PHP Warning: PHP Startup: Unable to load dynamic library 'c:\PHP\Ext\php_mysql.dll'
Why do I keep getting this error mesgage on my phpinfo() page trying to get PHP and MySQL to communicate? I am running this in IIS. Here's what I have - My php.ini resides in my C:\WINNT directory. In it, I have removed the ';' from the extension=php_mysql.dll. Also in the php.ini file I set extension_dir = c:\PHP\Ext In c:\PHP\Ext I have the following files: libmysqli.dll libmySQL.dll php5apache2.dll (Do I need this since I am using IIS)? php5ts.dll php_mysql.dll Any help would be tremendously appreciated. I have spent a ton of time on this. Thanks. MS wrote: > Wh...

Installing PHP
I'm a newbie to Apache. This week I installed my first Apache 2.0 server, and it's working fine. I then installed PHP. When I ran the PHP test file ("test.php"), the actual text contents of the file came up in the browser: ---------------- <?php phpinfo(); ?> ---------------- I confirmed that my Apache installation includes the "mod_so.c" module. I made sure that the file "test.php" was in the default htdocs folder. I confirmed that my "httpd.conf" file contained the lines : ---------------- LoadModule php4_module /L...

Installing PHP
I'm a newbie to Apache. This week I installed my first Apache 2.0 server, and it's working fine. I then installed PHP. When I ran the PHP test file ("test.php"), the actual text contents of the file came up in the browser: ---------------- <?php phpinfo(); ?> ---------------- I confirmed that my Apache installation includes the "mod_so.c" module. I made sure that the file "test.php" was in the default htdocs folder. I confirmed that my "httpd.conf" file contained the lines : ---------------- LoadModule php4_module /Library/Apache2/m...

Fatal error: Class 'XMLWriter' not found in /srv/www/htdocs/test.php on line 14
Hi, my PHP version is : /srv/www/htdocs # rpm -q php5 php5-5.2.5-9.5 but I cannot use XMLWriter, why is it? Thanks a lot. esala On Jun 8, 3:55=A0am, esala <es...@huawei.com> wrote: > Hi, > my PHP version is : > /srv/www/htdocs # rpm -q php5 > php5-5.2.5-9.5 > > but I cannot use XMLWriter, why is it? > > Thanks a lot. > esala Because it's not been compiled in. Check the output of phpinfo() for the configure command. RH don't seem to like it. It would have been helpful if you said what OS/Distro you are running on. C. -----BEGIN PGP SIGNED MESSAGE--...

testing PHP 5 with Apache 2 and php info file
When I go to look for php info file in the browser all i get is the actually words. <?php phpinfo(); ?> any obvious problems? thanks ...

testing PHP 5 with Apache 2 and php info file
When I go to look for php info file in the browser all i get is the actually words. <?php phpinfo(); ?> any obvious problems? thanks ...

Test test test
Test test ...

Using preg_replace to convert '<?php*?>' to nothing (removing all PHP code)
Hi, I am trying to use preg_replace to take out all occurances of PHP code after reading (fread()) the contents of a PHP file. The code I am using is: $html = preg_replace("<?php*?>", "", $html); Unfortuntely it is not working and giving the following error: Warning: preg_replace(): Nothing to repeat for offset 0 in C:/apache/... Can someone please try this out and see what they get. How can I get this to work? Cheers Burnsy On 2 Sep 2005 13:57:49 -0700, bissatch@yahoo.co.uk wrote: >I am trying to use preg_replace to take out all occurances of PHP code ...

Web resources about - why does $_SERVER['PHP_SELF'] say /test.php/test.php for test.php? - comp.lang.php

Resources last updated: 2/8/2016 6:09:43 AM