|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2017-07-31 21:59 UTC] ymtene at gmail dot com
Description:
------------
I have problems executing a sql statement from php7 to a db2 database, here are my configuration data and error:
PHP version:
PHP 7.1.7 (cli) (built: Jul 6 2017 12:10:28) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.1.7, Copyright (c) 1999-2017, by Zend Technologies
UNIXODBC version:
unixODBC-2.3.1-11.el7.x86_64
iSeriessAccess version:
iSeriesAccess-7.1.0-1.0.x86_64
ERROR:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 140325171494924 bytes) in /var/www/html/test.php on line 19
I try set more memory on php.ini but not work.
Also, I try with set ini_set('memory_limit', '-1'); and dont work.
What can I do to make it work? Any suggestion? I have the same installation in php5.4 and it works perfect, but now I need run it on php7.
---
From manual page: http://www.php.net/index
---
Test script:
---------------
<?php
//Datos para conexión a db2//
$as_username="username";
$as_password="passwd";
$bd = "ANYDB";
$as_dsn ="DRIVER=iSeries Access ODBC Driver 64-bit;SYSTEM=x.x.x.x;DBQ=$bd";
$as_conn = odbc_connect ($as_dsn, $as_username, $as_password);
if (!$as_conn) {
echo "No existe conexión a la base de datos."; // Error message
}else{
$cadena_sql= "SELECT CAMPO FROM $db.TABLA";
$result = odbc_exec($as_conn,$cadena_sql); //Problem to execute
if ($persona=odbc_fetch_array($result,'')){
...
}else{
...
}
}
?>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 18:00:01 2025 UTC |
This issue also happens to me, but I happen to connect to an MDB (Access) database. PHP version: PHP 7.1.4 (cli) (built: Apr 25 2017 03:23:01) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethans with Zend OPcache v7.1.4, Copyright (c) 1999-2017, by Zend Technologies Other versions libodbc1: 2.3.1-3 unixodbc: 2.3.1-3 unixodbc-dev: 2.3.1-3 libmdbodbc1: 0.7.1-2 I'm able to reproduce it with the following MDB (both tables in it): http://www.rogersaccesslibrary.com/download3.asp?SampleName=Books.mdb Error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 139968689209376 bytes It might have to do with some field type though. I am able to read some of my tables. I have one table in my MDB with just 2 text columns and that one reads fine.Relevant test code: <?php $connection = odbc_connect("Driver=MDBTools;DBQ=/var/www/accessdb/Books_be.mdb", '', ''); $result = odbc_exec($connection, "SELECT * FROM Authors"); while (odbc_fetch_row($result)) { for ($i = 1; $i <= odbc_num_fields($result); $i++) { echo "Result is " . odbc_result($result, $i); } }Hi! i have same problem ODBC 64 BITS PHP 7.3 the error occurs when I use prepare and execute $conn = odbc_connect("Driver={IBM INFORMIX ODBC DRIVER (64-bit)}; Server=SERVERNAME; Database=MYDB;","userdb", "pwdhash"); if (!($conn)) { echo "<p>Connection to DB via ODBC failed: "; echo odbc_errormsg ($conn ); echo "</p>\n"; } $sql = "SELECT FIRST 1 * FROM test"; $rs = odbc_exec($conn,$sql); //problem here odbc_result_all($rs);Hello again, i am using xampp, php 7.4 Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 2731599200272 bytes) in C:\xampp\htdocs\test.php on line 11 $conn = odbc_connect("Driver={IBM INFORMIX ODBC DRIVER (64-bit)}; Server=nameserver; Database=namedb;","userdb", "pwddb") or exit('Cannot open with dns.'); if (!$conn) { exit("Connection Failed: " . $conn); } $sql = 'SELECT FIRST 1 * FROM test;'; $rs = odbc_exec($conn, $sql); //Fatal error: if (!$rs) { exit("Error in SQL"); } odbc_result_all($rs);