Jump to content

Migrating website


cmalexander

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 =)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

<?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>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.