?
Solved

Quick/Easy PHP Question: Relative Directories

Posted on 2003-03-10
17
Medium Priority
?
192 Views
Last Modified: 2006-11-17
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
Comment
Question by:duerra
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 7
17 Comments
 
LVL 15

Expert Comment

by:VGR
ID: 8109368
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
 
LVL 4

Author Comment

by:duerra
ID: 8109567
Yes, there are quotes in it.  I copied and pasted straight from the address bar.  It's exactly as I posted =/
0
 
LVL 4

Author Comment

by:duerra
ID: 8109637
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!

 
LVL 15

Accepted Solution

by:
VGR earned 600 total points
ID: 8109972
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
 
LVL 4

Author Comment

by:duerra
ID: 8111650
Are you aware of any reason why this doesn't work all of a sudden after I intsalled PHP with the Windows binaries??
0
 
LVL 15

Expert Comment

by:VGR
ID: 8112276
I suspect a configuration change of the server
0
 
LVL 4

Author Comment

by:duerra
ID: 8112793
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
 
LVL 4

Author Comment

by:duerra
ID: 8112865
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
 
LVL 15

Expert Comment

by:VGR
ID: 8113307
haven't you changed browser, by the way ?
If ***ever*** you just upgraded to IE 6, then "bienvenue au club" :D
0
 
LVL 4

Author Comment

by:duerra
ID: 8113345
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
 
LVL 4

Author Comment

by:duerra
ID: 8113641
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
 
LVL 15

Expert Comment

by:VGR
ID: 8113890
how many php.ini files do you have on all of your local disks ?
0
 
LVL 4

Author Comment

by:duerra
ID: 8114664
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
 
LVL 4

Author Comment

by:duerra
ID: 8114886
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
 
LVL 15

Expert Comment

by:VGR
ID: 8115070
that's what I said... misconfiguration 8-)
thanks anyway
0
 
LVL 4

Author Comment

by:duerra
ID: 8115914
No prob.  You're a great person, VGR... helpin' everybody out like you do.  
0
 
LVL 15

Expert Comment

by:VGR
ID: 8118018
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question