cmalexander Posted March 15, 2007 Share Posted March 15, 2007 Hello, I need a little help with migrating our website to a new server. At the top of a lot of our PHP pages there is a path: #!/usr/local/bin/php. The new server says the path to PHP is /usr/bin/php. Do I need to change this at the top of all the pages? Does it matter that the #! is not at the beginning for the new server? Also, when I download all the files to my desktop and upload them to the new server all the permissions are changed to 777. I've tried both Cyberduck and Transmit without success. Is there anyway to preserve the permission structure. I am using FTP, not SFTP. Is it safe to say that most php permissions should be 755 and any other files like .htaccess or .htpsswd should be 644? Any help would be greatly appreciated! Thanks, cmalexander Quote Link to comment https://forums.phpfreaks.com/topic/42900-migrating-website/ Share on other sites More sharing options...
per1os Posted March 15, 2007 Share Posted March 15, 2007 That is a safe assumption. As for that #! line it is not necessary in PHP, just an excess line incase for some reason that is not defined as a path on the server. Quote Link to comment https://forums.phpfreaks.com/topic/42900-migrating-website/#findComment-208362 Share on other sites More sharing options...
cmalexander Posted March 15, 2007 Author Share Posted March 15, 2007 Thanks for your help frost110. So is there any way to download the files and retain their permissions when reuploaded? Also, do I need to change the path at the top of every page? Unfortunately there are quite a few. There is no way to make a redirect file of some kind is there? cmalexander Quote Link to comment https://forums.phpfreaks.com/topic/42900-migrating-website/#findComment-208414 Share on other sites More sharing options...
aebstract Posted March 15, 2007 Share Posted March 15, 2007 If you do end up changing the path on each page, make sure you write the path in a separate php file and include it in to the top of each page wherever you got it currently. That way you can make future changes to it very easily. Quote Link to comment https://forums.phpfreaks.com/topic/42900-migrating-website/#findComment-208415 Share on other sites More sharing options...
per1os Posted March 15, 2007 Share Posted March 15, 2007 Nope, there is no way. Maybe a tar archive and untaring via ssh on the server. But as far as I know you have to do the permissions manually. You may be able to using the dir class via php.net to print out a list of all files and their permissions and than create a script on the server after you upload the files and run that script off that data you pulled from the old server with the permissions of each file and than use the chmod function to set those file permissions. I am not sure if doing that would work but yea =) Quote Link to comment https://forums.phpfreaks.com/topic/42900-migrating-website/#findComment-208416 Share on other sites More sharing options...
cmalexander Posted March 15, 2007 Author Share Posted March 15, 2007 Thanks both of you. The include file is a great idea. It bothers me that the designers of the site did not do that in the first place. Bummer about the permissions. Much appreciation, cmalexander Quote Link to comment https://forums.phpfreaks.com/topic/42900-migrating-website/#findComment-208435 Share on other sites More sharing options...
cmalexander Posted March 16, 2007 Author Share Posted March 16, 2007 Need a little more help with the include. :-\ To me it looks like I'm doing everything right but the page doesn't render and the error in the logs says something like "Premature end of script". So here is one of the original files that I want to use the include in called index.phtml: #!/usr/local/bin/php <?php // get template $title = "SJMA PodCast"; $content = "podcast_body.phtml"; require($DOCUMENT_ROOT . "/common/template.phtml"); ?> <div id="mainNavGraphics"> <img border="0" alt="Girl with iPod" src="/images/navigation/navGraphics/podcast.jpg"/> </div> I want "/usr/local/bin/php" in an include file so I create one called "path.php" uploaded to a folder called "includes"with this in it: /usr/local/bin/php And change the original file to this: <? include($DOCUMENT_ROOT . "/includes/path.php"); ?> <?php // get template $title = "SJMA PodCast"; $content = "podcast_body.phtml"; require($DOCUMENT_ROOT . "/common/template.phtml"); ?> <div id="mainNavGraphics"> <img border="0" alt="Girl with iPod" src="/images/navigation/navGraphics/podcast.jpg"/> </div> Does all this look alright? I'm testing it on the original site not the new one I am uploading to because I want to make sure it works before I change all the other ones on a new host. Any help is most appreciated! cmalexander Quote Link to comment https://forums.phpfreaks.com/topic/42900-migrating-website/#findComment-208869 Share on other sites More sharing options...
per1os Posted March 16, 2007 Share Posted March 16, 2007 <?php include($_SERVER['DOCUMENT_ROOT'] . "/includes/path.php"); // get template $title = "SJMA PodCast"; $content = "podcast_body.phtml"; require($_SERVER['DOCUMENT_ROOT'] . "/common/template.phtml"); ?> <div id="mainNavGraphics"> <img border="0" alt="Girl with iPod" src="/images/navigation/navGraphics/podcast.jpg"/> </div> Quote Link to comment https://forums.phpfreaks.com/topic/42900-migrating-website/#findComment-208871 Share on other sites More sharing options...
cmalexander Posted March 16, 2007 Author Share Posted March 16, 2007 Sorry for all the trouble. It still does not work and the error log shows: [Fri Mar 16 13:44:39 2007] [error] [client 64.2.33.90] Premature end of script headers: /home/cust2/usr2083/html/podcast/index.phtml failed to open log file fopen: Permission denied The permissions for both are set to 755. Quote Link to comment https://forums.phpfreaks.com/topic/42900-migrating-website/#findComment-208922 Share on other sites More sharing options...
per1os Posted March 16, 2007 Share Posted March 16, 2007 wow phtml? wasn't that depreciated like 5 years ago? Anyhow the fopen permission denied you need it to be set to 777 to write for most servers. Quote Link to comment https://forums.phpfreaks.com/topic/42900-migrating-website/#findComment-208983 Share on other sites More sharing options...
cmalexander Posted March 16, 2007 Author Share Posted March 16, 2007 Kind of gives you an idea of what I'm dealing with...a deprecated website! So are you saying that all the .phtml files should be 777 and not 755? There are a few .php files mixed in there for good measure, should those be 777 as well, if so? Thanks for all your help frost110! I'm taking a PHP/MySQL class next week to try and help wrap my head around everything. Quote Link to comment https://forums.phpfreaks.com/topic/42900-migrating-website/#findComment-208998 Share on other sites More sharing options...
per1os Posted March 16, 2007 Share Posted March 16, 2007 777 means you can write to that file. If you are trying to write data to that file via a script, it should be 777 otherwise 755 works. Quote Link to comment https://forums.phpfreaks.com/topic/42900-migrating-website/#findComment-209014 Share on other sites More sharing options...
cmalexander Posted March 16, 2007 Author Share Posted March 16, 2007 So, for lack of knowing better, I would need to go through each file and know which ones are written to and which ones weren't and set the permissions accordingly. There are a few hundred files I'd need to go through. Would setting them all to 777 make the site vulnerable? Quote Link to comment https://forums.phpfreaks.com/topic/42900-migrating-website/#findComment-209037 Share on other sites More sharing options...
per1os Posted March 16, 2007 Share Posted March 16, 2007 Yep, it means that anyone could potentially write to any file with a script and the know how. Quote Link to comment https://forums.phpfreaks.com/topic/42900-migrating-website/#findComment-209038 Share on other sites More sharing options...
cmalexander Posted March 17, 2007 Author Share Posted March 17, 2007 Now when I navigate to the CMS page for our site on the new server I am receiving the following message: /usr/bin/php Warning: main(/common/classes_object.php): failed to open stream: No such file or directory in /home/cust1/user1378111/html/administration/index.phtml on line 5 Warning: main(): Failed opening '/common/classes_object.php' for inclusion (include_path='.:/usr/share/pear') in /home/cust1/user1378111/html/administration/index.phtml on line 5 Fatal error: Cannot instantiate non-existent class: color in /home/cust1/user1378111/html/administration/index.phtml on line 7 Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/42900-migrating-website/#findComment-209201 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.