Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
Python, Lua and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Java, C, C++, Ruby, MySQL and Linux / Tomcat systems
DIRNAME (php 4.3.0)

Posted by Garrie (Garrie), 6 February 2003
I have just installed PHP 4.3.0 and a script that was working under 4.2.3 no longer works.

The original code was this
       $location ="http://"
       header('Location: '.$location);

which resulted in $location containing
and the message
No input file specified. being displayed.
($location should contain

I changed the code to
       $location ="http://"
       header('Location: '.$location);

so $location now contains, but the HEADER command still returns the same message.

Can anyone explain what's going wrong?

I am running PHP on Windows 2000 with BadBlue 2.1 ( as a local webserver.

Posted by admin (Graham Ellis), 6 February 2003
Educated guess - you should use SCRIPT_NAME rather than
PHP_SELF for the name of the script.  Would need to check through all the docs, but PHP_SELF has always stuck me as a strange variable ....

Posted by Garrie (Garrie), 6 February 2003
I tried SCRIPT_NAME - same result
I have reverted to 4.2.3 for the moment.
- Garrie

Posted by admin (Graham Ellis), 8 February 2003
Always looking to be at the (b)leeding edge, I have just installed Apache 2, and PHP 4.3.0 onto one of our systems running XP Pro with the recommended service pack also installed ....

dirname and PHP_SELF look fine:

<h1>Test for Garrie</h1>
<?php print ($_SERVER{'PHP_SELF'}); ?>
<br> and its dirname is
<?php print (dirname($_SERVER{'PHP_SELF'})); ?>

gave me

Test for Garrie
The PHP_SELF is /trainee/garrie.php4
and its dirname is /trainee

Hmmm ... afraid your problem looks like it's the server or O/S or some sort of combination.

The following is a test program I use to look at all environment variables, for variables, etc, on a system; looked OK on my new combination, but you might like to try it and look for any funnies if you still have 4.3.0 around

<head><title>My Environment Reported</title></head>
<body bgcolor=white>

reporton($_ENV,"Your Environment");
reporton($_POST,"Your POST data");
reporton($_GET,"Your GET data");
reporton($_COOKIE,"Your Cookie information");
reporton($_SERVER,"Your Server information");

<br><table width=90%><tr><td width=50%><center>

First form - using POST<br><table border=1><form method=post>
<tr><td>name</td><td><input name=who></td></tr>
<tr><td>code</td><td><input name=pass type=password></td></tr>
<tr><td>radio</td><td><input type=radio name=gender value=M> Male<br>
<input type=radio name=gender value=F> Female</td></tr>
<input type=hidden name=hide value=hugesecret>
<tr><td> </td><td><input type=submit></td></tr></form></table>


Second form - using GET<br><table border=1><form>
<tr><td>name</td><td><input name=person></td></tr>
<tr><td>radio</td><td><input type=radio name=gender value=M> Male<br>
<input type=radio name=gender value=F> Female</td></tr>
<input type=hidden name=hide value=canbeseen>
<tr><td> </td><td><input type=submit></td></tr></form></table>


reportall($_ENV,"Your Environment");
reportall($_POST,"Your POST data");
reportall($_GET,"Your GET data");
reportall($_COOKIE,"Your Cookie information");
reportall($_SERVER,"Your Server information");

function reporton($array,$describe) {
     print ("$describe contains ".count($array)." values <br>");
function reportall($array,$describe) {
     if (count($array) > 0) {
           print ("$describe contains ".count($array)." values <br>");
           print ("<table border=1>");
           print ("</table><br>");
function tabline($value, $key) {
     print ("<tr><td>");
     print (htmlspecialchars($key));
     print ("</td><td>");
     print (htmlspecialchars($value));
     print ("</td></tr>");

This page is a thread posted to the opentalk forum at and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2018: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: • WEB: • SKYPE: wellho