PHP is automatically enabled in all of our hosting accounts. Once you activate your hosting account, you can create and upload PHP pages.
There are several good (and often free) PHP editors available for writing your PHP code. However, you can use any text editor program to write a PHP file. After you have written the PHP code, simply name the file with a ".php" extension and upload it to the site directory on your hosting account.
If you're familiar with HTML, PHP is a straightforward language to learn. Once you learn the basic syntax, you can explore more advanced features of PHP. To create your first PHP page:
Notice how The PHP code is enclosed in special start and end tags. These allow you to jump into and out of "PHP mode."
hello.phpand close the text editor. If you're using Windows Notepad, ensure that the the ".php" replaces the ".txt" extension when saving your file.
If everything is configured correctly, PHP will convert the code between short tags and display the text "Hi, I'm a PHP script!" in your browser.
Note: If you tried this example and it did not display correctly, remember to upload the file to your hosting account. If you try to view this PHP file on your computer, it will not work as the file needs to be viewed on a hosting account that runs PHP.
One of the most popular PHP scripts is one that calls the phpinfo() function. The phpinfo() function displays useful information about your system and setup like available predefined variables, loaded PHP modules and configuration settings. To utilize this phpinfo() function:
info.phpand close the text editor. If you're using Windows Notepad, ensure that the the ".php" replaces the ".txt" extension when saving your file.
If everything is configured correctly, PHP will convert the code between the short tags and display your hosting account's PHP information in your browser.