Reputation: 11285
Ok, I am trying to do some work for a client. Currently we're just trying to do a kludgy fix for a custom function another developer created, which exports a CSV of all of their contacts.
As they've added more contacts, the function takes longer, and it requires more memory (we've had to up their memory limit from 128M to 256M already, and now up to 512M).
Anyway, I'm trying to run the CSV exporter, and I'm getting the following errors, on different runs:
Fatal error: Maximum execution time of 30 seconds exceeded in /home/readyby2/public_html/includes/module.inc on line 19
Fatal error: Maximum execution time of 30 seconds exceeded in /home/readyby2/public_html/sites/all/modules/contrib/views/modules/field/views_handler_field_field.inc on line 0
and every now and again I am getting an Internal Server Error 500
Note, this function HAS worked before - and I have seen it work.
Now, as far as I can tell, this means that I need to change the maximum execution time setting in php.ini.
There is a php.ini file outside of the /public_html
folder (which is where the files for the Drupal install are kept) and I've modified that setting - but still get all of the errors above. I've changed it to 60, 90, and 0, respectively, no change.
Is there anywhere else where timeout settings are set for a Drupal install? Am I finding the right php.ini file? I'm not seeing one in the /public_html
directory, or any others.
How can I solve this issue? I've already upped the memory limit (could the server error imply that there isn't enough memory available on the server to perform this function?)
Any advice or help would be useful.
As an FYI, this is in Drupal 7. PHP version is 5.x (I don't remember the exact one, think it is 5.1, can find out if necessary).
Upvotes: 0
Views: 31568
Reputation: 16061
Another options is to add the following to drupal's .htaccess
:
php_value max_execution_time 0
Upvotes: 1
Reputation: 42915
Usually the php.ini file is somewhere like /etc/php5/apache/php.ini
or similar. Maybe just /etc/php.ini
on more simple setups.
You might want to consult your software management system: $> rpm -ql php5
or the apt alternative, if you on a debian based system. That lists you the files contained in the package. The php.ini file should be amongst them. Depending on your distribution you might also have to look at the package apache-mod_php5
or similar. Search for php inside your package management, for example with $> rpm -q --whatprovides /usr/bin/php5
or $> rpm -qa | grep -i php
.
Call phpinfo()
within the drupal environment. In the output php specifies which php.ini
file has been parsed.
Upvotes: 2
Reputation: 181
You can always try (in settings.php of you sites (sites/default/settings.php) see if you got rights write it.
ini_set('memory_limit', '256M');
it's overwride php.ini. But I don't think you can fix it by increase memory(you can't increase your limit every time you got memory problem). You must find what produce this reach limit (infinite boucle, too much result...) You can always use Views module and csv export to make a good csv with a good views :D Just think to overwride pager for csv.
Upvotes: 1
Reputation: 7588
Where the correct php.ini is, is going to depend a lot on your hosting environment but you can quickly get around it by using either ini_set
or the set_time_limit
function on the script.
You can do the ini set in settings.php but then it will be global for the whole site.
ini_set('max_execution_time', 120);
to settings.php
or in your script set_time_limit ( 120 )
this doesn't work if PHP safemode is on!
Upvotes: 3