Changes

Jump to: navigation, search

Creating a Simple PHP Script

1,633 bytes added, 13:49, 24 May 2007
no edit summary
<?>
</pre>
 
== Testing the PHP Installation ==
 
Before emarking on even the simplest of examples the first step on the road to learnign PHP is to verify that the PHP module is functioning on your web server. To achieve this we will create a small PHP script and upload to the web server. To do this start up your favorite editor and enter the following PHP code into it:
 
<pre>
<?php
phpInfo();
?>
</pre>
 
This PHP script calls the built-in PHP ''phpInfo()'' function, the purpose of which to output information about the PHP pre-processing module integated into your web server.
 
Save this file phpinfo.php and upload it to a location on your web server where it will be accessible via a web browser. Once you have done this open a browser and go to the UTL for this file. If all is well with your PHP installation you will see several pages of detailed information about your PHP environment covering topics such as how and when the PHP module was built, the version of the module and numerous configuration settings.
 
If you do not see this information it is possible you do not have the PHP module integrated into your web server. If you use a web hosting company, check with them to see if your particular hosting package includes PHP support (sometimes PHP support is only provided with premium hosting packages so you may need to upgrade). If you run your own web server consult the documentation for your particular type of server (Apache, Microsoft IIS etc) for details on integrating the PHP module. There are vastly superior resources available on the internet to assist in installing PHP that we could never match in this book.
== Emdedding PHP into an HTML File ==

Navigation menu