SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Jun 2001
    Location
    North Coast NSW Australia
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Why does this appear in the URL ??

    I have created a log in page that works well except that sometimes after filling in the user and password details, when I hit submit and the new page appears, I have noticed the URL has changed from
    http://localhost/sessions/index.php to
    http://localhost/php/php.exe/sessions/index.php
    and I then can't access the links on this page
    But, if I hit the BACK button, the correct URL appears - ie
    http://localhost/sessions/index.php



    Why is this so ????

    Here's the form:
    <p><form method="post" action="<?=$PHP_SELF?>">
    User ID: <input type="text" name="uid" size="8"><br>
    Password: <input type="password" name="pwd" SIZE="8"><br>
    <input type="submit" value="Log in">

  2. #2
    SitePoint Evangelist mad-onion's Avatar
    Join Date
    Aug 2000
    Location
    Land of the long white cloud
    Posts
    556
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You are running PHP on a windows system right?
    This was happening to me a while back although i cant completely remember the details, i think i came to the conclusion that PHP_SELF doesnt work properly under winblows!
    SiteOptions >> Services :: Products :: Contact
    Developers of PHP, C++, Visual Basic, MySQL, and more!

  3. #3
    SitePoint Evangelist ucahg's Avatar
    Join Date
    Apr 2001
    Location
    Sarnia, Ontario, Canada
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That happens to me as well on Win98. Only with $PHP_SELF.
    It shouldn't really change the functionality (?) of your site, and will disappear when (or if) you transfer to a *NIX server (if you are just using the win server for testing).

    It also only happened in Apache for me.

  4. #4
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes as mad-onion said this is a windows problem, specifically when using PHP in CGI mode. The reason for this is because the scripts get run through the PHP interpreter. So when they come out everything is relative to the interpreter. The easiest way to solve this is to set the auto_prepend_file directive in your php.ini file to use a file which you will create. So create a file called prepend.php and put it anywhere. In it put

    <?
    $PHP_SELF = $PATH_INFO;
    ?>

    Now put the path to this file in your php.ini file. What this will do is automatically prepend itself to all scripts you run, and it will change the value of $PHP_SELF from the path to the interpereter to the path of the script which is what you want.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  5. #5
    SitePoint Member
    Join Date
    Jun 2001
    Location
    North Coast NSW Australia
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks to Freddy and Cat
    Works now !!!
    BTW - yes I am using Windows to test on
    Thanks to all


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •