Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDaniel Niclas
22,300 PointsDataBase transfer causing whitescreen
I am attempting to transfer an entire WP instance (files + DB) from one local computer to another (computer 2). I can transfer all my WP files from computer 1 to computer 2 and connect to an empty database that is set up with phpMyAdmin. When I try to migrate the DB from computer 1 to computer 2 I have difficulty. When exporting the DB with phpMyAdmin, if I don't select 'Add DROP TABLE / VIEW / PROCEDURE....' the DB import process fails with an error that tables already exist. Then I select "Add DROP TABLE...' and import the DB. The import is succesful however accessing the site yields a white screen. I must be missing something and don't understand why I am unable to import the DB without error. Any help is appreciated. Thank you
1 Answer
Daniel Niclas
22,300 PointsI found the solution at 4AM...
In config.php I set define('WP_DEBUG', true); This provides an error message when the white screen occurs. The error code indicated there may be white space above my php block in functions.php. When I removed the white space I had access to wp-admin. When doing one of these DB migrations, also be mindful of your .htaccess file as it may need to be updated to allow access to index.php. It was also necessary to add the following two lines to config.php:
define('WP_HOME', 'http://localhost/www.themedev.dev'); define('WP_SITEURL', 'http://localhost/www.themedev.dev');
Updated .htaccess:
BEGIN WordPress
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase /www.themedev.dev/ RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /www.themedev.dev/index.php [L] </IfModule>
Daniel Niclas
22,300 PointsDaniel Niclas
22,300 PointsAdditional information:
All WP files are transferred to computer #2 via Git clone.
Correct DB_NAME, DB_USER, password and host are added to config.php.
Additional lines added to config.php: define('WP_HOME', 'http://localhost/www.themedev.dev'); define('WP_SITEURL', 'http://localhost/www.themedev.dev'); DB Exported from computer #1 and Imported into computer #2 When I enter the WP site URL I can see the pages and it appears to work (This is all using MAMP) When I try to access the wp-admin console I receive the following error (and get White Screen):
Warning: Cannot modify header information - headers already sent by (output started at /Users/danielniclas/WP_Sites/www.themedev.dev/wp-content/themes/treehouse-portfolio/functions.php:3) in /Users/danielniclas/WP_Sites/www.themedev.dev/wp-includes/pluggable.php on line 1228
I hope this helps. It seems what I am doing is fairly straight forward. Not sure why this is not working. Thank you