Zend Server Installation
After posting Zend Core for Oracle to support the blog post, I figured that it would be more important to post the new Zend Server Community Edition. Basically, Zend Core for Oracle is deprecated and frozen at PHP 5.2.5. Zend Server is currently at 5.2.9 and shortly at 5.3.0, which is current release.
These are the instructions for installing Zend Server Community Edition. There’s a pre-requisite that you install Java on your computer. It requires the jvm.dll
library, which is covered in the instructions.
You can download the Java JRE or JDK and install it first. Then, you can go to Zend Corporation and download the Zend Server Community Edition.
Zend Server Community Edition Installation ↓
This section provides you with screen shots and instructions for installing a local copy of the Zend Server Community Edition. By the way, it also comes configured to support MySQL out of the box. The The Oracle connection changes with the new Zend Server. Instead of using the TNS alias from the tnsnames.ora
file, you use localhost/XE
.
- Download the Zend Server Community Edition
- This is the welcome page to Zend Server Community Edition. Click Next to install it.
- This is the license information for Zend Server Community Edition. Click Next to continue the installation.
- This gives you options about which type of installation you want. I’d recommend that you choose Full provided you don’t have MySQL already installed, but it’s your choice. If MySQL is already installed, choose Custom unless you like manually cleaning up registry keys. When you make it, click the Next button to continue.
- This lets you choose to install an Apache server if you don’t have one installed, you must do that. Click the Next button to continue.
- This is where you need to point the installation to your
jvm.dll
file. Java 6 on Windows is here:C:\Program Files\Java\jre6\bin\client
. If you’re looking atC:\Program Files\Java\jre6\bin\server
, you’re most likely looking at a JRE 64-bitjvm.dll
. If you’re on Windows x64, you need to point to:C:\Program Files\Java (x86)\jre6\bin\client
. This is because Zend Server Community Edition is a 32-bit application, and the Java Bridge depends on a 32-bit JVM. Click the Next button to continue the install.
- This screen tells you what you’re installing, all means a lot and if it’s more than you want backup and chose Custom. Click the Install button when you’re ready.
- The installation took about 5 minutes in my virtual machine. You can stretch your legs or catch up on twitter. There’s nothing on this dialog for you to do because it’ll automatically shift to another when complete.
- You’re done now. I unchecked the Desktop because they’re clutter to me. Click the Finish button to launch the new console, which is really sharp.
Verify Installation of PHP ↓
This section shows you how to verify that PHP works inside your local Apache server.
- You confirm that your Apache server is working on your local machine by typing in the following URL, which will display the image below the URL.
- After you’ve installed Zend Core for Oracle and confirmed the Apache HTTP server is running, you need to know how to use it. One of the most important things to know for a novice, is where do I put the files so that the Apache web server can find them. You put them in the Apache document root, which is defined in the
httpd.conf
file. The default location is:
- Write a PHP test program. The traditional test program consist of the following:
1 2 3 4 5 6 7 8 | <html> <head> <title>My Installation Confirmation Page</title> </head> <body> <?php phpInfo(); ?> </body> </html> |
- Save the file in your document root, or
htdocs
folder as thephpInfo.php
file.
- You can test whether program works by using the following URL in your browser. The full image represented by the cutout will appear in your browser. This confirms PHP is installed and configured in your Apache server.
Verify Oracle Connection with PHP ↓
This section shows you how to verify that you can connect to an Oracle database by using PHP.
- If you skipped the prior section, you need to know where to put your files so that the Apache web server can find them. You put them in the Apache document root, which is defined in the
httpd.conf
file. The default location is:
- You write the following PHP file to confirm that you can connect to an Oracle database. You should note that this is a change from the old connection with Zend Core for Oracle, or a generic download of PHP. The TNS alias is no longer valid by itself, because the Zend Server creates a connection pool, and routes you through that pool. You can read more about it here.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <html> <head> <title>My Oracle Connection Confirmation Page</title> </head> <body> <?php // Attempt to connect to your database. $c = @oci_connect("student", "student", "localhost/xe"); if (!$c) { print "Sorry! The connection to the database failed. Please try again later."; die(); } else { print "Congrats! You've connected to an Oracle database!"; oci_close($c); } ?> </body> </html> |
You may try to work around it by putting a fully qualified TNS string into a variable, like the following example. However, it’ll route through the connection pool.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | <html> <head> <title>My Oracle Connection Confirmation Page</title> </head> <body> <?php // Create a TNS entry in the local program. $tns = "(DESCRIPTION = (ADDRESS=(PROTOCOL = TCP)(HOST = mclaughlinxp32)(PORT = 1521)) (CONNECT_DATA=(SERVER = DEDICATED)(SERVICE_NAME = XE)))"; // Attempt to connect to your database. $c = @oci_connect("student", "student", $tns); if (!$c) { print "Sorry! The connection to the database failed. Please try again later."; die(); } else { print "Congrats! You've connected to an Oracle database!"; oci_close($c); } ?> |
- Save the file in your document root, or
htdocs
folder as theOracleConnect.php
file.
- You can test whether program works by using the following URL in your browser. You should see a success message if everything works in the rendered browser page.
Verify MySQL Connection with PHP ↓
This section shows you how to verify that you can connect to an MySQL database by using PHP.
- If you skipped the prior section, you need to know where to put your files so that the Apache web server can find them. You put them in the Apache document root, which is defined in the
httpd.conf
file. The default location is:
- You write the following PHP file to confirm that you can connect to an Oracle database.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <html> <head> <title>My MySQL Connection Confirmation Page</title> </head> <body> <?php // Attempt to connect to your database. $c = @mysqli_connect("localhost", "student", "student", "sampledb"); if (!$c) { print "Sorry! The connection to the database failed. Please try again later."; die(); } else { // Initialize a statement in the scope of the connection. print "Congrats! You've connected to a MySQL database!"; } ?> </body> </html> |
- Save the file in your document root, or
htdocs
folder as theMySQLConnect.php
file.
- You can test whether program works by using the following URL in your browser. You should see a success message if everything works in the rendered browser page.
Hope this helps you anticpate the installation.
That was very easy to follow. Thanks!
Daniel
3 Jul 09 at 6:44 pm
why cant someone view the zend server installation conveniently without it disappearring!
wale
30 Jul 09 at 10:53 am
Thanx. It cleared up some uncertainty I had with regards to choosing the correct JVM/JRE path.
Thomas
28 Oct 09 at 3:08 am
I am having trouble connecting to MySQL, I removed the “i” in the line, ” $c = @mysqli_connect(“localhost”, “student”, “student”, “sampledb”);” directly after @mysql to try to connect and it did not work, I placed it back in and it still couldn’t work, I keep receiving the “sorry…” Does the fact I connect on a different port than 3306 have any impact on the code?
Johnny
29 Mar 10 at 8:05 pm
If you’ve configured a different port number, you must provide a fifth parameter like this:
The default port is 3306, anything else must be explicitly provided in the call. You can read more about it here.
maclochlainn
29 Mar 10 at 9:26 pm
I am having trouble when we have multiple address in the tns string as shown below. Can I have some tips how to create connect to db with load_balancing enabled in tns string.
$m_dbName = ‘
(DESCRIPTION=
(ADDRESS_LIST=
(LOAD_BALANCE=ON)
(ADDRESS=(PROTOCOL=tcp)(HOST=machine1)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=machine2)(PORT=1521))
)
(CONNECT_DATA=(SERVER = DEDICATED)(SERVICE_NAME=orcl))
)
‘;
oci_connect($m_dbUser,$m_dbPass, $m_dbName);
Josephine
28 Oct 10 at 3:04 pm
I am using port 81 (port 80 is already used by heaven knows what), and I connect just fine by using localhost:81/fileNamePath.php just as a suggestion for those who cannot use the default port 80 on their computers.
Tyler
1 Apr 11 at 12:09 pm
Great help to use “$tns” when connecting (especially after reinstalling Oracle) http://127.0.0.1/OracleConnect.php. I can add that you can find HOST name in SQL*Plus:
mclaughlinxp32
I found the PORT in portlist.ini Enterprise Manager Agent Port (orcl, i.e. SERVICE NAME) = 18xx
Lars
10 Jun 11 at 7:43 am
Previous comment was possibly premature. It does not give an error message, but no connection confirmation either.
Lars
10 Jun 11 at 8:07 am
Hello,
When I try to load my index.php with oci_connect there is an error: “Encountered a problem CGI / FastCGI, and needs to close.”. The signature of error:
szAppName : php-cgi.exe szAppVer : 5.3.8.0 szModName : OraOCIICUS11.dll
szModVer : 11.2.0.1 offset : 000a8c32
What does it mean? How can I fix it?
niechzyje
21 Nov 11 at 8:13 am
Hi, please if you have tutorial to link php with oracle send me the link
5Baddi
18 Sep 17 at 7:55 am
Are you looking for an installation guide or setup guide, or simply how to connect?
maclochlainn
10 Dec 17 at 6:00 pm
[…] Before you begin these steps, you should have already installed Zend Server Community Edition. If you haven’t done so, please click here for instructions. […]
How to display PNG Files in LAMP with PHP
28 Dec 22 at 10:59 pm