On most web hosts, PHP errors are logged rather than printed to the screen. This is good security; it prevents you from accidentally exposing your database password or other sensitive information if you mess up your code. However, this feature also prevents you from seeing what's gone wrong if there was a problem during your installation. Instead of a login screen, you'll just see a blank white page.
If you know where your PHP error log is, you can check it to see what the problem was. If you don't know where the log is, you can check your web host's documentation to find out, or you can simply turn on the error display until you resolve the problem. WordPress will not display your database connection information even if there is an error.
To display errors, add the WP_DEBUG constant to your wp-config.php file, as shown in Listing 2-2. You can put it anywhere, but I like to keep it at the top.
Listing2-2. Debugging with wp-config.php (partial)
// ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define('DB_NAME', 'my_wp_db');
/** MySQL database username */ define('DB_USER', 'my_wp_db_user');
Visit your site again, and you should see the problem. Ignore any warnings and notices, and look for fatal errors. Is there an unknown function? Look for a missing file, or simply re-upload the entire WordPress package. Figure 2-9 shows the error messages you would see if one of the files from wp-includes were missing-in this case, capabilities.php. The first message, a warning, could be safely ignored, but in this case it provides us with a clue as to why the second error occurred. The fatal error is the showstopper. Resolve that problem, and WordPress should work correctly.
When you've solved the problem, switch the value of WP_DEBUG to false, as shown in Listing 2-3.
Listing2-3. Turn offdebugging in wp-config.php (partial)
| -< | »- | [ + http://wp.lrunk/ C j (O.- Cooglc
Menus ■cTestmq Trunk — WordPrcsi hftp; / /vvu.trunk/ | -
Warning: requiref/Uscrs/sceplVDocumcnt^^ [function .requite]: failed to open stream: No such file or directory in
/Users/steph/Docu men ts/codeAVord PressS V N/tru n kAv p -settings.ph p on line 1€2
Fatal error: rcquireO [function.require]: Failed opening required 'yUMi^stcphyDocumerUsycode/^'ordPrcssSVNAnjnkAvp-includcs/capabilitjes.php' (include_path='.:/Applications/MAMP/bin/php5/lib/php') in /Users/stt ph/D ocumenl^code/WordPressS V'NTtrunk/wp-settings.ptip on line 102
Figure 2-9. Error messages
Was this article helpful?