Skip Headers
Oracle® Database 2 Day + PHP Developer's Guide
11g Release 1 (11.1)

Part Number B28845-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

2 Getting Started

This chapter explains how to install and test Oracle Database and PHP environment. It has the following topics:

What You Need

To install your Oracle Database and PHP environment, you need:

Installing Oracle Database

You should install a copy of Oracle Database Server on your computer. The sample data used in this tutorial is installed by default. It is the HR component of the Sample Schemas.

Throughout this tutorial Oracle SQL Developer is the graphical user interface used to perform Database tasks. Oracle SQL Developer is a free graphical tool for database development.

See Also:

Unlocking the HR User

The PHP application connects to the database as the HR user. You may need to unlock the HR account as a user with DBA privileges. To unlock the HR user:

  1. Open SQL Developer and open a connection to your Oracle database.

  2. Login to your Oracle database as system.

  3. Open SQL Workheet or SQL*Plus and run the following SQL statement:

    alter user hr account unlock;
    
    Description of chap2_unlock.gif follows
    Description of the illustration chap2_unlock.gif

For further information about unlocking an Oracle Database account, see Chapter 6, "Managing Users and Security," in the Oracle Database 2 Day DBA guide.

See Also:

Installing Apache HTTP Server

Zend Core for Oracle includes Apache HTTP Server. Follow the Zend Core installation instructions to install Apache.

Testing the Apache Installation on Windows

To test the Apache HTTP Server installation:

  1. Start your Web browser on the host on which you installed Apache.

  2. Enter the following URL:

    http://localhost/
    
    

    Your Web browser will display a page similar to the following:

    Description of chap2_test_install_013.gif follows
    Description of the illustration chap2_test_install_013.gif

    If this page does not appear check your Apache configuration. Common problems are that Apache is not running, or that it is listening on a non-default port.

Testing the Apache Installation on Linux

To test the Apache HTTP Server installation:

  1. Start your Web browser on the host on which you installed Apache, and enter the following URL:

    http://localhost/
    
    

    Your Web browser will display a page similar to the following:

    Description of chap2_install_001.gif follows
    Description of the illustration chap2_install_001.gif

    If this page does not appear, check your Apache configuration. Common problems are that Apache is not running, or that it is listening on a nondefault port.

  2. In the default Apache HTTP Server configuration file, set up a public virtual directory as public_html for accessing your PHP files. Use your preferred editor to open the Apache configuration file /etc/httpd/conf/httpd.conf (the directory may be different in your installation of Linux), and remove the pound sign (#) at the start of the following line:

    In this example, your Apache httpd.conf file contains the following lines:

    <IfModule mod_userdir.c>
        #
        # UserDir is disabled by default since it can confirm the presence
        # of a username on the system (depending on home directory
        # permissions).
        #
        #UserDir disable
    
        #
        # To enable requests to /~user/ to serve the user's public_html
        # directory, remove the "UserDir disable" line above, and uncomment
        # the following line instead:
        #
        UserDir public_html
    </IfModule>
    
    

    This enables the Web browser to make an HTTP request using a registered user on the system and to serve files from the $HOME/public_html directory of the user. For example:

    http://localhost/~user/
    
    
  3. To use the new Apache configuration file, in a command window, restart Apache by entering the following commands:

    su -
    Password: <enter your su (root) password>
    apachectl restart
    
    
    Description of chap2_install_002.gif follows
    Description of the illustration chap2_install_002.gif

    If the Apache HTTP Server does not start, check the error log files to determine the cause. It may be a configuration error.

  4. In the command window, log in (not root) and create a public_html subdirectory in the $HOME directory with the following command:

    mkdir $HOME/public_html
    
    
    Description of chap2_install_003.gif follows
    Description of the illustration chap2_install_003.gif

Installing Zend Core for Oracle

Perform the following steps to obtain Zend Core for Oracle for Windows or Linux:

  1. Enter the following URL in your Web browser:

    http://www.oracle.com/technology/tech/php/zendcore/index.html
    
    
  2. To the right of the Zend Core for Oracle Web page, click the Free Download button.

    Description of chap2_zcdownload.gif follows
    Description of the illustration chap2_zcdownload.gif

  3. Save the downloaded file in a temporary directory, such as c:\tmp on Windows or \tmp on Linux.

Installing Zend Core for Oracle on Windows

This section describes how to install Zend Core for Oracle on Windows.

This tutorial is specific to PHP in Zend Core for Oracle.

For detailed setup information for Zend Core for Oracle, see the Installation Guide under Product Information on the Zend Core for Oracle Web page at

http://www.oracle.com/technology/tech/php/zendcore/index.html

This procedure assumes you downloaded the Zend Core for Oracle software to c:\tmp. If not, in Step 1 you must change to the directory that contains the downloaded software.

The file name and extraction directory are based on the current version. Throughout this procedure, ensure you use the directory name for the version you are installing.

You must be the administrator user to install Zend Core for Oracle. To install Zend Core for Oracle, perform the following steps:

  1. In Windows Explorer, go to the directory where you downloaded the Zend Core for Oracle software.

  2. To start the Zend Core for Oracle installation process, double-click the .exe file.

    Review the README file and installation documentation distributed with Zend Core for Oracle.

    Use the Tab or arrow keys, or use your mouse to move between input fields and buttons in the Zend installer. Press Enter, or click with the mouse to select a button.

  3. In the initial Zend Core for Oracle Installation page, click Next.

    Description of chap2_zcwelcome.gif follows
    Description of the illustration chap2_zcwelcome.gif

    Copyright, 2006, Zend Technologies Ltd.

  4. In the Zend Core for Oracle License Agreement page, read the license agreement. To continue with the installation, select I accept the terms of the license agreement, and click Next.

    Description of chap2_zclicence.gif follows
    Description of the illustration chap2_zclicence.gif

    Copyright, 2006, Zend Technologies Ltd.

  5. You are prompted to select the type of installation you want. Select Complete, and click Next.

    Description of chap2_zcsetup.gif follows
    Description of the illustration chap2_zcsetup.gif

    Copyright, 2006, Zend Technologies Ltd.

  6. When you are prompted to specify the location for installing Zend Core for Oracle, accept the default (or enter your preferred location), and click Next.

    Description of chap2_zclocation.gif follows
    Description of the illustration chap2_zclocation.gif

    Copyright, 2006, Zend Technologies Ltd.

  7. The next page prompts you to select the Web server for Zend Core installation. Accept the Install Bundled Apache option, and click Next.

    Description of chap2_zcapache.gif follows
    Description of the illustration chap2_zcapache.gif

    Copyright, 2006, Zend Technologies Ltd.

  8. You are then prompted to enter the port number Apache will use. Accept the default value 80, and click Next.

    Description of chap2_zcapacheport.gif follows
    Description of the illustration chap2_zcapacheport.gif

    Copyright, 2006, Zend Technologies Ltd.

  9. You are then prompted to select the Web Server API to use. Select Apache Module, and click Next.

    Description of chap2_zcwebserverapi.gif follows
    Description of the illustration chap2_zcwebserverapi.gif

    Copyright, 2006, Zend Technologies Ltd.

  10. When you are prompted to select extensions to associate with your Zend Core for Oracle installation, select all four, and click Next.

    Description of chap2_zcextensions.gif follows
    Description of the illustration chap2_zcextensions.gif

    Copyright, 2006, Zend Technologies Ltd.

  11. You are now prompted to enter a Zend Core GUI password. This password enables you to log in to the Zend Core Console to configure directives or property values.

    Enter the password you want to use to access the Zend Core Console, and click Next.

    Description of chap2_zcadminpassword.gif follows
    Description of the illustration chap2_zcadminpassword.gif

    Copyright, 2006, Zend Technologies Ltd.

  12. You can optionally enter your Zend network user ID and password to be able to use the Zend Core Console to track when updates to Zend Core and PHP components are available. If you have not registered, or do not want to track updates, select No, and click Next.

    Description of chap2_zcnetwork.gif follows
    Description of the illustration chap2_zcnetwork.gif

    Copyright, 2006, Zend Technologies Ltd.

  13. The installation wizard is now ready to begin installing Zend Core for Oracle on your computer. To start the installation wizard, click Install.

    Description of chap2_zcinstall.gif follows
    Description of the illustration chap2_zcinstall.gif

    Copyright, 2006, Zend Technologies Ltd.

  14. To complete the installation, you are prompted to restart your computer. Select Yes, I want to restart my computer now, and click Finish.

    Copyright, 2006, Zend Technologies Ltd.

    Installation is complete and Zend Core for Oracle is ready to be configured.

Installing Zend Core for Oracle on Linux

This section describes how to install Zend Core for Oracle on Linux.

This tutorial is specific to PHP in Zend Core for Oracle.

For detailed setup information for Zend Core for Oracle, see the Installation Guide under Product Information on the Zend Core for Oracle Web page at

http://www.oracle.com/technology/tech/php/zendcore/index.html

This procedure assumes you downloaded the Zend Core for Oracle software to /tmp. If not, in Step 1 you must change to the directory that contains the downloaded software.

The file name and extraction directory are based on the current version. Throughout this procedure, ensure you use the directory name for the version you are installing.

You must be the root user to install Zend Core for Oracle. Perform the following steps to install Zend Core for Oracle:

  1. Enter the following commands in a command window to extract the contents of the downloaded Zend Core for Oracle software:

    su -
    Password: <enter the root password>
    cd /tmp
    tar -zxf ZendCoreForOracle-v1.2.1-Linux-x86.tar.gz
    
    
    Description of chap2_install_012.gif follows
    Description of the illustration chap2_install_012.gif

    By default, files are extracted to a subdirectory called ZendCoreForOracle-v1.2.1-Linux-x86.

    Review the README file and installation documentation distributed with Zend Core for Oracle.

  2. To start the Zend Core for Oracle installation process, enter the following commands:

    cd ZendCoreForOracle-v1.2.1-Linux-x86
    ./install
    
    
    Description of chap2_install_013.gif follows
    Description of the illustration chap2_install_013.gif

    The install command must be executed with root user privileges. After you enter the ./install command, the installation process begins (documented in subsequent steps).

    Use the Tab or arrow keys, or use your mouse to move between input fields and buttons in the Zend installer. Press Enter or click with the mouse to select a button.

  3. In the initial Zend Core for Oracle Installation page, click OK.

    Description of chap2_install_014.gif follows
    Description of the illustration chap2_install_014.gif

    Copyright, 2006, Zend Technologies Ltd.

  4. In the Zend Core for Oracle V.1 page, read the license agreement. To continue with the installation, click Exit.

    Description of chap2_install_015.gif follows
    Description of the illustration chap2_install_015.gif

    Copyright, 2006, Zend Technologies Ltd.

  5. When you are prompted to accept the terms of the license, click Yes.

    Description of chap2_install_016.gif follows
    Description of the illustration chap2_install_016.gif

    Copyright, 2006, Zend Technologies Ltd.

  6. When you are prompted to specify the location for installing Zend Core for Oracle, accept the default (or enter your preferred location), and click OK.

    Description of chap2_install_017.gif follows
    Description of the illustration chap2_install_017.gif

    Copyright, 2006, Zend Technologies Ltd.

    The installer begins extracting the files required for the installation. The following progress screen is visible during the installation process:

    Description of chap2_install_018.gif follows
    Description of the illustration chap2_install_018.gif

    Copyright, 2006, Zend Technologies Ltd.

  7. When the progress window indicates that all the software was installed, you are prompted to Please enter the GUI password. In the Password field, enter the password you want to use to access the Zend Core Console, and click OK.

    Description of chap2_install_019.gif follows
    Description of the illustration chap2_install_019.gif

    Copyright, 2006, Zend Technologies Ltd.

    The password you specify here lets you log in to the Zend Core for Oracle administration Web pages. These pages enable you to configure Zend Core for Oracle engine directives and property values.

  8. When you are prompted to Verify the password, enter the same password that you specified in Step 7, and click OK.

    Description of chap2_install_020.gif follows
    Description of the illustration chap2_install_020.gif

    Copyright, 2006, Zend Technologies Ltd.

  9. In the Zend Core support page, you can optionally enter your Zend network user ID and password to be able to use the Zend Core Console to track when updates to Zend Core and PHP components are available. If you have not registered, or do not want to track updates, click No.

    Description of chap2_install_021.gif follows
    Description of the illustration chap2_install_021.gif

    Copyright, 2006, Zend Technologies Ltd.

  10. The next page prompts you to select the Web server for Zend Core installation. Select the default (Apache installed with Linux), and click OK.

    Description of chap2_install_022.gif follows
    Description of the illustration chap2_install_022.gif

    Copyright, 2006, Zend Technologies Ltd.

    If you choose, you can install Zend Core for Oracle with another supported Web server that is installed on your system.

  11. In the page confirming your Web server selection, you are prompted whether or not to proceed. Click Yes.

    Description of chap2_install_023.gif follows
    Description of the illustration chap2_install_023.gif

    Copyright, 2006, Zend Technologies Ltd.

  12. In the next installation page you are prompted to select an installation method for Apache 2.0.52. Select Apache module as the method, and click OK.

    Description of chap2_install_024.gif follows
    Description of the illustration chap2_install_024.gif

    Copyright, 2006, Zend Technologies Ltd.

  13. In the next installation page you are prompted to select a virtual server for the Zend Core GUI. Select Main Server, and click OK.

    Description of chap2_install_025.gif follows
    Description of the illustration chap2_install_025.gif

    Copyright, 2006, Zend Technologies Ltd.

  14. In the next installation page, you are prompted whether or not to restart the Web Server. Click Yes.

    Description of chap2_install_026.gif follows
    Description of the illustration chap2_install_026.gif

    Copyright, 2006, Zend Technologies Ltd.

  15. In the next installation page, you are asked whether or not to configure another Web Server to use Zend Core for Oracle. Click No.

    Description of chap2_install_027.gif follows
    Description of the illustration chap2_install_027.gif

    Copyright, 2006, Zend Technologies Ltd.

  16. The final installation page lists useful configuration commands and a Web page for the administration of the Zend Core engine. Take note of the information, and click EXIT.

    Description of chap2_install_028.gif follows
    Description of the illustration chap2_install_028.gif

    Copyright, 2006, Zend Technologies Ltd.

  17. When the Zend Core installation ends, the text from the final installation screen is displayed in your terminal.

    Description of chap2_install_029.gif follows
    Description of the illustration chap2_install_029.gif

    Copyright, 2006, Zend Technologies Ltd.

    Installation is complete and Zend Core for Oracle is ready to be configured.

Configuring Zend Core for Oracle

In this section, you configure environment variables and Zend Core directives that control default error reporting in Web pages.

  1. Enter the following URL in a Web browser to access the Zend Core Administration page:

    http://localhost/ZendCore/
    
    

    The Zend Core for Oracle Welcome page is displayed.

  2. Enter the GUI password that you provided during Zend Core for Oracle installation in the Password field. Click the login (>>>) icon.

    Description of chap2_zcconflog.gif follows
    Description of the illustration chap2_zcconflog.gif

    Copyright, 2006, Zend Technologies Ltd.

    The Control Center System Overview page is displayed.

  3. To display the configuration options, click the Configuration tab.

  4. To expand the Error Handling and Logging configuration entry, click the (+) icon .

  5. To enable the display of errors in the HTML script output during development, set the display_errors directive to On.

    Description of chap2_zcerrconf.gif follows
    Description of the illustration chap2_zcerrconf.gif

    Copyright, 2006, Zend Technologies Ltd.

  6. To save the configuration changes, click Save Settings.

    Because you made configuration changes, you must restart the Apache HTTP Server. Under the page header notice the "Please Restart Apache" message reminding you to do so.

  7. Click Logout to exit the Zend Core for Oracle Administration page.

  8. Restart Apache. You can either use the ApacheMonitor utility, or you can use Windows Services.

    To use the ApacheMonitor utility, navigate to the Apache bin directory and double click ApacheMonitor.exe. In a default installation, Apache bin is located at c:\Program Files\Zend\Apache2\bin.

    You can access Windows Services from the Windows Start menu at Start > Control Panel > Administrative Tools > Services. Select the Standard tab. Right click the Apache2 HTTP Server and then select Restart.

    Now that you have completed the basic configuration changes, proceed to the next section to test the Zend Core for Oracle installation.

Testing the Zend Core for Oracle Installation

To test the Zend Core for Oracle installation:

  1. Create a subdirectory called chap2. To create a directory for your application files, and to change to the newly created directory, enter the following commands in a command window:

    On Windows:

    mkdir "c:\program files\Zend\Apache2\htdocs\chap2"
    cd c:\program files\Zend\Apache2\htdocs\chap2
    
    

    On Linux:

    mkdir $HOME/public_html/chap2
    cd $HOME/public_html/chap2
    
    
    Description of chap2_test_install_002.gif follows
    Description of the illustration chap2_test_install_002.gif

    If you create files in a different location, you must change the steps for file editing and execution to match your working directory name and URL.

  2. Create a file called hello.php that contains the following HTML text:

    <?php
      echo "Hello, world!";
    ?>
    
    
  3. Open a Web browser and enter the following URL in your browser:

    On Windows:

    http://localhost/chap2/hello.php
    
    

    On Linux:

    http://localhost/~<username>/chap2/hello.php
    
    

    The line "Hello, world!" appears in the browser.

    Description of chap2_hello_001.gif follows
    Description of the illustration chap2_hello_001.gif