Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 15th May 2011, 10:20
BobJam BobJam is offline
Junior Member
 
Join Date: May 2011
Location: Arizona, USA
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Live to Local

I want to get a working copy of my live site onto my local machine (yes, I did it backwards . . . whereas most do it locally at first and then upload to live, I did it the other way around).

My OS is Ubuntu 9.10, and instead of LAMPP, I did a standalone install of PHP 5.2, Apache2, and MySQL Server version 5.1.37-1ubuntu5.5. So my local root is /var/www.

Apache runs just fine and so does PHP and MySQL. I transferred my live site db to my local machine and believe it or not the privileges are such that it CAN connect to the MySQL server (I got the usual "Cannot connect . . ." at first, but assigned the privileges to that db via phpmyadmin.)

In any case, now I'm sitting on my local machine with a working apache2, PHP, and MySQL, the db from the live site and not much else. Sort of like all dressed up and no place to go.

I did however FTP all my public_html folders and files to the /var/www folder. The live site is Joomla built (1.5.22), but simply transferring the folders and files and also the db to my local machine doesn't do anything but give me the standard apache welcome screen, "It works! This is the default web page for this server. The web server software is running but no content has been added, yet." For some reason the Joomla built content is missing in action.

I really don't know where to go from here. I have no idea what I have to do or even if I can do anything, like modify the configuration.php file from my live site, a copy of which now resides on /var/www.

What I'm thinking about is removing those Joomla folders and files on /var/www and just using Akeeba to backup my live site and installing kickstart.php on my local /var/www and the zipped Akeeba backup and then running kickstart. (Would I remove the apache index.htm file from /var/www, so that only the archived backup and kickstart.php reside on /var/www, and then run kickstart? Do I need to modify the permissions on the /var/www folder for kickstart to work? I DO have the Akeeba and Kickstart manuals and the Akeeba URL).

I'm really lost here . . . I need some kind of a step-by-step guide on where to go from here.

Again, the ultimate goal is to get a working copy of my live site on my local machine, so that I can 'speriment with mods and no longer risk borking the live site. Obviously, included in the scheme would be how to go from local to live when I like the mods and see that they work. Could I do that also with Akeeba?
__________________
BJ
Reply With Quote
Sponsored Links
  #2  
Old 16th May 2011, 12:21
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,721 Times in 2,562 Posts
Default

Can you rename/delete /var/www/index.html and check if it works then?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 16th May 2011, 18:28
BobJam BobJam is offline
Junior Member
 
Join Date: May 2011
Location: Arizona, USA
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: Live to local

@ falko,

Now I'm getting:

Code:
Warning:  include(/home/rbjamie/public_html/zbblock/zbblock.php) [function.include]: failed to open stream: No such file or directory in /var/www/index.php on line 1

Warning:  include() [function.include]:  Failed opening '/home/rbjamie/public_html/zbblock/zbblock.php' for  inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/index.php on line 1

Warning:  Cannot modify header information - headers already sent by (output started at /var/www/index.php:1) in /var/www/libraries/joomla/factory.php on line 566
Database Error: Unable to connect to the database:Could not connect to MySQL
First of all, "zbblock" is the security software I use on my LIVE site. But more importantly, I think that first "Warning" line is because the path on line one in index.php does NOT exist on my local machine. Which is why I'm thinking to try and use Akeeba because maybe it will adjust those paths.

In the alternative, I guess I could just as well go in there and edit the index.php with my IDE. But then I'd have to do that on my LIVE site everytime I uploaded my content modifications.

The second warning seems to be the same.

The third warning I'm not too sure about, except I see there's that damn " . . . could not connect to MySQL" nonsense again.

I thought I had solved that whole problem when I just flat out reset the MySQL password with the sequence:
Code:
sudo /etc/init.d/mysql stop

sudo mysqld --skip-grant-tables &

mysql -u root mysql
And then at the MySQL prompt:
Code:
UPDATE user SET Password=PASSWORD('YOURNEWPASSWORD') WHERE User='root'; FLUSH PRIVILEGES; exit;
And then I was using my own "testme.php" file:

Code:
<?php
/**********************************************************************
 START editing here...
**********************************************************************/

$mysql_host     =   'localhost';
$mysql_username =   'root';
$mysql_password =   '';
$mysql_database =   '';

/**********************************************************************
 STOP editing here...
**********************************************************************/

echo('<p>Trying to connect to MySQL on server <strong>'.$mysql_host.'</strong> as user <strong>'.$mysql_username.'</strong> with password <strong>'.$mysql_password.'</strong>.</p>');
$db=mysql_connect($mysql_host,$mysql_username,$mysql_password);
if(!is_resource($db)) {
    echo('<p style="color:#c00">FAILED</p>');
    echo('<p>Debug - '.mysql_errno($db) . ':' . mysql_error($db). '</p>');
    exit();
} else {
    echo('<p style="color:#0c0">SUCCESS</p>');
}
echo('<hr />');
mysql_query('SET CHARACTER SET \'utf8\';',$db);
mysql_query('SET NAMES \'utf8\' COLLATE \'utf8_general_ci\';',$db);
echo('<p>Trying to talk to database <strong>'.$mysql_database.'</strong>.</p>');
if(!mysql_select_db($mysql_database,$db)) {
    echo('<p style="color:#c00">FAILED</p>');
    echo('<p>Debug - '.mysql_errno($db) . ':' . mysql_error($db). '</p>');
    exit();
} else {
    echo('<p style="color:#0c0">SUCCESS</p>');
    exit('<p>Thank God! Now it's time for that cigar...</p>');
}
mysql_close($db);
?>
to see if it worked. The indication was "Success" when I plugged in the LIVE site db name and reset password. (BTW, haven't divulged any passwords or user names here because in the php script above, the default user is "root" and the default password is nothing (""). I just plugged in the actual db name and new password.)

But I think the configuration.php file from my LIVE site, plus some other imported files, needs to be edited also. The paths are all screwed up.

Bottom line, again this was why I was thinking of using Akeeba to avoid all this hassle . . . which it advertises it will do.

Another problem is that I know just enough to be dangerous, and I was hoping maybe Akeeba would help me not to shoot myself in the foot, which I often end up doing when I try to do things myself.

I get it "half-right" and screw myself up with the other half that is absolutely wrong.

Which is another reason why I need to get my site on my local machine for edits. I've been lucky so far, but sooner or later if I keep editing the LIVE site, the law of averages is going to catch up with me and I'm going to bork the LIVE site.

Fortunately I just renamed the Apache index.htm file to "indexold.htm" and was able to recover to at least where I was getting the apache "working" message, which essentially puts me back to square one.

I've got to be missing something real simple because I know a lot of people have this kind of setup for test editing and they can't be going through the tedious cycle of resetting paths every time they go from local to live and then have to adjust the paths on live.

So what am I missing?

(BTW, thanks for taking out that spam).
__________________
BJ

Last edited by BobJam; 16th May 2011 at 18:34. Reason: formatting
Reply With Quote
  #4  
Old 17th May 2011, 14:02
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,721 Times in 2,562 Posts
Default

Does your test site use the same document root than the live site? If not, you might have to adjust paths, maybe in configuration files, maybe also in the database.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #5  
Old 17th May 2011, 18:47
BobJam BobJam is offline
Junior Member
 
Join Date: May 2011
Location: Arizona, USA
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: Live to local

@ falko,

Don't know about the DocumentRoot setting for sure in my local installation . . . where would that be? Apache2.conf?
__________________
BJ
Reply With Quote
  #6  
Old 17th May 2011, 19:00
BobJam BobJam is offline
Junior Member
 
Join Date: May 2011
Location: Arizona, USA
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: Live to local

@ falko,

There IS a DocumentRoot setting in the apache2 "000-default" file located within "/etc/apache2/sites-enabled/" on my local machine, and it's "DocumentRoot /var/www".

I assume on the live site it's "public-html".

I don't see any DocumentRoot setting in my configuration.php but I do see a line: "var $tmp_path = '/home/rbjamie/public_html/tmp';", which obviously doesn't exist on my local machine.

The httpd file on my local machine is entirely empty.

Do these settings give you any clue?
__________________
BJ
Reply With Quote
  #7  
Old 17th May 2011, 19:05
BobJam BobJam is offline
Junior Member
 
Join Date: May 2011
Location: Arizona, USA
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: Live to local

@ falko,

I have no idea if the Joomla 1.5 db stores path info. How would I find this out? Could I look at the db via phpmayadmin and tell, and which parameter would I look at? "jos_" what?
__________________
BJ
Reply With Quote
  #8  
Old 18th May 2011, 14:01
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,721 Times in 2,562 Posts
Default

Can you find out the document root of the live machine (in the Apache configuration)?

Quote:
Originally Posted by BobJam View Post
@ falko,

I have no idea if the Joomla 1.5 db stores path info. How would I find this out? Could I look at the db via phpmayadmin and tell, and which parameter would I look at? "jos_" what?
I'm no Joomla expert, but you could create an SQL dump of your database, open it in a text editor and search for the path.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #9  
Old 18th May 2011, 18:36
BobJam BobJam is offline
Junior Member
 
Join Date: May 2011
Location: Arizona, USA
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: Live to local

@ falko,

On the idea of dumping the MySQL db to a text file and then searching for paths . . . my compliments, very creative, and it worked nicely.

Yes, as a matter of fact there are paths in the db, both external (URL's) and INTERNAL, which is what I'm interested in.

On the issue of DocumentRoots, my local root is var/www and the LIVE site root is public_html.

But on that issue, and also the MySQL/internal paths issue, I think I have an idea. Instead of having these paths as ABSOLUTE, which they ARE, why not edit them to be RELATIVE, so that they're based on the tree structure, which is the SAME for both LOCAL and LIVE?

For example, my php.ini file contained a path named "/home/*<my user name>*/public_html/zbblock/zbblock.php" and I changed it to "zbblock/zbblock.php" ("zbblock" is site security software I use.)

I was getting the notice that Apache couldn't find ""/home/*<my user name>*/public_html/zbblock/zbblock.php", and when I changed it to zbblock/zbblock .php" (the RELATIVE path), the warning went away.

Looks promising.
__________________
BJ
Reply With Quote
  #10  
Old 20th May 2011, 12:16
BobJam BobJam is offline
Junior Member
 
Join Date: May 2011
Location: Arizona, USA
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default Re: Live to local

Have I solved the problem?

Yes and no. I have the live site set up on my machine now, but at first all the internal links in the menu were giving me a 404.

The solution to that was simple: disable SEF.

And then I had a permissions issue on configuration.php. Simple solution again.

The big breakthrough was ABSOLUTE paths versus RELATIVE paths. Once I made all the paths RELATIVE, things began falling in place.

It had ABSOLUTELY nothing to do with httpd or httpd-vhosts configs or any other configs for that matter. Nor did it have anything to do with the .htaccess file. I was chasing my tail on a lot of those troubleshooting efforts.

The "no" part is that I need to learn how to upload my changes. For now I'll test the changes and then hopefully do the same procedure on the live site if it works on the test site.

But ultimately I need to gain enough confidence in my "test" site so that I can just flat out upload them and not go through hoops twice.

Right now I'm afraid that if I uploaded the test site db I'd bork the live site.
__________________
BJ
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
dovecot: lda: Fatal: Unknown user dpicella Installation/Configuration 1 22nd August 2010 02:59
ERROR: Connection dropped by IMAP server. [Centos 5.4, courier imap,squirrel, etc] darevil HOWTO-Related Questions 7 9th June 2010 14:49
Exim Gateway with mailwatch (Unable to receive emails) siul0_0 HOWTO-Related Questions 10 8th May 2009 23:00
localhost postfix/master: fatal: bind 127.0.0.1 port 125: Permission denied g18c Installation/Configuration 4 24th March 2009 17:39
I Fail at installing ispconfig where did I go wrong? stocker741 Installation/Configuration 14 30th October 2008 14:12


All times are GMT +2. The time now is 10:11.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.