Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 193
  • Last Modified:

Quick/Easy PHP Question: Relative Directories

I used to have PHP installed CGI. I have now installed it manually using the binaries. There's only one problem... while my scripts used to work with relative paths, now when I try and navigate anywhere PHP is trying to instert a messed up directory in the location bar. Example, this is the link that's being followed:

http://localhost/'index.html/' 


Unfortunately, this is not right... it's supposed to be:

http://localhost/folder/index.html 

This is really weird, and I'm not sure why PHP is doing this now, but if anybody knows how to fix it (without changing my scripts), I'd be very grateful. Thanks.
0
duerra
Asked:
duerra
  • 10
  • 7
1 Solution
 
VGRCommented:
Do you ***really*** see this ? http://localhost/'index.html/' ???

quotes in the URL ?
slash after it ?

And the link in the script is indeed "index.html" and not "/index.html" ?

Am I assuming right ?
0
 
duerraAuthor Commented:
Yes, there are quotes in it.  I copied and pasted straight from the address bar.  It's exactly as I posted =/
0
 
duerraAuthor Commented:
and yes, the link is

echo "<a href = 'index.html'> Index </a>";

It used to work when I used PHP as CGI... but for some reason it's weird now.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
VGRCommented:
oh yes. You shouldn't do this 8-)

Do that :
either
echo "<a href = \"index.html\"> Index </a>";
or
echo "<a href = index.html> Index </a>";

à part from this, I only see some misconfiguration of the server, like DOC_ROOT (unlikely) or BASEDIR
0
 
duerraAuthor Commented:
Are you aware of any reason why this doesn't work all of a sudden after I intsalled PHP with the Windows binaries??
0
 
VGRCommented:
I suspect a configuration change of the server
0
 
duerraAuthor Commented:
That's impossible... I didn't change anything with the server.  Now I'm having problems with cookies being set.  For some reason when I try to log in, I'm not being verified (I verify the login of each user on each page).  When I check my cookies, nothing is changing... gaaaaack!  I'm gonna go nuts!  Time for a point increase... help me out!
0
 
duerraAuthor Commented:
Here's what I have.... Login Page:

setcookie('check_time', $session_id, time() + 60*60*3);


All pages that require Login Page have this script required into it:

function check_confirmed_user()
{
     global $user_id;
     global $session_id;
     
     if (isset($_COOKIE['check_time']))
     {
          if($_COOKIE['check_time'] == $session_id)
          {
               if(session_is_registered('user_id'))
               {
                    //echo "Logged in as ".$user_id;
                    //echo'<br>';
               }
               else
               {
                    echo "<center><table width = '80%'>";
                    echo "<tr><td align = 'center'><h2>Your session is not registered</h2></td></tr>";
                    echo "<tr><td align = 'center><a href=index.html>Login Page</a></td></tr>";
                    echo "</table></center>";
                    exit;
               }              
               
          }
          else
          {
               echo "<center><table width = '80%'>";
               echo "<tr><td align = 'center'><h2>Your session has expired</h2></td></tr>";
               echo "<tr><td align = 'center'><a href=index.html>Login Page</a></td></tr>";
               echo "</table></center>";
               exit;
          }

         
     }
     else
     {
          session_unset();
          echo "<center><table width = '80%'>";
          echo "<tr><td align = 'center'><h2>Your session has Expired.  Please Log in again.</h2></td></tr>";
          echo "<tr><td align = 'center'><a href=index.html>Login</a></td></tr>";
          echo "</table></center>";
          exit;
     }
}


It's been working perfectly for about a month now, at least, now after I installed PHP with the binaries, I can't even get logged in.  I get the "Your session has Expired.  Please Log in again." message (meaning that the cookie hasn't been set, and I even checked out my cookies to verify that it wasn't getting set).

Ahhhhhhhhhhhhhhhhh!!!!!!!!!!!!!!!!!

VGR... you're a lifesaver... mind helping out one more time?
0
 
VGRCommented:
haven't you changed browser, by the way ?
If ***ever*** you just upgraded to IE 6, then "bienvenue au club" :D
0
 
duerraAuthor Commented:
I've had IE 6 since it came out...

Seriously, though.  

-Scripts were working fine
-unzip windows binaries
-change location of php in httpd.conf to reflect
-Scripts no longer working (I fixed the links like you instructed, but cookies aren't working anymore, either... =/
0
 
duerraAuthor Commented:
Any ideas??? I need this to get be working ASAP.  My server is down until it is!  I'm begging - if anybody has ANY ideas....
0
 
VGRCommented:
how many php.ini files do you have on all of your local disks ?
0
 
duerraAuthor Commented:
hmm... ok, let's see:
1 in the OLD php backup folder
1 php.ini-dist in the NEW php4.3.1 folder
1 php.ini-recommended in the NEW php4.3.1 folder
1 php.ini in the WINDOWS directory (the one I'm using [I think, anyway ;)] modified copy of php.ini-recommended)

That's it.
0
 
duerraAuthor Commented:
Well well well... it seems that even though I had error reporting turned on full blast, the display errors was turned off... after turning it back on so that I could figure out what the heck was going on after I sent a cookie, I get this:

After doing this, I found out that my save directory in the new php.ini was messed up... I fixed it.  

VGR, since you're such a savior, even though you didn't figure this one out, per say... you get 150 points anyway.
0
 
VGRCommented:
that's what I said... misconfiguration 8-)
thanks anyway
0
 
duerraAuthor Commented:
No prob.  You're a great person, VGR... helpin' everybody out like you do.  
0
 
VGRCommented:
no no no
some persons may say I waste my time answering questions for the Glory in stead of finding a new mission for Bucks 8-)

Mammon doesn't rUlZ everywhere :D
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 10
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now