<p>You might try putting putting something like:</p>

<pre><code>&lt;IfModule mod_php5.c&gt;
  php_value max_execution_time "30" 
  php_value memory_limit "256M"
&lt;/IfModule&gt; 
</code></pre>

<p>inside your <code>.htaccess.</code> file. </p>

<p>You can tell what your PHP values are right inside Craft... unless you changed your admin trigger, just visit <code>http://server/admin/utils/phpinfo</code> and search for <code>memory_limit</code> and <code>max_execution_time</code>. That'll give you some clues as to what's going on.</p>

<p>Some hosts set these values really low but the <a href="http://php.net/manual/en/info.configuration.php#ini.max-execution-time" rel="nofollow">default execution time</a> is 30 and memory limit is 128M.</p>

<p>If you run PHP as a cgi, some hosts allow you to use <code>ini</code> files in lieu of .htaccess. Typically these are at the root of your home folder but they could be stored elsewhere. Put <code>memory_limit = 256M</code> in one and throw it up in your home folder. Running <code>php_info()</code> would tell you the location of the current in use one.</p>

CC BY-SA 3.0
2016-03-08T21:02:26.700Z
thanks. Tried adding to htaccess but no joy. Looking at the limits though in craft they are already set to 
max_execution_time  50000
memory_limit 120M
I have noticed that I now have a notice in the admin panel saying generating pending image transforms which doesn't seem to be moving?
Lettie
CC BY-SA 3.0
2016-03-08T21:12:58.733Z
How are you running PHP?  Craft doesn't expose that very well but it'll say ``apache2handler`` somewhere if it's running it as ``mod_php`` or ``cgi-fcgi`` if you're running it via cgi.

You may even be running nginx via PHP-FPM. (Right below cgi-fcgi it'll say php-fpm if you are running that way.)

Not all hosts support changing php_value through .htaccess.  You might have to go in via a control panel to do that or contact an admin.
RitterKnight
CC BY-SA 3.0
2016-03-08T21:14:03.327Z
I find Settings -> Clear Caches works wonders a lot too.
RitterKnight
CC BY-SA 3.0
2016-03-08T21:19:13.000Z
Yeah already tried clearing the cache. Looks like cgi-fcgi nothing else gets picked up on a find. Changing php settings via the control panel is unlikely not seen anything in there and more than likely locked down as you suggested.
Lettie
CC BY-SA 3.0
2016-03-08T21:33:24.327Z
You got one more option. Make a new file called ``php.ini``. Put ``memory_limit = 256M`` in it and throw it up in your home folder. Some hosts will use that instead of ``.htaccess``. It could be elsewhere as well. Craft doesn't expose that but if you call ``phpinfo()`` it'll show the ``loaded configuration file``. That might be a clue.
RitterKnight
CC BY-SA 3.0
2016-03-08T21:47:37.630Z
Ok cheers the php.ini has worked. Checking the phpinfo() shows the new settings. However
memory_limit = 1024M
max_execution_time = 120
And still no dice!
Lettie
CC BY-SA 3.0
2016-03-08T21:48:14.867Z
Is there a way to clear the pending image transforms?
Lettie
CC BY-SA 3.0
2016-03-08T21:51:30.747Z
See here -> https://craftcms.com/support/stuck-tasks
RitterKnight
CC BY-SA 3.0
2016-03-08T22:03:53.213Z
Cheers. Now upped to 2048M and 240 but still no joy. I'm thinking it's something in the code. Limits seem way too big now for what the script is doing!
Lettie
CC BY-SA 3.0
2016-03-09T08:25:12.603Z
Go LARGE on the memory! Through the above php.ini method, I've managed to allocate  5032000M on a shared server (kept adding zeros), before the stuck image transform process was able to succeed. (won't mention the name of the hosting Company or package) I know this sounds ridiculous but consider that if the processors are also shared then anything which the machine is trying to calculate may timeout because of processing power too. (Exactly none of our other Craft installations need this sort of thing, just the one on the almost-free shared hosting which the client insisted on)
Matt P
CC BY-SA 3.0
2016-03-11T13:50:43.643Z
Still no joy limits upped to way above suggested 5032000M and it still hangs. My thoughts now turn to the transforms are being performed within a loop on some home page slide images. The loop is over a matrix block could this be causing the issue? There are 4 slides it loops through performing the transform each time it finds the image field.
Lettie
CC BY-SA 3.0
2016-03-11T16:04:12.380Z
So you're still getting out of memory errors or is it a different error?
RitterKnight
CC BY-SA 3.0
2016-03-08T20:41:19.560Z
2016-03-08T21:55:34.857Z
2016-03-08T21:55:34.857Z
RitterKnight
<p>I'm having some issues with  when applying image transforms. Hopefully it's something obvious I'm over looking. The code is as follows:</p>

<pre><code>&lt;picture&gt;
    &lt;source media="(min-width: 401px)" srcset="{{ imageUrl.getUrl('homeBanner') }}"&gt;
    &lt;source media="(max-width: 400px)" srcset="{{ imageUrl.getUrl('iphone400x710') }}"&gt;
    &lt;source srcset="{{ imageUrl.getUrl('iphone400x710') }}"&gt;
    &lt;img src="{{ imageUrl.getUrl('iphone400x710') }}" alt="Image Desc"&gt;
&lt;/picture&gt;
</code></pre>

<p>Images uploaded are all 2000px x 1330px and the transform should crop from center to the specified size in the handle.</p>

<p>My problem is it works on my local server but once uploaded to my (shared) dev server I am getting php out of memory errors on this script </p>

<p>craft/app/vendor/imagine/imagine/lib/Imagine/Gd/Image.php on line 617</p>

<p>Am I doing something incorrectly that is causing the script to run for too long?</p>

<p>Cheers</p>

CC BY-SA 3.0
2016-03-08T18:57:08.263Z
Since you are on a shared system, the `php_execution_time` or `memory_limit` might be set lower than what you have locally. See if increasing `php_value max_execution_time` and/or `php_value memory_limit` helps.
Damon
CC BY-SA 3.0
2016-03-08T20:28:07.520Z
@damon thanks but where would I set these? I know you can add 'phpMaxMemoryLimit' => '512M', to the general config file but there doesn't seem to be anything for the other 2 you suggest?
Lettie
CC BY-SA 3.0
2016-03-08T21:15:34.613Z
Ah shoot, that would have been helpful info - sorry about that. @RitterKnight has the right stuff.
Damon
CC BY-SA 3.0
2016-03-08T21:49:05.013Z
No worries as you say @RitterKnight has been very helpful.
Lettie
<image-transforms><responsive-images>
Issues with picture and image transforms
# Issues with picture and image transforms

(Asked by: username_0 on 2016-03-08)

I'm having some issues with  when applying image transforms. Hopefully it's something obvious I'm over looking. The code is as follows:

    
    
    
    


Images uploaded are all 2000px x 1330px and the transform should crop from center to the specified size in the handle.
My problem is it works on my local server but once uploaded to my (shared) dev server I am getting php out of memory errors on this script 
craft/app/vendor/imagine/imagine/lib/Imagine/Gd/Image.php on line 617
Am I doing something incorrectly that is causing the script to run for too long?
Cheers

**Tags:** image-transforms, responsive-images

> **Comments:**
> **username_1**: Since you are on a shared system, the `php_execution_time` or `memory_limit` might be set lower than what you have locally. See if increasing `php_value max_execution_time` and/or `php_value memory_limit` helps.  
> **username_0**: @damon thanks but where would I set these? I know you can add 'phpMaxMemoryLimit' => '512M', to the general config file but there doesn't seem to be anything for the other 2 you suggest?  
> **username_1**: Ah shoot, that would have been helpful info - sorry about that. @username_2 has the right stuff.  
> **username_0**: No worries as you say @username_2 has been very helpful.  

---

## 1 answers

### Answer by username_2 on 2016-03-08. Score: 1

You might try putting putting something like:

  php_value max_execution_time "30" 
  php_value memory_limit "256M"
 

inside your .htaccess. file. 
You can tell what your PHP values are right inside Craft... unless you changed your admin trigger, just visit http://server/admin/utils/phpinfo and search for memory_limit and max_execution_time. That'll give you some clues as to what's going on.
Some hosts set these values really low but the default execution time is 30 and memory limit is 128M.
If you run PHP as a cgi, some hosts allow you to use ini files in lieu of .htaccess. Typically these are at the root of your home folder but they could be stored elsewhere. Put memory_limit = 256M in one and throw it up in your home folder. Running php_info() would tell you the location of the current in use one.

> **Comments:**
> **username_0**: thanks. Tried adding to htaccess but no joy. Looking at the limits though in craft they are already set to  max_execution_time  50000 memory_limit 120M I have noticed that I now have a notice in the admin panel saying generating pending image transforms which doesn't seem to be moving?  
> **username_2**: How are you running PHP?  Craft doesn't expose that very well but it'll say ``apache2handler`` somewhere if it's running it as ``mod_php`` or ``cgi-fcgi`` if you're running it via cgi.  You may even be running nginx via PHP-FPM. (Right below cgi-fcgi it'll say php-fpm if you are running that way.)  Not all hosts support changing php_value through .htaccess.  You might have to go in via a control panel to do that or contact an admin.  
> **username_2**: I find Settings -> Clear Caches works wonders a lot too.  
> **username_0**: Yeah already tried clearing the cache. Looks like cgi-fcgi nothing else gets picked up on a find. Changing php settings via the control panel is unlikely not seen anything in there and more than likely locked down as you suggested.  
> **username_2**: You got one more option. Make a new file called ``php.ini``. Put ``memory_limit = 256M`` in it and throw it up in your home folder. Some hosts will use that instead of ``.htaccess``. It could be elsewhere as well. Craft doesn't expose that but if you call ``phpinfo()`` it'll show the ``loaded configuration file``. That might be a clue.  
> **username_0**: Ok cheers the php.ini has worked. Checking the phpinfo() shows the new settings. However memory_limit = 1024M max_execution_time = 120 And still no dice!  
> **username_0**: Is there a way to clear the pending image transforms?  
> **username_2**: See here -> https://craftcms.com/support/stuck-tasks  
> **username_0**: Cheers. Now upped to 2048M and 240 but still no joy. I'm thinking it's something in the code. Limits seem way too big now for what the script is doing!  
> **username_3**: Go LARGE on the memory! Through the above php.ini method, I've managed to allocate  5032000M on a shared server (kept adding zeros), before the stuck image transform process was able to succeed. (won't mention the name of the hosting Company or package) I know this sounds ridiculous but consider that if the processors are also shared then anything which the machine is trying to calculate may timeout because of processing power too. (Exactly none of our other Craft installations need this sort of thing, just the one on the almost-free shared hosting which the client insisted on)  
> **username_0**: Still no joy limits upped to way above suggested 5032000M and it still hangs. My thoughts now turn to the transforms are being performed within a loop on some home page slide images. The loop is over a matrix block could this be causing the issue? There are 4 slides it loops through performing the transform each time it finds the image field.  
> **username_2**: So you're still getting out of memory errors or is it a different error?  

---

