Allowed memory size exhausted on select from DB

Viewed 77

My situation is: I have a customer with 3 departments. All 3 are running the same (php)scripts, but have their own database.

I have a development server, a test server and a production server. On the development server and the test server everything is fine. But on the production server in 2 companies the script runs okay, but on the third I got the error:

Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes).

I brought the sript back to a single query:

SELECT *, CONCAT(land,'-',postcode,' ',plaats) AS woonplaats 
FROM bedrijven 
WHERE verwijderd='' 
AND CONCAT_WS('|', naam,toevoeging,faktuurtav,straat,postcode,plaats,telefoon,telefax,mobiel,emailadres,internet,emcpersoon,kvknummer,btwnummer,banknummer,opmerkingen) LIKE '%'

If I run the query in phpmyadmin: I got a normal result. But in the script I got the error.
Any ideas what could be the problem.

1 Answers

The error is PHP error, it caused by data size fetched from DB. Looks as data size on Dev & Test servers less then production.

To resolve the problem you have two options:

  • first - increase memory used by PHP
  • second - optimise the code to decrease data set
Related