A step-by-step how-to guide to install, configure, and test a Linux, Apache, Informix, and PHP server
A cookbook for LAIP systems
Before you start
This article assumes the use of an RPM-based 32-bit Linux system. The steps provided have been completed on Red Hat Enterprise Linux 4 and SUSE Linux 9. However, the overall ideas can be conveyed across any Linux distribution.
Pre-installation steps
First, you need to have the Informix Dynamic Server and the Informix Software Development Kit. If you do not have these products, you can find them on the Informix product family page.
Most Linux distributions come with some or all of the LAIP components pre-installed. They are generally not installed from the source, and therefore may not have the correct extensions compiled in. In order to remove these components, and not fall into RPM trouble, you must first be logged in as root:
You can then look for all of the packages that are currently installed on your system:
You can then remove all of the packages found in the above commands:
You should now have a «clean» Linux distribution ready for component installation and setup.
Fetch and unpack the source code for all applications
- Move to a location to store all of your source code:
- Get the components you need:
The following versions of the LAIP products are used during this setup:
Product | Version |
---|---|
PHP | 5.1.2 |
Apache HTTP server | 2.2.0 |
Informix Dynamic Server (IDS) | 10.00.UC4 |
Informix Client Software Development Kit (Client SDK) | 2.90.UC4 |
Informix PHP Data Objects (PDO) | 1.0.0 |
A different version of the above products may require a different set of steps for the setup to work properly. The steps given are unique to the products above. However, the general ideas can be followed across versions.
Unpack all the source code
Install Informix and Client SDK
To install Informix onto your Linux environment, perform the following steps:
- Check if any patches are needed for your operating system. You can go to the Informix Dynamic Server page to see if any patches are needed.
- Create the Informix user and group. The Informix user acts as the root account for the Informix database. Keep this account highly secured. Creation can be done as follows (where xxxx is the password for the user Informix):
- Create the installation directory. The default location is /opt/informix. Also, the last two commands are to ensure that the directory is owned by the Informix user and group:
- Set up all the environment variables needed. The INFORMIXDIR should be the location you used to install Informix. Using the default is done as follows: Bourne Again shell (bash):
C shell (csh):
After running the script, simply follow the on-screen instructions to complete the installation of Informix. Be sure to use the /opt/informix as the installation directory. The accept license flag should only be added if you accept the Informix license.
Configure Informix and the Informix Client SDK
- Create environment files needed to bring the Informix server up and running. An .informix file is created in the home directory with the following contents: Bourne Again shell (bash):
C shell (csh):
Add your server to the sqlhosts file. The sqlhosts file is found in /opt/informix/etc. You must add the INFORMIXSERVER name given above in the environment variables to the sqlhosts file. The added line in sqlhosts should follow this format: dbservername nettype hostname servicename [options]
Here is what was added:
The port given must also be open on your system. In this example, it was opened in the /etc/services file. Here is an example of the line added to the services file:
Create the onconfig file. The onconfig file must be in the /opt/informix/etc directory. There should already be a standard onconfig file there named onconfig.std. The contents below fit the system needs for this example. You may need to add extra variables or you may not need all of the variables shown below. The onconfig file contains the following contents:
The DBSERVERNAME refers to the unique name associated with this specific database server instance. The DUMPDIR refers to the directory in which the server dumps shared memory and messages. The LOGDIR is the log directory for the IDS instance. The MSGPATH is the full path name of the message log file. The PHYSDBS is the name of the dbspce that contains the physical log. The ROOTNAME is the name for the root dbspace. The ROOTPATH is the full path name of the initial chunk of the root dbspace. The ROOTSIZE is the size of the initial chunk of the root dbspace.
- Try to bring up the server:
- Check to make sure it came up correctly by using the following command:
- If you see «shared memory not initialized for INFORMIXSERVER ‘myserver'» , then the setup did not work. However, if you see the something similar to «IBM Informix Dynamic Server Version 10.00.UC4 — On-Line — Up 00:00:07 — 19508 Kbytes» , then everything is up and working.
If you would later like to bring the server down, then the following command can be issued:
For any issues with the Informix Dynamic Server, refer to the IBM Informix Dynamic Server v10.0 Information Center for troubleshooting help.
Install and configure Apache
Follow the steps below to install Apache with support for dynamically loaded modules:
- Edit the http.conf file to process .php files correctly. The httpd.conf file can be found in /usr/local/apache/conf/httpd.conf. Look for the following lines: #AddType application/x-httpd-php .php
#AddType application/x-httpd-php-source .phps - Remove the # s from the beginning of these lines if they are found. If they are not in the file, then add them without the # s. This enables Apache to process and display php files correctly.
- You can more fully configure your Apache server by editing the httpd.conf file in /usr/local/apache/conf. There is a great deal of documentation on the Internet about this topic.
Install and configure PHP
Follow the steps below to install PHP:
- Copy the PDO_INFORMIX folder into the ext directory of PHP:
- Configure and make PHP with the PDO:
- You can now see if the PHP install went as planned. You can issue the following command:
- The output from this command should include both the PDO and the pdo_informix modules. If those are not included, then the buildconf , configure , make , or the make install commands did not go as planned.
There is the option to configure pdo_informix at a different time than PHP itself.
The entry used in this example looks like the following:
The other change needed in the php.ini file is the definition of the PDO and pdo_informix extensions. They are found in the Dynamic Extensions section in php.ini. If they were created as shared modules, you need to copy the modules into the above extension directory and enable them in the php.ini file as shown below:
Test the New Dynamic Web server
To test the New Dynamic Web server, complete the following steps:
- Start Apache. All you need to do is the following (again as root):
Open up your favorite browser and type localhost into the address bar. The default Apache start page should show. This confirms that Apache has been started.
Make sure that PHP is working with Apache. You need to edit the index.html file that is being displayed in your browser. This corresponds to where you installed Apache. The location used for this example is here: /usr/local/apache/htdocs/index.html.
Erase the index.html file and replace it with the following (named index.php):
Then when you open up the page modified (http://localhost/index.php), you should see PHP and Apache are playing nicely! . If you see the PHP code itself , then your PHP and Apache installation or configuration is flawed.
Make sure Informix is running and there is information you can query. In order to see if Informix is running, do the following:
If any processes are found, then Informix is running. If not, start Informix with the command given above. The tool Informix uses is dbaccess to create or delete databases, create or delete tables, and insert or delete data. You can run dbaccess from:
Remember to do the following:
- Add users that need access to the ‘informix’.sysauth table in the sysuser database.
- Add a new database and table with data in it to test your server’s setup.
There is documentation on the Internet if you are not familiar with dbaccess.
Check to make sure your PHP and PDO Informix setup is working correctly. You should go to your default Apache document location (/usr/local/apache/htdocs) to add a test.php file. The following is the contents of the test.php file (explained below):
The variables in the connection string fit our system’s needs. Choose the variables and their values to fit your system and environment. The first line is the connection string for the Informix database. The informix: is needed to start the connection string. The host is simply the server host name. The service is the port number opened for your database (/etc/services). The database is the name of the database you created above. The server is the name of the database instance you created earlier. The protocol type is the protocol you entered in the /etc/sqlhosts file. The rest of the options are self explanatory. The last two options to the PDO object is the username and the password. Be sure that the user has been added to the sysuser database as explained above.
When you open the Web page of test.php you should see Connection Established! and Table Contents followed by the entity contents you added to your table.
Congratulations! You have an LAIP system ready for use!
Downloadable resources
Related topics
- Red Hat Enterprise Linux Documentation: Find information regarding Red Hat Enterprise Linux.
- Informix Dynamic Server page: Find information on IDS.
- IBM Informix Dynamic Server V10.0 Information Center: Get troubleshooting help for the IBM Informix Dynamic Server V10.0.
- SUSE Linux documentation: Find SUSE Linux information.
- Apache HTTP server documentation: Find Apache HTTP server information.
- PHP documentation: Find information on PHP.
- Visit the developerWorks Informix zone to expand your Informix skills.
- Informix product family : Find out how to get Informix product downloads.
- PHP downloads: Get PHP downloads.
- Apache HTTP Server Project downloads: Get Apache HTTP Server Project downloads.
- developerWorks Information Management zone: Learn more about DB2. Find technical documentation, how-to articles, education, downloads, product information, and more.
- Build your next development project with IBM trial software, available for download directly from developerWorks.
Comments
Sign in or register to add and subscribe to comments.