Even though we start simply, potentially, a number of things could go wrong. If you're having problems, delete what you have and start over and follow our previous directions carefully. If you still have problems, this section covers some common issues and gives you solutions that you can try to fix them.
A common problem when doing plugin development is making a change and finding that every attempt to load the site in your browser window results in a blank white screen. A code error is breaking WordPress when it tries to run your plugin code.
A quick way to fix this is to rename your /wp-content/plugins/example-do-nothing plugin directory on your Web server to something like /wp-content/plugins/old.example-do-nothing. This causes automatic deactivation of the plugin because WordPress won't be able to locate it.
Before changing the name back, go to the Plugins page in your Dashboard. A message at the top of the page states The plugin example-do-nothing/init.php has been deactivated due to an error: Plugin file does not exist.
This confirms that WordPress fully deactivated the broken plugin; you should be able to load your Web site successfully without seeing the dreaded white screen of nothingness. After this, you can change the filename back, fix your problem, and try again. If the plugin is still broken, WordPress prevents the plugin from activating and gives you details about the error.
When you activate a plugin in your Dashboard and see an error message on the Plugins page about unexpected output, it means that you have code or text within the main plugin PHP file that is outside of a <?php ?> code block. We cover PHP programming in Book II, Chapter 3 and explain that every PHP function must start with a command that tells your Web server to initiate (or start) PHP. If your plugin file is missing the <?php line, an error about unexpected output occurs and WordPress doesn't activate your plugin.
If your plugin activates, have some fun and try to create this error so you will know it when you see it. Intentionally create the error by following these steps:
When you try to activate the Example: Do Nothing plugin, the following message displays at the top of the Plugins page: /* Plugin Name: Example: Do Nothing Description: This plugin does nothing. It is an example of how to create a valid WordPress plugin. */.
WordPress also displays an error message on the Plugins page (see Figure 5-2), directly beneath the Plugins header: The plugin generated 138 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.
All this fuss because of a missing <?php line.