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 trialCraig Watson
27,930 PointsWordPress Local Installs Only Showing a Blank White Screen?
Hi all :)
This may be a tough one to get to the bottom of being that there could be a hole heap of things to check before getting to the bottom of this but here goes....
Prior to realizing there was a problem I had been working on a site using workspaces. In this period of time I upgraded to Windows 10, downloaded Ruby 2.1, installed Sass, installed Jekyll, installed Java and to top it all off tried installing Python.
A lot of the above did not go smoothly and took a number of attempts to finally get going.
Ruby is installed Sass is installed
I have removed Python I have removed Jekyll I have removed Java
I had installed the three above to do the course on build a blog with Jekyll and GitHub Pages. ( did not work well ).
To install and get the python server running I had to change the apache port as there was a conflict. However after this all seemed ok with apache but python was not working.
Next I brought my project down from workspaces and into my htdocs folder for xammp. At this stage it is all html css and js.
Works fine.
Moved the file over to a local install of WordPress(this is a copy of a live site I keep locally and the file was moved into the themes folder) to start making changes for php.
At this point I tried to open the WordPress site to change my theme over to the freshly built one. This is when I the site was just a white page.
Tried wp_debug, still white screen.
Tried other previously working installs or WordPress they are doing the same thing.
Changed ports for apache (checking they work for static site) still not working.
Changed mySQL ports, get an "error establishing database connection" message.
Scrolled handfuls of blogs mentioning Skype running the same port, I don't have it.
So now I turn to you guys :) and Zac Gordon :)
Any help will be greatly appreciated as I currently can not edit any local installs of WordPress and NOBODY wants me editing the live site files... dum dum dummmm.....
Thanks Craig
Craig Watson
27,930 PointsHi Colin,
Yes when I changed the apache ports the static sites works as you would expect.
In the wp-config file I checked and the code was as folows:
<?php
/** MySQL hostname */
define('DB_HOST', 'localhost');
?>
:S
Craig Watson
27,930 PointsNo to sure if this will help us but I didn't mention that even phpmyadmin is a blank white page too.
Colin Marshall
32,861 PointsTo change the port for the database in wp-config you do this, replacing the 5555 part with whatever you changed the port to.
<?php
/** MySQL hostname */
define('DB_HOST', 'localhost:5555');
?>
I don't believe this will solve your problem though if you are not getting the database connection error message when the port is unchanged.
Try finding the php error log. It should be something like this folder: \xampp\php\logs\php_error_log
and the xampp folder is located wherever you have installed the software.
Craig Watson
27,930 PointsHi Colin,
below are the errors related to this situation:
[25-Aug-2015 10:16:49 UTC] PHP Warning: mysqli_real_connect(): MySQL server has gone away in C:\xampp\htdocs\DigiMouse-Wordpress\wp-includes\wp-db.php on line 1444
[25-Aug-2015 10:16:49 UTC] PHP Warning: mysqli_real_connect(): Error while reading greeting packet. PID=9520 in C:\xampp\htdocs\DigiMouse-Wordpress\wp-includes\wp-db.php on line 1444
[25-Aug-2015 10:16:49 UTC] PHP Warning: mysqli_real_connect(): (HY000/2006): MySQL server has gone away in C:\xampp\htdocs\DigiMouse-Wordpress\wp-includes\wp-db.php on line 1444
[25-Aug-2015 10:16:49 UTC] PHP Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\DigiMouse-Wordpress\wp-includes\wp-db.php on line 1445
it is pointing to this block of code:
<?php
if ( WP_DEBUG ) {
mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags );
} else {
@mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags );
}
?>
I have WP_DEBUG set to true in the wp_config.php :S
Colin Marshall
32,861 PointsAre you getting that database error message no matter what port your mysql is set to? Also, what ports are you using for apache and mysql?
Craig Watson
27,930 PointsNo, I only get the database connection error when I change the mySQL port. If the port is is left to the original I get simply a white screen.
Craig Watson
27,930 PointsOk this is interesting,
changed the SQL port and the apache port is changed, when trying for phpmyadmin I get an error:
2002 - No connection could be made because the target machine actively refused it.
The server is not responding (or the local server's socket is not correctly configured). Connection for controluser as defined in your configuration failed.
Colin Marshall
32,861 PointsAre those errors from your error log when the mysql port is changed or unchanged? Also, what ports are you using for apache and mysql (default and changed)?
If you change the apache port, you have to access it through the web browser by adding the apache port to the URL like this: http://localhost:81/ so try it like that to access phpmyadmin.
Craig Watson
27,930 PointsI have currently got both ports set as new ports and getting no errors when starting them up.
Apache was : 80 Apache is now : 8080
mySQL was : 3306 mySQL is now : 3307
my wp-config.php has the host set as below:
<?php
/** MySQL hostname */
define('DB_HOST', 'localhost:8080');
?>
When trying this web address; localhost:8080/phpmyadmin I get the following error on screen:
This is now my new error log from xammp/php/php_error_logs:
[25-Aug-2015 10:16:49 UTC] PHP Warning: mysqli_real_connect(): MySQL server has gone away in C:\xampp\htdocs\DigiMouse-Wordpress\wp-includes\wp-db.php on line 1444
[25-Aug-2015 10:16:49 UTC] PHP Warning: mysqli_real_connect(): Error while reading greeting packet. PID=9520 in C:\xampp\htdocs\DigiMouse-Wordpress\wp-includes\wp-db.php on line 1444
[25-Aug-2015 10:16:49 UTC] PHP Warning: mysqli_real_connect(): (HY000/2006): MySQL server has gone away in C:\xampp\htdocs\DigiMouse-Wordpress\wp-includes\wp-db.php on line 1444
[25-Aug-2015 10:16:49 UTC] PHP Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\DigiMouse-Wordpress\wp-includes\wp-db.php on line 1445
[25-Aug-2015 18:26:54 UTC] PHP Warning: mysqli_real_connect(): MySQL server has gone away in C:\xampp\htdocs\DigiMouse-Wordpress\wp-includes\wp-db.php on line 1444
[25-Aug-2015 18:26:54 UTC] PHP Warning: mysqli_real_connect(): Error while reading greeting packet. PID=7428 in C:\xampp\htdocs\DigiMouse-Wordpress\wp-includes\wp-db.php on line 1444
[25-Aug-2015 18:26:54 UTC] PHP Warning: mysqli_real_connect(): (HY000/2006): MySQL server has gone away in C:\xampp\htdocs\DigiMouse-Wordpress\wp-includes\wp-db.php on line 1444
[25-Aug-2015 18:26:54 UTC] PHP Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\DigiMouse-Wordpress\wp-includes\wp-db.php on line 1445
I thought it best to go over everything where I am so I haven't changed something you had thought was different :)
Thanks for you help on this I really appreciate it!
Colin Marshall
32,861 PointsNo problem Craig, hopefully we can get it sorted out.
One thing I see right away is that you are using the wrong port in your wp-config. You should use the MySQL port of 3307 instead of the Apache one, because we are trying to connect to the database host (DB_HOST), which is the mysql server running on port 3307.
That, however, does not explain why phpmyadmin cannot connect to the database. Can you please check your php.ini file, which should be found in xampp\php\php.ini
, and tell me what the mysql port is set to in there? Set it to 3307 if it's still at 3306.
Did you have to install anything mysql related when you did your python, ruby, etc. installs? Also, did Xampp work properly with WordPress and phpmyadmin prior to doing those installs?
Craig Watson
27,930 PointsGood News!!!!
I opened php.ini in sublime and did a find and replace on 3306 with 3307, we have access to phpmyadmin @ localhost:8080/phpmyadmin.
This ia a warning that has come up of which I have not seen before?
Your configuration file contains settings (root with no password) that correspond to the default MySQL privileged account. Your MySQL server is running with this default, is open to intrusion, and you really should fix this security hole by setting a password for user 'root'.
But we have made progress lol :)
Now I did install scout, and I had a few issues with that and have since removed it. I recall an error which was to do with java.
The other issue i encountered was when trying to get jekyll going. It required python which I installed (now removed) and that did want me to change the ports as its default was 80.
Colin Marshall
32,861 PointsNice! Does that warning stop you from actually accessing and doing stuff in phpmyadmin?
Most localhosts just use root/root as the username password, so it's not really a big deal unless you are on a production server, which you are not. Do you know if the password is blank or if it's "root" ? I've never seen it as blank by default.
Another place you want to change the ports at is in this file: xampp\mysql\bin\my.ini
Craig Watson
27,930 PointsThere were a couple of instances of the port 3306 in that file, now changed........ Still white screen. I have never changed it before and I have used root and root for local installs to :S so no ideas on that one but I can soon change the password there to be sure.
An update would be that I am no longer getting the database not found error.
I have also had a look at the table in phpmyadmin and the table for wp_options and under siteurl I have the option value of; http://localhost/DigiMouse-Wordpress.
I changed to: http://localhost:8080/DigiMouse-Wordpress nothing,
I changed to: http://localhost:3307/DigiMouse-Wordpress and when I entered the web address some strange file got downloaded.
Craig Watson
27,930 PointsOK prepare for the astounding.... I ran a fresh test install of WordPress locally,
New Database
New User
Install went according to plan and I now have nice shiny new WordPress install :) however still not working for the old sites :)
This is interesting... the url is; http://localhost:8080/New%20Host%20Test/
The link from my list of files on the local host takes me here; http://localhost/DigiMouse-Wordpress/
Craig Watson
27,930 PointsWell I finally have some good news!
We are in :D lol, after changing the url's directly in the tables on phpmyadmin, I needed to clear the cache because for some weird reason the links from the localhost home page were not directing to local host:8080 for WordPress site :S
I need to edit all the tables manually for the other site but we are good to go!!
Again Colin I cant thank you enough for your help on this I'm still a novice really and this had me round the bend lol
Much appreciated!
Craig
Colin Marshall
32,861 PointsWoo Hoo! Glad we got it working Craig Watson!
1 Answer
Colin Marshall
32,861 PointsAlmost there! Check the wp-config of the new, working site and copy over the information (except database name) to the old site's wp-config's.
There are also 2 urls in the database that need to be changed in the wp_options table. One is site_url and I think the other is home_url. Look at what they are for the new site in the db, and make them the same format for the old sites (replacing the folder name for the corresponding site of course).
You're definitely not going to have :3307 in those fields, you only need to use that port for the wp-config file. It's either going to be http://localhost/your-new-working-site
or http://localhost:8080/your-new-working-site
. You may or may not need to have the port in the URL, so just see what the working site has and try to make everything look the same for the old sites.
Colin Marshall
32,861 PointsColin Marshall
32,861 PointsChanged ports for apache (checking they work for static site) still not working.
When you did this did the static site work or not work?
Changed mySQL ports, get an "error establishing database connection" message.
Did you update the database port in wp-config when you changed ports?