PHP Extension for Oracle JDeveloper 10g Release Notes
PHP Extension Release Notes
Release 1.3
 

 

PHP Extension

Release Notes

Release 1.3

April 2006

This document provides installation and configuration notes for the PHP Extension for Oracle JDeveloper. It contains the following topics:

Overview

The PHP Extension makes it easy to create, run, and deploy PHP scripts in Oracle JDeveloper 10g.

The PHP Extension combined with JDeveloper's comprehensive functionality help make web and database development productive for the PHP developer.

  • PHP, HTML, CSS, XML, Javascript, SQL and PL/SQL support
  • Structure view
  • Online Help
  • Pre-supplied code blocks
  • Database connectivity
  • PL/SQL debugger
  • Database object browser
  • Visual database table creation

The PHP Extension can be used in combination with the Application Migration Assistant Extension to migrate non-Oracle based PHP applications to Oracle Database.

Prerequisites

To use all features of the PHP Extension in Oracle JDeveloper, in addition to Oracle JDeveloper you need to install a web server such as the Apache Web Server, and PHP. You may also need to install Oracle Database to access a local database, or install Oracle Database Client and arrange accounts on remote databases you want to access.

Once all software requirements are in place, you can install and use the PHP Extension.

Software Version Download from
Oracle Database or

Oracle Database Client

10g Oracle Technology Network

http://otn.oracle.com/software/products/database/oracle10g/index.html

Oracle JDeveloper 10.1.3 Oracle Technology Network

http://www.oracle.com/tools/jdev_home.html

Web Server such as Apache HTTP Server 1.3 or later Apache Software Foundation

http://www.apache.org/info/referer-dotcom.html

PHP 4.3.4 or later PHP Net

http://www.php.net/downloads.php


For detailed information about installing this software, see the Oracle Technology Network articles, Installing Oracle, PHP and Apache on Windows 2000/XP at http://otn.oracle.com/tech/opensource/php/apache/inst_php_apache_windows.html and Installing Oracle, PHP and Apache on Linux at http://otn.oracle.com/tech/opensource/php/apache/inst_php_apache_windows.html

Installing the PHP Extension

  1. Download the PHP Extension, oracle.jdeveloper.php.10.1.3.10.1.jar, from the Oracle JDeveloper Extension Exchange at http://otn.oracle.com/products/jdev/htdocs/partners/addins/exchange/index.html on the Oracle Technology Network.
  2. Copy oracle.jdeveloper.php.10.1.3.10.1.jar to the JDEV_HOME/jdev/extensions directory.
  3. Restart Oracle JDeveloper.
  4. Configure the PHP Environment. See Configuring the Structure Window PHP View and Configuring the Environment to Run PHP Scripts.

Configuring the Structure Window PHP View

After installing PHP, there are several settings required to enable the Structure window PHP View:

Setting the PHP executable

Before Oracle JDeveloper can parse PHP scripts for the Structure window, you need to set the location of the PHP Executable in Oracle JDeveloper.

To set the location of the PHP executable

  1. Click Project Preferences in the Tools menu. The Project Preferences dialog opens.

  2. Click PHP Runtime Settings. The PHP Runtime Settings pane opens.

  3. Enter the path and filename of the PHP executable in the PHP Command-line Executable field, or click Browse to find the PHP executable.

    Use the command-line PHP executable, not the CGI PHP executable.

    For example, if you are using PHP 4.x.x, it will be in the form:

    D:\php-4.x.x-Win32\cli\php.exe
    
    

    If you are using PHP 5.x.x, it will be in the form:

    D:\php-5.x-x-Win32\php.exe
    
  4. Click OK.

If the structure tree does not appear in the Structure window, check that you have set the PHP executable to the command-line PHP executable, not the CGI PHP executable.

Setting PHP View Options

You can disable the PHP View, set it to refresh after the standard Oracle JDeveloper idle-time, or set it to refresh each time you save the script.

To set the PHP View behavior and PHP executable

  1. Click Project Preferences in the Tools menu.

  2. Click PHP Runtime Settings. The PHP Runtime Settings pane opens.

  3. Click the radio button for the PHP View behavior you want in the Structure Window PHP View pane.

  4. Set the PHP executable in the PHP Command-line Executable field if it is not already set. See Setting the PHP executable.

  5. Click OK to save your settings.

You need to set the command-line PHP executable that the PHP View uses to parse PHP scripts.

Configuring the Environment to Run PHP Scripts

After installing, there are several settings that may be required to run PHP scripts and display output in your web browser:

Setting the Web Browser and Proxy

You may need to modify your browser or proxy settings in the Oracle JDeveloper preferences.

To modify your browser and proxy settings

  1. Click Preferences in the Tools menu.

  2. Click Web Browser and Proxy.

  3. Enter the browser and proxy settings you want to use. Leave the Browser Command Line field blank to continue to use your default web browser.

Configuring Apache Web Server Access to PHP Scripts

The PHP project directory needs to be mapped to the PHP project URL to enable the web server to display PHP script results in your web browser.

There are several ways to map the PHP project directory containing your PHP scripts to the PHP project URL used by the web server. Here are three typical examples:

Example 1 Default PHP Project

Create a new PHP project using default paths, and then configure the Apache Web Server so it can access PHP scripts created in the default PHP Project Directory. When you use default paths, the PHP Project Wizard typically creates a PHP Project Directory like:

c:\jdev\jdev\mywork\Application1\Project1\public_html (Win)

and a PHP Project Directory URL like:

http://localhost/Application1/Project1/public_html/

You can set an Alias parameter in the Apache Configuration file, httpd.conf, so the PHP Project URL maps to the default PHP Project Directory. For this example, the entry in the Aliases section of httpd.conf is:

    Alias /Application1/ "c:/jdev/jdev/mywork/Application1/"
    <Directory "c:/jdev/jdev/mywork/Application1/">
        Options Indexes MultiViews
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>

If you want to change the PHP Project Directory URL, see Setting and Testing the PHP Project Directory URL.

Example 2 Home Directory as PHP Project Directory

Create a new PHP project and set the PHP Project Directory to your home directory using the ~ (tilde) shortcut. You then need to configure the Apache Web Server so it can access PHP scripts created in the PHP Project Directory. When you set the PHP Project Directory to your home directory in this way, the PHP Project Wizard typically creates a PHP Project Directory like:

/home/username/public_html/Application1/Project1/public_html (Linux) 

and a PHP Project Directory URL like:

http://locahost/~username/Application1/Project1/public_html/ (Linux)

where username is the name of your home directory.

You can set a UserDir parameter in the Apache Configuration file, httpd.conf, so the PHP Project URL maps to your PHP Project Directory. For this example, the entry in the UserDir section of httpd.conf is:

    UserDir public_html

If you want to change the PHP Project URL, see Setting and Testing the PHP Project URL.

Example 3 Apache Document Root Directory

Create a new PHP project and set the PHP Project Directory to the default Apache document root directory, htdocs. The PHP Project Wizard typically creates a PHP Project Directory like:

/apache/apache/htdocs/Application1/Project1/public_html (Linux)

and a PHP Project Directory URL like:

http://localhost/Application1/Project1/public_html/

The Apache Web Server accesses PHP scripts in the document root directory by default, so no Apache configuration file changes are necessary.

Setting and Testing the PHP Project Directory URL

After the PHP project wizard has successfully created a PHP project, you can set the PHP project directory URL in the Project Properties dialog.

To display the output from your PHP script, the PHP Project directory URL must point to the physical directory containing your PHP scripts, the PHP Project Directory.

To set and test the PHP project directory URL

  1. Select the PHP project in the Applications Navigator.

  2. Click Project Properties in the Tools menu.

  3. Click PHP Script Execution Settings.

    The PHP Script Execution Settings pane is displayed.

  4. Enter the PHP project URL you want to use. The filename will be appended to the URL you enter.

  5. Click Test URL to test that the URL is accessible by the web server. Success or failure messages are displayed in the associated text box. When creating a new project, this test may show failure because the directory structure is not created until the wizard finishes and the project is saved.

Setting the PHP Project Target Script

If you attempt to run the PHP Project and the target script has not been set, you are prompted to set it.

To set the default PHP project target script

  1. Select the PHP project in the Applications Navigator.

  2. Click Project Properties in the Tools menu.

  3. Click Run/Debug. The Run/Debug pane is displayed

  4. Select the Run Configuration for which you want to configure a PHP project target script and click Edit. The Edit Run Configuration dialog is displayed.

  5. Click Launch Settings. The Launch Settings pane is displayed.

  6. Enter the PHP project target script in the Default Run Target field, or click Browse to find the script you want to set as the PHP project target script.

  7. Optionally click the Attempt to Run Active File before Default checkbox if you always want to run the active PHP script rather than the default when you run your PHP project.

  8. Click OK to set this script as the PHP project target file.

Configuring PHP Syntax Colors

You can set syntax colors specific to PHP scripts by setting options for individual PHP styles.

To set PHP syntax colors

  1. Click Preferences in the Tools menu.

  2. Expand the Code Editor node in the left pane, and select Syntax Colors. The Code Editor: Syntax Colors pane is displayed.

  3. Select PHP from the Language dropdown.

  4. Select the PHP style you want to set from the Available Styles.

  5. Set the font style, foreground and background colors you want for the selected style.

  6. Repeat steps 4 and 5 for all the PHP styles you want to change.

  7. Click Save as and select an existing Scheme name, or enter a new name.

  8. Click OK to save your settings.

Configuring the PHP Environment

After installing PHP, there are several settings that may be required to enable database access in Windows, and to view PHP scripts with .phtml and .phps extensions.

Enabling Database Access in PHP on Windows

After installing PHP, ensure it is configured to allow connections to Oracle Database using PHP's OCI8 functions.

To set the extension directory and enable php_oci8.dll in Windows

  1. Open the php.ini file from the %SYSTEMROOT% directory, which is typically c:\winnt in Windows.

  2. Search for the line containing:

    ; extension_dir
    
    
  3. Uncomment the line by removing the leading semi-colon.

  4. Replace the default directory with the extensions directory of your PHP installation. If you are using PHP 4.x.x, the line should appear like:

    extension_dir = "C:\php-4.x.x-Win32\extensions"

    If you are using PHP 5.x.x, it will be in the form:

    extension_dir = "C:\php-5.x.x-Win32\extensions"
    
  5. Search for the line containing:

    ;extension=php_oci8.dll
    
    
  6. Uncomment the line by removing the leading semi-colon. The line should now appear like:

    extension=php_oci8.dll
    
    

To enable php4ts.dll

  1. Stop Oracle JDeveloper.

  2. Navigate to the PHP installation directory.

  3. Copy php4ts.dll to the directory containing the PHP command-line executable, the cli subdirectory of the PHP installation directory. See Setting the PHP executable.


    Note:

    The command-line PHP executable is located in the PHP installation directory for PHP 5, in the cli subdirectory for PHP 4.

  4. Start Oracle JDeveloper.

Adding PHP Mime Type Definitions to Apache

To enable recognition of PHP scripts with the extension .phps or .phtml, you may need to edit the Apache configuration file, httpd.conf.

To add PHP mime type definitions to Apache

  1. Stop the Apache Web Server.

  2. Navigate to the APACHE_HOME/apache/conf directory.

  3. Open httpd.conf in a text editor.

  4. Search for .php. You should find a text block like the following:

    # Added this section to add a handler for .php scripts.#
    <IfModule mod_php4.c>
    AddType application/x-httpd-php .php
    </IfModule>
    
  5. Edit the text block to add .phps and .phtml mime types as shown following:

    # Added this section to add a handler for .php scripts.#
    <IfModule mod_php4.c>
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php .phtml
    AddType application/x-httpd-php-source .phps
    </IfModule>
    
  6. Start the Apache Web Server.

Disabling and Re-enabling the PHP Extension

When the PHP Extension is installed, it is automatically enabled. You can use Oracle JDeveloper's Extension Manager to disable it, and subsequently re-enable it.

To disable the PHP Extension

  1. Click Project Preferences in the Tools menu. The Project Preferences dialog opens.

  2. Select Extensions.

  3. Click the PHP Extension check box to clear it, and then click OK. You are prompted to allow Oracle JDeveloper to exit.

  4. Start Oracle JDeveloper. The PHP Extension is disabled.

To re-enable the PHP Extension

  1. Click Project Preferences in the Tools menu. The Project Preferences dialog opens.

  2. Select Extensions.

  3. Click the PHP Extension check box to check it, and then click OK. You are prompted to allow Oracle JDeveloper to exit.

  4. Start Oracle JDeveloper. The PHP Extension is re-enabled.

Uninstalling the PHP Extension

You can uninstall the PHP Extension if you no longer wish to use it. If you might want to use it again, consider disabling it instead. See Disabling and Re-enabling the PHP Extension.

To uninstall the PHP Extension

  1. Stop Oracle JDeveloper.

  2. Move or delete oracle.jdeveloper.php.10.1.3.10.1.jar from the JDEV_HOME/jdev/extensions directory.

  3. Start Oracle JDeveloper.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy