Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a internal use PHP site at my new position. It only runs a few days a year off site so we keep it on laptops. The hardware it has been on, a 8 year IBM Thinkpad running Fedora, is dying. I have new Lenovo Thinkpad's running latest and greatest Ubuntu. I have copied the contents of var to a shared drive, renamed the old www folder in var on the new machine and copied over the old www folder. I can get to the login page and into the site, but when I look something up it returns Cannot Open. I know I cannot get to the MySQL in the new machine because users and passwords dont match. The version of the PHP from the old machine is before the setup script was included. I know very little about PHP. I am looking for input on the proper way to link the old PHP files to my mysql instance. Any help, much appreciated.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

By default if your php is setup on your machine with mysql it should already be linked to each other, however your php code is more than certainly not using correct mysql authentication details as you said, given the laptop was 8 years old the code is likely also programmed in a version of php older than your current one and likely the script code is no longer compatible

You should check your script for the database access details to modify, hopefully if the script was written well or using a well known framework then it should only be in one file like config.php or db.inc.php, this file will be somewhere within your /var/www folder.

If you manage to satisfy the database issues then you should be ok but its likely going to have other problems from the difference in php versions and will need the code fully reviewing.

Also other pitfalls are file permissions, you need to make sure the /var/www folder is readable by the webserver user (usually nobody) so a chown -R yourusername:nobody /var/html should do the trick, otherwise make sure the content is world readable.

Also copying the /var/lib/mysql folder to copy databases is both not recommended and unlikely to work if mysql is now a newer version to the old laptop, you should do a manual db dump of this from the old laptop and do an import on the new laptop.

Without much more info i cant give any more specific help

share|improve this answer
    
I have no intention of copying anything related to mysql form the old machine, thank you for the tip. The site is readable, I can get to it form outside the machine as well. We do plan on vetting the php once we get a moment. The site is working exactly as it should as far as we can tell, I can login into, I just can't retrieve data form the DB. I have found a config.php file, all it contained was a line that stated Define Goal 1800. There is no db.inc.php in the www folder. I guess I can keep looking. –  KCavon Mar 16 '11 at 16:13
    
do you know if the script is fully custom or written using a framwork, because if you know the framework you can find out where the db file is located relative to your web root –  anthonysomerset Mar 16 '11 at 16:14
    
I found a config.inc.php that contained the logins, I now have access. Thank you –  KCavon Mar 16 '11 at 17:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.