|
Informix FunctionsThe Informix driver for Informix (IDS) 7.x, SE 7.x, Universal Server (IUS) 9.x and IDS 2000 is implemented in "ifx.ec" and "php3_ifx.h" in the informix extension directory. IDS 7.x support is fairly complete, with full support for BYTE and TEXT columns. IUS 9.x support is partly finished: the new data types are there, but SLOB and CLOB support is still under construction.
Note:
This extension has been moved to the » PECL repository and is no longer bundled with PHP as of PHP 5.2.1.
Configuration notes:
You need a version of ESQL/C to compile the PHP Informix driver. ESQL/C versions from 7.2x on should be OK. ESQL/C is now part of the Informix Client SDK. Make sure that the "INFORMIXDIR" variable has been set, and that $INFORMIXDIR/bin is in your PATH before you run the "configure" script.
To be able to use the functions defined in this module you must compile
your PHP interpreter using the configure line
The behaviour of these functions is affected by settings in
Note:
Make sure that the Informix environment variables INFORMIXDIR and INFORMIXSERVER are available to the PHP ifx driver, and that the INFORMIX bin directory is in the PATH. Check this by running a script that contains a call to phpinfo() before you start testing. The phpinfo() output should list these environment variables. This is true for both CGI php and Apache mod_php. You may have to set these environment variables in your Apache startup script. The Informix shared libraries should also be available to the loader (check LD_LIBRARY_PATH or ld.so.conf/ldconfig).
Some notes on the use of BLOBs (TEXT and BYTE columns)
:
BLOBs are normally addressed by BLOB identifiers. Select queries return a "blob id" for every BYTE and TEXT column. You can get at the contents with "string_var = ifx_get_blob($blob_id);" if you choose to get the BLOBs in memory (with: "ifx_blobinfile(0);"). If you prefer to receive the content of BLOB columns in a file, use "ifx_blobinfile(1);", and "ifx_get_blob($blob_id);" will get you the filename. Use normal file I/O to get at the blob contents. For insert/update queries you must create these "blob id's" yourself with "ifx_create_blob();". You then plug the blob id's into an array, and replace the blob columns with a question mark (?) in the query string. For updates/inserts, you are responsible for setting the blob contents with ifx_update_blob(). The behaviour of BLOB columns can be altered by configuration variables that also can be set at runtime: configuration variable: ifx.textasvarchar configuration variable: ifx.byteasvarchar runtime functions: ifx_textasvarchar(0): use blob id's for select queries with TEXT columns ifx_byteasvarchar(0): use blob id's for select queries with BYTE columns ifx_textasvarchar(1): return TEXT columns as if they were VARCHAR columns, so that you don't need to use blob id's for select queries. ifx_byteasvarchar(1): return BYTE columns as if they were VARCHAR columns, so that you don't need to use blob id's for select queries. configuration variable: ifx.blobinfile runtime function: ifx_blobinfile_mode(0): return BYTE columns in memory, the blob id lets you get at the contents. ifx_blobinfile_mode(1): return BYTE columns in a file, the blob id lets you get at the file name. If you set ifx_text/byteasvarchar to 1, you can use TEXT and BYTE columns in select queries just like normal (but rather long) VARCHAR fields. Since all strings are "counted" in PHP, this remains "binary safe". It is up to you to handle this correctly. The returned data can contain anything, you are responsible for the contents. If you set ifx_blobinfile to 1, use the file name returned by ifx_get_blob(..) to get at the blob contents. Note that in this case YOU ARE RESPONSIBLE FOR DELETING THE TEMPORARY FILES CREATED BY INFORMIX when fetching the row. Every new row fetched will create new temporary files for every BYTE column. The location of the temporary files can be influenced by the environment variable "blobdir", default is "." (the current directory). Something like: putenv(blobdir=tmpblob"); will ease the cleaning up of temp files accidentally left behind (their names all start with "blb").
Automatically trimming "char" (SQLCHAR and SQLNCHAR) data:
This can be set with the configuration variable ifx.charasvarchar: if set to 1 trailing spaces will be automatically trimmed, to save you some "chopping". NULL values:
The configuration variable ifx.nullformat (and the runtime
function ifx_nullformat()) when set to Table 150. Informix configuration options
Here's a short explanation of the configuration directives.
The constants below are defined by this extension, and will only be available when the extension has either been compiled into PHP or dynamically loaded at runtime.
Table of Contents
Code Examples / Notes » ref.ifxrobernet
Verify with phpinfo() that you have informix module compiled in php. Also verify that env vars INFORMIXDIR, INFORMIXSERVER, LD_LIBRARY_PATH are set, and that PATH have a route to your informix subdir. roger
Unfortunately the informix extension has been moved to PECL but has no maintainer. http://devzone.zend.com/node/view/id/1621#Heading11 In practic terms, it has been moved but is not available in PECL yet. It's sad. I have a big client who uses this extension for more than 6 years and now has to change a code base of 500,000 lines of code or install an old version of PHP in the new server. They recently bought a redundant, double cpu, 8 gb ram, scsi disk server and will not be happy to run old versions of software with unmaintained extensions. markroedel
There's also a FreeBSD version of the client libraries that'll work with PHP. It's not available for download from their website, but you can request a copy (cd or electronic delivery) by calling Informix Customer Support at 1-800-274-8184 option 3. Some customer service reps know more about alternative operating systems than others, so you may have to do a bit of educating before they can locate the product in their database, but it's definitely there. My e-mail confirmation referred to it as "Orderable Part Number 100-15871-204057-1", although that number may be specific to the electronically-delivered edition. howy
One very frustrating experience with interfacing Informix and unixODBC (on RHEL4 - PHP 5.20) was the constant Informix error: [SQLSTATE=IX 001 SQLCODE=-1829] Unable to load locale categories & the non existant handles from unixODBC calls. This is an issue of the environment being set correctly which I thought was - phpinfo() reported that the apache environment was correct <_server=> I even went as far as to Put/Setenv in httpd.conf. The hint is in the php 'environment' block - it did not contain the env strings. The fix was to insert the environment strings in the httpd start-up script (/etc/init.d/httpd) which pushed the environment correctly when the server starts up. Hope to save someone else the hours.... ian mcmurray
Installation on RedHat Fedore Core (or in that matter any Linux OS which has a version of glibc of 2.3.* ~or above~) will need to have the latest Informix CSDK (downloadable from IBM). 2.90.UC1.LINUX at the time of this post. http://www-306.ibm.com/software/data/informix/tools/connect/ I was unable to make PHP with v2.80 of the csdk (as it complained about mktemp being dangerous and how ctype was undefined. After downloading csdk 2.90, I was able to make PHP with no problems at all. (--with-informix). There goes 2 days of my life! Feel free to drop me an email at ian_at_devtonic_dot_com if you have any questions. isaac dot hopley
If you are tring to access an Informix Online 5.x server over the network (ie from a webserver) using PHP, be aware that Online doesn't support network communications as standard unlike later versions. You need the Informix product 'I-Star' on your Online server. This will allow your webserver with the informix client SDK installed to communicate natively (ESQL). Thanks go to Mario @ PRS for this info. cornecnospam
I upgraded to csdk-2.70.UC3-1 and got the following error when trying to start apache: Syntax error on line 205 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/libexec/libphp4.so into server: /opt/informix/lib/esql/libifgen.so: undefined symbol: stat /usr/local/apache/bin/apachectl start: httpd could not be started This machine has glibc 2.3.5 The following fixed the problem for me (surely there's a better fix) but i'm not sure how it might affect other programs linked to libifgen mkdir /tmp/ifx cd /tmp/ifx ar x $INFORMIXDIR/lib/esql/libifgen.a gcc -shared -o libifgen.so *.o cp libifgen.so $INFORMIXDIR/lib/esql drsound
I just wrote a mini-HOWTO about adding Informix support to mod_php running on a Gentoo Linux server (x86). I wanted to post it here but it was too long. You can find it on http://forums.gentoo.org/viewtopic.php?t=245249 (just in case for some reason they change the thread number, the title is "HOWTO: PHP Informix client support").
programacion
I have compile php-4.0.6 with informix support (dynamic) and when I try to start apache, it gives me this error message: Syntax error on line 246 of /etc/httpd/httpd.conf: Cannot load /usr/lib/apache/libphp4.so into server: /home/informix7/lib/esql/lib ifgen.so: undefined symbol: stat /usr/sbin/apachectl start: httpd could not be started old dot wolf
An intermittent SQL error -25580 is caused by using the wrong glibc version in Linux. I have this working correctly in Linux (x86) with Informix Client SDK for 2.70UC-1 for Linux, with glibc 2.1.3. Originally I had glibc 2.1.1 (Red Hat 6), which gave the intermittent error, but upgrading glibc fixed it. The Informix Client SDKs can be downloaded from www.informix.com (you need to own an Informix database to log on), and glibc is at ftp://ftp.gnu.org/gnu/glibc . jeff
add the following to /etc/profile (right before unset i (adjust to your needs) export INFORMIXDIR=/opt/informix export ODBCINI=/usr/local/etc/odbc.ini export INFORMIXSERVER=m_srv then add the following to your httpd.conf PassEnv INFORMIXDIR PassEnv ODBCINI PassEnv INFORMIXSERVER (or you can use SetEnv SetEnv INFORMIXDIR /opt/informix etc.) |
Change Language.NET Functions Apache-specific Functions Alternative PHP Cache Advanced PHP debugger Array Functions Aspell functions [deprecated] BBCode Functions BCMath Arbitrary Precision Mathematics Functions PHP bytecode Compiler Bzip2 Compression Functions Calendar Functions CCVS API Functions [deprecated] Class/Object Functions Classkit Functions ClibPDF Functions [deprecated] COM and .Net (Windows) Crack Functions Character Type Functions CURL Cybercash Payment Functions Credit Mutuel CyberMUT functions Cyrus IMAP administration Functions Date and Time Functions DB++ Functions Database (dbm-style) Abstraction Layer Functions dBase Functions DBM Functions [deprecated] dbx Functions Direct IO Functions Directory Functions DOM Functions DOM XML Functions enchant Functions Error Handling and Logging Functions Exif Functions Expect Functions File Alteration Monitor Functions Forms Data Format Functions Fileinfo Functions filePro Functions Filesystem Functions Filter Functions Firebird/InterBase Functions Firebird/Interbase Functions (PDO_FIREBIRD) FriBiDi Functions FrontBase Functions FTP Functions Function Handling Functions GeoIP Functions Gettext Functions GMP Functions gnupg Functions Net_Gopher Haru PDF Functions hash Functions HTTP Hyperwave Functions Hyperwave API Functions i18n Functions IBM Functions (PDO_IBM) IBM DB2 iconv Functions ID3 Functions IIS Administration Functions Image Functions Imagick Image Library IMAP Informix Functions Informix Functions (PDO_INFORMIX) Ingres II Functions IRC Gateway Functions PHP / Java Integration JSON Functions KADM5 LDAP Functions libxml Functions Lotus Notes Functions LZF Functions Mail Functions Mailparse Functions Mathematical Functions MaxDB PHP Extension MCAL Functions Mcrypt Encryption Functions MCVE (Monetra) Payment Functions Memcache Functions Mhash Functions Mimetype Functions Ming functions for Flash Miscellaneous Functions mnoGoSearch Functions Microsoft SQL Server Functions Microsoft SQL Server and Sybase Functions (PDO_DBLIB) Mohawk Software Session Handler Functions mSQL Functions Multibyte String Functions muscat Functions MySQL Functions MySQL Functions (PDO_MYSQL) MySQL Improved Extension Ncurses Terminal Screen Control Functions Network Functions Newt Functions NSAPI-specific Functions Object Aggregation/Composition Functions Object property and method call overloading Oracle Functions ODBC Functions (Unified) ODBC and DB2 Functions (PDO_ODBC) oggvorbis OpenAL Audio Bindings OpenSSL Functions Oracle Functions [deprecated] Oracle Functions (PDO_OCI) Output Control Functions Ovrimos SQL Functions Paradox File Access Parsekit Functions Process Control Functions Regular Expression Functions (Perl-Compatible) PDF Functions PDO Functions Phar archive stream and classes PHP Options&Information POSIX Functions Regular Expression Functions (POSIX Extended) PostgreSQL Functions PostgreSQL Functions (PDO_PGSQL) Printer Functions Program Execution Functions PostScript document creation Pspell Functions qtdom Functions Radius Rar Functions GNU Readline GNU Recode Functions RPM Header Reading Functions runkit Functions SAM - Simple Asynchronous Messaging Satellite CORBA client extension [deprecated] SCA Functions SDO Functions SDO XML Data Access Service Functions SDO Relational Data Access Service Functions Semaphore SESAM Database Functions PostgreSQL Session Save Handler Session Handling Functions Shared Memory Functions SimpleXML functions SNMP Functions SOAP Functions Socket Functions Standard PHP Library (SPL) Functions SQLite Functions SQLite Functions (PDO_SQLITE) Secure Shell2 Functions Statistics Functions Stream Functions String Functions Subversion Functions Shockwave Flash Functions Swish Functions Sybase Functions TCP Wrappers Functions Tidy Functions Tokenizer Functions Unicode Functions URL Functions Variable Handling Functions Verisign Payflow Pro Functions vpopmail Functions W32api Functions WDDX Functions win32ps Functions win32service Functions xattr Functions xdiff Functions XML Parser Functions XML-RPC Functions XMLReader functions XMLWriter Functions XSL functions XSLT Functions YAZ Functions YP/NIS Functions Zip File Functions Zlib Compression Functions |