php101 Posted April 29, 2008 Share Posted April 29, 2008 Hi there, I need to take a PHP/mySQL web site down for fixing errors and make it temporarily unavailable to visitors. Can you post how to accomplish this. Thanks very much. Quote Link to comment https://forums.phpfreaks.com/topic/103479-site-down/ Share on other sites More sharing options...
p2grace Posted April 29, 2008 Share Posted April 29, 2008 There's a number of ways to do this but a stable way would be creating a folder with an index file that shows the site is down and update the dns to go to that folder. Then when you're done updating the files move the dns back to the live folder. Quote Link to comment https://forums.phpfreaks.com/topic/103479-site-down/#findComment-529865 Share on other sites More sharing options...
DeanWhitehouse Posted April 29, 2008 Share Posted April 29, 2008 you would put an IF at the beggining of each page and IF($closed) { echo "site closed"; } else { rest of code } that won't work as it is, but should point you in the right direction Quote Link to comment https://forums.phpfreaks.com/topic/103479-site-down/#findComment-529866 Share on other sites More sharing options...
p2grace Posted April 29, 2008 Share Posted April 29, 2008 Yeup that would work just so long as you don't need to view the files while editing them. Otherwise you'd see the same notification while updating the files. Quote Link to comment https://forums.phpfreaks.com/topic/103479-site-down/#findComment-529869 Share on other sites More sharing options...
DeanWhitehouse Posted April 29, 2008 Share Posted April 29, 2008 yer, well it can be made more complex, and you can have it so it checks user level(or rights or whatever) and if you where admin, you can see the page properly. Quote Link to comment https://forums.phpfreaks.com/topic/103479-site-down/#findComment-529871 Share on other sites More sharing options...
p2grace Posted April 29, 2008 Share Posted April 29, 2008 Yeup, there's a number of ways you could do it. I was just letting him know. Quote Link to comment https://forums.phpfreaks.com/topic/103479-site-down/#findComment-529874 Share on other sites More sharing options...
peranha Posted April 30, 2008 Share Posted April 30, 2008 <?php if ($maintenance == 'YES') { if ($IPnumber == '192.168.150.156') { echo "<b class=red>* Site is in Maintenance Mode, and is not accessible outside this PC. *</b>"; } else { echo "<b class=red>This site is under maintenance, and will be unavailable for now. <BR>"; echo "Please check back shortly. </b><BR><BR>"; require ("footer.php"); die; } } ?> That is what I use, and have it in a vital page that I include on all pages. Set the IP number as you ip address Quote Link to comment https://forums.phpfreaks.com/topic/103479-site-down/#findComment-529953 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.