Solved

can I increase number of bytes in php.ini

Posted on 2014-04-07
5
451 Views
Last Modified: 2014-04-07
running a content management system (many php files)
script raise error E_ERROR with messgae "allowed memory size of 134217728 bytes exhausted (tried to allocate 190464 bytes) at file.php line 933
Execution can not continue.


Is this a php.ini change
0
Comment
Question by:rgb192
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 36

Assisted Solution

by:Loganathan Natarajan
Loganathan Natarajan earned 125 total points
ID: 39982841
What is the name of CMS ? is it Wordpress or Joomla?  Also what is the value of "memory_limit" in your php.ini ? I guess this needs to be increased as per the initial value? Normally it can be "128M"
0
 
LVL 40

Accepted Solution

by:
Richard Quadling earned 125 total points
ID: 39982843
Yes it is. For example:

memory_limit = 1G

See http://www.php.net/manual/en/ini.core.php#ini.memory-limit for more details.

You can also add ...

ini_set('memory_limit', '1G');

in your code.

You can use the shorthand (K, M, G) or the full number.

1G = 1 gigabyte. A LOT of memory for a PHP script.

You may be better off refactoring the code into separate processes, or not trying to process all the data at once.

Can you give some idea of what the script/process is doing?
0
 
LVL 27

Assisted Solution

by:MacroShadow
MacroShadow earned 125 total points
ID: 39982849
There is a problem with the script, perhaps a loop gone wild, opening and reading a very large text file etc.

While there are simple solutions, your best bet would be to find the hole and plug it rather than build a bridge over it.

If you do want a workaround, you can try any of the following methods:

1. ini_set('memory_limit', '-1'); NOT recommended, it may potentially leave your server open to malicious attacks via large data posts.
2. Increase your maximum memory limit to 64MB in your php.ini file (memory_limit = 64M ; Maximum amount of memory a script may consume (64MB))
3.  Add this to an .htaccess file: php_value memory_limit 64M
0
 
LVL 110

Assisted Solution

by:Ray Paseur
Ray Paseur earned 125 total points
ID: 39982869
There are many ways to raise the memory size, but rarely are there reasons to do so.  It might be better to examine line 933 of file.php, and it surrounding code, to determine why this error is occurring.  Some possible issues:

1. Conversion of a string into an array or object with many properties, such as might be generated by explode().  PHP arrays and objects are very large data structures.

2. Reading a large file with file() or file_get_contents().

3. Fetching the results of a SELECT query that had no LIMIT clause.

4. An unterminated loop caused by a program logic error.
0
 

Author Closing Comment

by:rgb192
ID: 39983084
ini set or php.ini

both work: I used php.ini

thanks
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question