•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 396,965 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,919 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 429 | Replies: 11
![]() |
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 238
•
•
Join Date: May 2008
Posts: 31
Reputation:
Rep Power: 1
Solved Threads: 5
You have http://localhost hardcoded in your script, use the host name of the web server.
This would explain why it works on your workstation but not the server. When you have no session data it's because you've been transferred to the web server running on your workstation, and the session data is on the remote server, so php doesn't see it.
To find it all, shut down the server running locally and you'll get 404's wherever you have a hardcoding.
To avoid this use:
Either works...
Hardcoding host names in links will always cause broken scripts so never do it unless you are going to a different host and there is no other way 8)
I learned this from working in a disciplined environment where we had:
www.servername.com
qual.servername.com
dev.servername.com
Hardcoding caused the qa guys to get completely broken sites. You learn really fast when it takes a week of red tape to get changes moved, then another week to get the fixes put in to fix your hardcodings ROFL.
This would explain why it works on your workstation but not the server. When you have no session data it's because you've been transferred to the web server running on your workstation, and the session data is on the remote server, so php doesn't see it.
To find it all, shut down the server running locally and you'll get 404's wherever you have a hardcoding.
To avoid this use:
header( "refresh:5; url=http://{$_SERVER['SERVER_NAME']}/website/myprofile.php" );
or
header( "refresh:5; url=/website/myprofile.php" );
instead of
header( 'refresh:5; url=http://localhost/website/myprofile.php' );Either works...
Hardcoding host names in links will always cause broken scripts so never do it unless you are going to a different host and there is no other way 8)
I learned this from working in a disciplined environment where we had:
www.servername.com
qual.servername.com
dev.servername.com
Hardcoding caused the qa guys to get completely broken sites. You learn really fast when it takes a week of red tape to get changes moved, then another week to get the fixes put in to fix your hardcodings ROFL.
Last edited by rgviza : May 15th, 2008 at 1:45 pm.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
Similar Threads
- Body Text lost when sending hotmail (Web Browsers)
- Quick Launch toolbar lost (Windows 9x / Me)
- Lost browser links,internet options etc...toolbar (Web Browsers)
- Have I lost RAM? (Motherboards, CPUs and RAM)
- recover lost file in windows XP (Windows NT / 2000 / XP / 2003)
- lost address book addresses (OS X)
- IDE devices lost during post W2K (Windows NT / 2000 / XP / 2003)
Other Threads in the PHP Forum
- Previous Thread: How to get my update working and my search to work properly?
- Next Thread: Georgean Date to Persian Date, and vice versa



Linear Mode