|
Oracle® Application Server Standard Edition One Quick Tour
10g Release 2 (10.1.2) Part No. B15924-01 |
|
![]() Previous |
![]() Next |
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
After downloading the zip file, extract the |
Start Oracle JDeveloper 10g.
Select New from the File menu. The New Gallery window will appear.
Select Application Workspace.
Click OK. The Create Application Workspace window will appear.
Enter a name for the application, and a directory.
Click OK.
Right-click the project that corresponds to the new application, and select New. The New Gallery window will appear.
Expand the Web Tier node by clicking the plus sign (+).
Select PHP in the Categories section, and PHP File in the Items section.
Click OK. The Create PHP File window will appear.
Enter a file name for the PHP file. The file extension should be .php. The directory name should not be changed for the application.
Configure the database connection for the PHP application using the PHP DB Connect option on the Tools menu.
|
Note: You will need to edit theORACLE_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.
|
Create the PHP application using the PHP Blocks and PHP Statements elements available on the Component Palettes.
Save the project as you work on it. The following figure shows Oracle JDeveloper and a PHP application.
Test the project by selecting the project name from the Run menu.
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