Install PDO INFORMIX On Linux (Centos)
Install PDO INFORMIX On Linux (Centos)
Locate yourself in
any folder where you want the software to be downloaded, and type the following command:
• wgethttp://www.pecl.php.net/get/PDO_INFORMIX-1.0.0.tgz
• The previous command downloaded the PDO_IN file.
FORMIX-1.0.0.tgz, now you need to decompress it like this:
extract PDO_INFORMIX-1.0.0.tgz
• Now we need to compile the pdo_informix, for that we need the PHPIZE, to see if
it is installed, enter the pdo_informix folder (cd
(pdo_informix) and just type phpize, if it indicates that it's not installed, then
you need to install the development tools, with the following command:
yum install php-devel
• Now yes, let's compile the pdo_informix, inside the pdo_informix folder, type the
following commands:
• phpize
• ./configure
• make
• make install
• Look for pdo_informix.so inside the modules folder of your current path, and
paste it in /usr/lib/php/modules (if it doesn't exist already).
Up to this point, we are supposed to have the software installed, we are missing the configuration of
environment variables, php, services, hosts, etc., the following must be done:
Environment variables:
PROFILE /etc/profile
extension=pdo_informix.so
Local services
aplicaexec 1526/tcp
sqlexec2 1527/tcp
instanceNameOnOctTcpIpOfYourSqlServerEc2
instance name on TCP/IP of your application server exec
instance name, is the name of the instance you will connect to in Informix.
onsoctcp is the protocol
sqlexec2 is the name of the service in linux (/etc/services)
for this you can create a file with the following content:
nano configuration.php
phpinfo();
?>
Run it from a browser and look for the PDO section, it should appear like this:
PDO drivers => informix, mysql, odbc, sqlite
pdo_informix
enabled
In the Environment section, the environment variable INFORMIXDIR should appear like this:
Environment Section
/opt/IBM/informix
THROUBLESHOOTING
Lastly, keep this in mind, as if it fails to connect, it will commonly display the error:
This error is due to differences in your configuration, take into account the
next text:
Troubleshooting
The ifx_* function set also relies on the correct settings in environment variables.
and the configuration file for Informix SDK, so there are several sources for
problems in the first attempt to connect to the Informix IDS database server. We
list some of the most common mistakes causing connectivity problems. You may
notice that the error message shows twice in the output of our examples. The
The first message comes from the connect function for which we did not disable the.
error display. The second one is from the error caption. For a detailed discussion
about error management, refer to Section 5.2.7, “Error handling” on page 311.
Environment variables for Informix products are necessary to enable the client to
find the database server. Example 5-23 and Example 5-24 show the error
messages when the environment for the client is set improperly. Here we used
the PHP command line utility to generate the output. The browser would
generate similar results.
Example 5-23 Missing INFORMIXDIR in the Apache environment
/usr/local/bin/php ifxconnect.php
Warning: ifx_connect(): E [SQLSTATE=IX 001 SQLCODE=-1829] in
/usr/local/apache2/htdocs/ifxconnect.php on line 3
Example 5-24 Missing INFORMIXSERVER in the Apache environment
/usr/local/bin/php ifxconnect.php
Warning: ifx_connect(): E [SQLSTATE=IX 000 SQLCODE=-25560] in
/usr/local/apache2/htdocs/ifx/connect/ifxconnect.php on line 3
Connect: Returncode E [SQLSTATE=IX 000 SQLCODE=-25560] -- Environment
The variable INFORMIXSERVER must be set.
After setting the right environment variables, we have to take into account that
we are working in a client-server architecture. So the user running the PHP script
has to be authenticated at the database server machine for using the server. In
Example 5-25, the connection is attempting to connect with the wrong password.
which will certainly generate an error message.
Example 5-25 User connection password is wrong
/usr/local/bin/php ifxconnect.php
Warning: ifx_connect(): E [SQLSTATE=IX 000 SQLCODE=-952] in
/usr/local/apache2/htdocs/ifx/connect/ifxconnect.php on line 3
Connect: Returncode E [SQLSTATE=IX 000 SQLCODE=-952] -- User
([email protected])'s password is not correct for the
database server.
Verify the following if all necessary Informix environment variables are set in the
Apache environment is verified with phpinfo() and you still receive an error.
message as shown below:
/usr/local/bin/php ifxconnect.php
/usr/local/bin/php: error while loading shared libraries: libifsql.so
cannot open shared object file: No such file or directory
1. Does the library exist? If not, check the installation.
2. Does the user informix have the authority to run /usr/local/bin/php
If not, check permissions in the installation directory.
Are there other users getting similar errors such as this?
In this case, check the permissions of the installation path. One of the
directories above the SDK installation directory may not have read
permissions for public. A typical scenario is the installation in the home
directory of the informix user in Red Hat. The home directories have
rwx------ as default permissions.
Bibliography :
• The provided text is a URL and cannot be translated.
• Developing PHP Applications for IBM Data Servers, on the page
(Book)