PHP Fatal error: Out of memory (allocated 262144) (tried to allocate 17047099150164910081 bytes)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

PHP Fatal error: Out of memory (allocated 262144) (tried to allocate 17047099150164910081 bytes)

antselva
Hi All,
I'm newbie on unixODBC
I'm using php to connect to mdb access database by unixODBC.
The connection to dsn is OK
But when I try to query a select instruction,

$sql="SELECT *  FROM TableName";
$rs=odbc_exec($conn,$sql);

receive this message:

"PHP Fatal error:  Out of memory (allocated 262144) (tried to allocate 17047099150164910081 bytes)....."

But database is only 5M.
Searching on internet I have found many other person in same situation, but not found  a definitive solution.
My distribution is Debian 7 64bit (try also on Debian 7 32bit emulated by VirtualBox) - PHP 5.4.36

Thanks in advance
(sorry for my english)



Connetti gratis il mondo con la nuova indoona: hai la chat, le chiamate, le video chiamate e persino le chiamate di gruppo.
E chiami gratis anche i numeri fissi e mobili nel mondo!
Scarica subito l’app Vai su https://www.indoona.com/


_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support
Reply | Threaded
Open this post in threaded view
|

Re: PHP Fatal error: Out of memory (allocated 262144) (tried to allocate 17047099150164910081 bytes)

Michael König
Hi!

My best guess (judging from the ridiculously high number tried to allocate) is that you are using an ODBC driver which is not compatible with your version of unixODBC. unixODBC 2.2.14 onwards uses 64 bit values for variables of type SQLLEN (on 64 bit systems, I think), while earlier versions had the same SQLLEN type defined as a 32 bit integer. If you use a a driver built for unixODBC 2.2.12 with unixODBC 2.2.14, there is a good chance that the bits 33 to 64 are not properly set to 0, yielding ridiculously high values.

Long story short: Check which version of unixODBC you are using and for which version of unixODBC the driver used to access your data source was built. Use the "isql" command line tool in verbose (-v) mode with the same data source as another application. When isql shows similar errors, your PHP application is probably not the issue.

Hope this helps.

Cheers

Michael



Hi All,
I'm newbie on unixODBC
I'm using php to connect to mdb access database by unixODBC.
The connection to dsn is OK
But when I try to query a select instruction,

$sql="SELECT *  FROM TableName";
$rs=odbc_exec($conn,$sql);

receive this message:

"PHP Fatal error:  Out of memory (allocated 262144) (tried to allocate 17047099150164910081 bytes)....."

But database is only 5M.
Searching on internet I have found many other person in same situation, but not found  a definitive solution.
My distribution is Debian 7 64bit (try also on Debian 7 32bit emulated by VirtualBox) - PHP 5.4.36

Thanks in advance
(sorry for my english)



Connetti gratis il mondo con la nuova indoona: hai la chat, le chiamate, le video chiamate e persino le chiamate di gruppo.
E chiami gratis anche i numeri fissi e mobili nel mondo!
Scarica subito l’app Vai su https://www.indoona.com/



_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support


_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support
Reply | Threaded
Open this post in threaded view
|

Re: PHP Fatal error: Out of memory (allocated 262144) (tried to allocate 17047099150164910081 bytes)

Nick Gorham-2
On 12/02/15 12:45, Michael König wrote:
Hi!

My best guess (judging from the ridiculously high number tried to allocate) is that you are using an ODBC driver which is not compatible with your version of unixODBC. unixODBC 2.2.14 onwards uses 64 bit values for variables of type SQLLEN (on 64 bit systems, I think), while earlier versions had the same SQLLEN type defined as a 32 bit integer. If you use a a driver built for unixODBC 2.2.12 with unixODBC 2.2.14, there is a good chance that the bits 33 to 64 are not properly set to 0, yielding ridiculously high values.

Long story short: Check which version of unixODBC you are using and for which version of unixODBC the driver used to access your data source was built. Use the "isql" command line tool in verbose (-v) mode with the same data source as another application. When isql shows similar errors, your PHP application is probably not the issue.

Hope this helps.

Cheers

Michael

Yep, but in this case maybe not "try also on Debian 7 32bit emulated by VirtualBox". I think its more likely the driver is legitimately returning a length for a TEXT type that may be huge, and PHP is allocating a buffer for it, not noticing its a SQL_LONGVARCHAR type.

I would check you have the most up to date version of PHP (will also fix problem you may also be having that Michael mentioned).

Also, not sure what driver you are using, so I can only guess what length its returning for the field.

--
Nick

_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support
Reply | Threaded
Open this post in threaded view
|

Re: PHP Fatal error: Out of memory (allocated 262144) (tried to allocate 17047099150164910081 bytes)

antselva
Hi

Finally solved using PDO statement to connect to access mdb using ODBC driver, using same DSN
instead of odbc_exec
This works well without problems

Thanks to all

Antonio

 

On 12/02/15 12:45, Michael König wrote:
Hi!

My best guess (judging from the ridiculously high number tried to allocate) is that you are using an ODBC driver which is not compatible with your version of unixODBC. unixODBC 2.2.14 onwards uses 64 bit values for variables of type SQLLEN (on 64 bit systems, I think), while earlier versions had the same SQLLEN type defined as a 32 bit integer. If you use a a driver built for unixODBC 2.2.12 with unixODBC 2.2.14, there is a good chance that the bits 33 to 64 are not properly set to 0, yielding ridiculously high values.

Long story short: Check which version of unixODBC you are using and for which version of unixODBC the driver used to access your data source was built. Use the "isql" command line tool in verbose (-v) mode with the same data source as another application. When isql shows similar errors, your PHP application is probably not the issue.

Hope this helps.

Cheers

Michael

Yep, but in this case maybe not "try also on Debian 7 32bit emulated by VirtualBox". I think its more likely the driver is legitimately returning a length for a TEXT type that may be huge, and PHP is allocating a buffer for it, not noticing its a SQL_LONGVARCHAR type.

I would check you have the most up to date version of PHP (will also fix problem you may also be having that Michael mentioned).

Also, not sure what driver you are using, so I can only guess what length its returning for the field.

--
Nick



Connetti gratis il mondo con la nuova indoona: hai la chat, le chiamate, le video chiamate e persino le chiamate di gruppo.
E chiami gratis anche i numeri fissi e mobili nel mondo!
Scarica subito l’app Vai su https://www.indoona.com/


_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support