Skip Headers
Oracle® Application Server Standard Edition One Quick Tour
10g Release 2 (10.1.2)
Part No. B15924-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents

Previous
Previous
Next
Next
 

Developing and Deploying PHP Applications

PHP is a server-side HTML-embedded scripting language. HTML serves as the basic framework for a page. Dynamic PHP code draws content and information from other sources, such as an Oracle database.

The following procedure describes how to create a PHP application that accesses an Oracle database. The procedure uses Oracle JDeveloper to create the PHP application. It is assumed that the database has the scott/tiger schema enabled and is accessible.


Note:

In order to use Oracle JDeveloper to create PHP applications, it is necessary to download the PHP extension plug-in from the Oracle Technology Network at
http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/php/index.html

After downloading the zip file, extract the php_addin.jar file to the JDev_home/jdev/lib/ext directory.


  1. Start Oracle JDeveloper 10g.

  2. Select New from the File menu. The New Gallery window will appear.

  3. Select Application Workspace.

  4. Click OK. The Create Application Workspace window will appear.

  5. Enter a name for the application, and a directory.

  6. Click OK.

  7. Right-click the project that corresponds to the new application, and select New. The New Gallery window will appear.

  8. Expand the Web Tier node by clicking the plus sign (+).

  9. Select PHP in the Categories section, and PHP File in the Items section.

  10. Click OK. The Create PHP File window will appear.

  11. Enter a file name for the PHP file. The file extension should be .php. The directory name should not be changed for the application.

  12. Configure the database connection for the PHP application using the PHP DB Connect option on the Tools menu.


    Note:

    You will need to edit the ORACLE_HOME/instance/network/admin/tnsnames.ora file to specify the database connection information. Refer to the Oracle Database 10g documentation for information about editing the file.

  13. Create the PHP application using the PHP Blocks and PHP Statements elements available on the Component Palettes.

  14. Save the project as you work on it. The following figure shows Oracle JDeveloper and a PHP application.

    Oracle JDeveloper and PHP
    Description of the illustration php.gif

  15. Test the project by selecting the project name from the Run menu.

  16. Copy the PHP application directory to the ORACLE_HOME/Apache/Apache/htdocs directory when it finished. The URL for the application will be as follows:

    http://hostname:port/directory/file.php
    
    

    For example, if the directory for the PHP application is ORACLE_HOME/Apache/Apache/htdocs/php and the file name is dbquery.php, then the URL for the for the application will be as follows:

    http://hostname:port/php/dbquery.php