How to run wordpress on localhost with remote database

//How to run wordpress on localhost with remote database

Do you want to run your WordPress website on your laptop/computer… WordPress on localhost server ?

Because some WordPress plugins use too much resources I keep getting the 503 error code on my shared hosting, and instead of using a more expensive server I will make important changes from my laptop server using WordPress on localhost.

In my situation I want to use the remote WordPress database that is on the shared server. You can also make your local database.

I have made this tutorial to help you.

1. First you need to install WAMPP or XAMPP .

XAMPP is an easy to install Apache distribution containing MariaDB, PHP, and Perl. Just download and start the installer. It’s that easy.

WampServer is a Windows web development environment. It allows you to create web applications with Apache2, PHP and a MySQL database. Alongside, PhpMyAdmin allows you to manage easily your database.

I have tested both , WAMPP works better for me (is faster).

2. Now that you have WAMPP installed , you have to download your WordPress files

If you have cPanel , go to File Management and make a compressed backup of your WordPress files.

TIP : for a faster backup exclude the folder “uploads” in wp-content , there you have all your website photos , and in localhost you may not need them.

3. Copy the files to “C:\wamp64\www” 

Copy your WordPress files to this path “C:\wamp64\www” , if your WAMPP is installed on another path , change this as you need.

4. Wp-Config.php changes needed to connect to remote database

To access your shared hosting database , edit your wp-config.php file and change :

Get your Dedicated IP Address in cPanel server information , or contact your hosting to provide you the IP for the database.

Replace “000.000.000.000” with your Database Ip.

/** MySQL hostname */
define('DB_HOST', '000.000.000.000');

5. Wp-Config.php changes to make your wordress on localhost work :

Add these lines in your wp-confi.php file :

define('WP_HOME','localhost');
define('WP_SITEURL','');

6. .htaccess changes to make it work

Make sure your .htaccess starts with this code , and remove code you may have used on shared hosting :

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

6. If you have the Woozone Plugin installed you also have to do this change :

Go to “\wp-content\plugins\woozone” and edit this file  “validation.php”  at line 142 :

Change “adrianweb.xyz” with your website name.

private function getHost ( $url )
{
//$__ = parse_url( $url );
return "adrianweb.xyz";
}

7. WooZone works without any error but you have to copy the pictures downloaded back to your shared hosting

Because you have direct access to the database, the only thing to do now is to take the files downloaded by Woozone and add them back to the server.

For me is this path “C:\wamp64\www\wp-content\uploads\2017\11” , because now is November 2017.

Now you can manually copy those files to your server in the same folder “wp-content\uploads\2017\11” , or user this software that takes every new file from this path to your sever.

Download WinSCP : Free SFTP, SCP and FTP client for Windows that keeps remote directory up to date.

8. Start WAMPP and make some changes :

I’m using :

PHP 7.1.9

APACHE 2.4.27

No Databases

The server will not run very fast, but it works without errors.

9. WooZone Admin .css fix , design not loading

Edit this file “\woozone\aa-framework\framework.class.php” at lines 3317 – 3321 and comment as below

//if( is_file( $main_style_cached ) ) {
//if( (filemtime($main_style_cached) + $this->ss['css_cache_time']) > time() ) {
$main_style = $this->cfg['paths']['freamwork_dir_url'] . 'main-style.css';
//}
//}

10. If you need help you can find me on Facebook .

By | 2017-11-20T22:08:21+00:00 November 18th, 2017|0 Comments

Leave A Comment