How to Save a File As a PHP
PHP (PHP: hypertext preprocessor) is a scripting language that runs on a server. PHP files can be created using HTML, PHP or text editors. HTML and PHP editors are useful because they contain features, such as highlighting, to assist you in coding syntax correctly.
Instructions
-
-
1
Launch your editor, and enter your PHP coding between "<?php" and "?>" tags. Use the following example:
<?php echo '<p>Welcome to my site</p>'; ?>
Save the file with a ".php" extension, for example, "index.php."
-
2
Optionally, upload the file to your server, and navigate to your page in a browser. This is useful for testing your file.
-
-
3
View your web page source. The PHP code has generated the following:
<p>Welcome to my site</p>
-
1
Tips & Warnings
Check the file on your system, and make sure the file name has no other additions such as "index.php.txt." If it does, remove the extraneous extension.
References
- Photo Credit diskette image by Soja Andrzej from Fotolia.com