Creating PHP pages

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.

Your First PHP Page

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:

  1. Open your favorite text editor.
  2. Type the following code into your text editor:
    <html> <title>PHP Test</title> <?php echo "Hi, I'm a PHP script!"; ?> </html>

    Notice how The PHP code is enclosed in special start and end tags. These allow you to jump into and out of "PHP mode."

  3. Save your file as hello.php and close the text editor. If you're using Windows Notepad, ensure that the the ".php" replaces the ".txt" extension when saving your file.
  4. Upload your new PHP file to the site folder of your hosting account. For more information, see What is FTP?.
  5. Use a web browser to access the file by typing in your site's domain name, followed by /hello.php. For example, coolexample.com/hello.php.

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.

Your Second PHP Page

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:

  1. Open your text editor.
  2. Type the following code into your text editor:
    <html> <title>PHP Info</title> <?php phpinfo(); ?> </html>
  3. Save your file as info.php and close the text editor. If you're using Windows Notepad, ensure that the the ".php" replaces the ".txt" extension when saving your file.
  4. Upload your new PHP file to the site folder of your hosting account. For more information, see What is FTP?.
  5. Use a web browser to access the file by typing in your site's domain name, followed by /info.php. For example, coolexample.com/info.php.

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.

Next Steps


이 글이 도움되었나요?
피드백을 보내주셔서 감사합니다. 고객 서비스 담당자에게 문의하시려면 지원 전화 번호 또는 위의 채팅 옵션을 이용하시기 바랍니다.
도와드릴 수 있어 기쁩니다! 더 도와 드릴 것이 있나요?
그것 유감스럽습니다. 혼동이 되었던 사항 또는 솔루션이 고객님의 문제를 해결하지 못했던 원인을 알려주세요.