Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

can I increase number of bytes in php.ini

Posted on 2014-04-07
5
Medium Priority
?
459 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 500 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 500 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 500 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 111

Assisted Solution

by:Ray Paseur
Ray Paseur earned 500 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

721 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