Troubleshooting: PHP isn't working
If you tried the Hello World lesson and didn't get the expected result, there are a few things you can check:
-
Check that your file has a
.phpextension. In some text editors, it's easy to accidentally save a file as.html,.txtor similar instead. (Make sure you're actually using a text editor, not a word processor!) - Check that PHP is enabled on your server. Many free/cheap hosting plans don't include PHP (e.g. Neocities can't run PHP code). Some hosts might require you to check a box to enable it. If you manage your own server, you might meed to install and configure PHP.
-
If asking for help online, be sure to include:
- The code from your failing
.phpfile - The full URL of the page
- The way in which it's not-working e.g. 404 error, 500 error, blank page (use View Source to see if it's really blank), can see PHP code, etc.
- The code from your failing