Dreamweaver 8 and PHP

Writing PHP files in Dreamweaver is more complicated than creating basic HTML files. This is because PHP does not run independently within a Web browser. It is scripting language that needs access to a PHP Application Server and an SQL database. In order to use Dreamweaver 8 or another version of Dreamweaver, you need to place your PHP files in a folder that has access to these resources and then tell Dreamweaver where these resources can be found relative to this folder.

  1. PHP Application Server

    • In order to test and run PHP files, the computer you are using must be connected to a PHP Application server. This can be installed on your computer, or on a computer on your network. If you are uploading the files to a Web server, it must also have access to a PHP Application server. The PHP Application server can be downloaded from php.net/downloads.php. In order to install and run the PHP Application server, Microsoft IIS must also be installed. You can see if IIS has been installed on a computer by looking for an "Inetpub" folder in the root directory.

    SQL

    • PHP requires an SQL database. A free version of MySQL can be downloaded from mysql.com/downloads. You can install this on your computer or your network to test your PHP files. Your Web server also requires an SQL database. Many Web hosts will give you access to an SQL database when you purchase your hosting services. When you create your a PHP file, you can direct Dreamweaver to your MySQL database by clicking "Databases" under the Window menu. You can then type "local host" if it is on your computer, or type the IP address or server name that is hosting the database.

    Folders

    • A root folder must be specified on the same computer or Web server running IIS. In most cases, this can be placed inside the "Inetpub" folder. You can use a name like "MyApps." You should then direct Dreamweaver to this folder using the "Manage Sites" option under the "Site" menu. Dreamweaver also requires you to specify a "Testing Server" in the Site Definition dialog box before you can test your PHP files. This can be the same "MyApps" folder you are using as a root folder.

    PHP Code

    • Depending on your needs, the pages you create in Dreamweaver can contain only PHP code or the code can be framed within the body of an HTML page. In either case, the page must be saved using the ".php" extension, such as "myapp.php." Within the page, PHP code must be framed between  "<?php" and  "?>" tags. For example, the code "<?php echo '<p>Hello World</p>'; ?>" is a basic "Hello World" PHP file you can use for testing purposes. Use the Code View option in Dreamweaver to view and edit PHP code.

Related Searches:

References

Comments

Related Ads

Featured