# Chargement du module FastCGI à l'origine créé pour Zend (utilisable aussi pour Node.JS) LoadModule zend_enabler_module /QSYS.LIB/QHTTPSVR.LIB/QZFAST.SRVPGM # indique à Apache que tous les fichiers se terminant par .PHP # s'exécutent via FastCGI, handler "application/x-httpd-php" AddType application/x-httpd-php .php AddHandler fastcgi-script .php # si on tape uniquement le nom du site, il cherche index.php puis index.html DirectoryIndex index.php index.html |
Server type="application/x-httpd-php" CommandLine="/QOpenSys/pkgs/bin/php-cgi" StartProcesses="1" |
<?php phpinfo(); ?> |
yum install ibm-iaccess-1.1.0.11-0.ibmi7.2.ppc64.rpmIl doit apparaitre, ici :
$dsn = "DRIVER=IBM i Access ODBC Driver;SYSTEM=VOTRE -IBMi"; $user = "un-profil"; $pwd = "sonMotDepasse"; $db = odbc_connect($dsn , $user , $pwd); |
<html> <head> <title>test ODBC</title> </head> <body> <h2>connexion ODBC avec PHP RPM</h2> <?php $dsn = "DRIVER=IBM i Access ODBC Driver;SYSTEM=MONIBMi"; $user = "PHPUSER"; $pwd = "phppwd"; $db = odbc_connect($dsn , $user , $pwd); $resultat = odbc_exec($db, "select * from qiws.qcustcdt"); if ($resultat == 0) { echo ("<BR><B>Erreur " . odbc_error() . " : " . odbc_errormsg() . "</B>"); } else { $rc = odbc_fetch_row($resultat); while($rc != FALSE) { echo("<BR>"); for ($j = 1; $j <= odbc_num_fields($resultat); $j++) { if ($j <> 1) { echo(' , '); } echo(odbc_result($resultat, $j)); } $rc = odbc_fetch_row($resultat); } } ?> </body> </html> |
setlocale(LC_ALL, 'FR_FR.UTF-8') ; $dsn = "DRIVER=IBM i Access ODBC Driver;SYSTEM=MONIBMi";Par exemple sous le même shell, avec
LC_ALL=FR_FR.UTF-8
export LC_ALL
$dsn = "DRIVER=IBM i Access ODBC Driver;SYSTEM=MONIBMi;CCSID=1208;"nous obtenons alors
This is a bug in PHP. We plan to submit changes to them and work with Zend to get their version of PHP patched in the meantime.The bug is due to PHP's misuse of the return indicator from SQLGetData .
SQL_NO_TOTAL. The driver cannot determine the number of bytes of long data still available to return in an output buffer. This value is legal only for SQL data retrieved from the driver. When converting from EBCDIC to UTF-8 there is no way for the driver to determine how much data will be available to return other than temporarily converting all the data and throwing away the results. Instead of doing that work, we return SQL_NO_TOTAL, which indicates that the result is not known. SQL_NO_TOTAL has the value -4, which read as an unsigned value is huge and will cause segmentation faults ... Try adding "DEBUG=524288" to the connection string. |