duerra
asked on
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.
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.
ASKER
Yes, there are quotes in it. I copied and pasted straight from the address bar. It's exactly as I posted =/
ASKER
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Are you aware of any reason why this doesn't work all of a sudden after I intsalled PHP with the Windows binaries??
I suspect a configuration change of the server
ASKER
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!
ASKER
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_tim e']))
{
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?
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_tim
{
if($_COOKIE['check_time'] == $session_id)
{
if(session_is_registered('
{
//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><
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?
haven't you changed browser, by the way ?
If ***ever*** you just upgraded to IE 6, then "bienvenue au club" :D
If ***ever*** you just upgraded to IE 6, then "bienvenue au club" :D
ASKER
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... =/
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... =/
ASKER
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....
how many php.ini files do you have on all of your local disks ?
ASKER
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.
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.
ASKER
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.
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.
that's what I said... misconfiguration 8-)
thanks anyway
thanks anyway
ASKER
No prob. You're a great person, VGR... helpin' everybody out like you do.
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
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
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 ?