Solved

can I increase number of bytes in php.ini

Posted on 2014-04-07
5
446 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
This article discusses how to implement server side field validation and display customized error messages to the client.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

734 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