I have several installations of moodle in my server and i've configured the cron script to backup all the courses at night. My problem is that several courses fail and i've noticed that it could be because of the time limits of apache and php. I modified it in global configurations with grearter values and it worked well but i can put these values to work always in this way because the performance of the server decreases. So i've tested with a .htaccess file in backup directory with these values and testing it with manual cron and it works fine and fast, but it fails again with the server cron. It seems that manually cron get the new values for everything is executed inside this directory but when it is automatic.
The .htaccess is like:
php_value max_execution_time 500
php_value max_input_time 500
php_value memory_limit 500M
Can anyone tell me any idea to solve this problem? Thanks in advance.
.htaccess files are only used when accessing Moodle through Apache. If you are running your cron jobs using the command line PHP executable, those settings won't be used obviously.
If you are running your cron jobs from the command line, you can set those values using something like:
php -d max_execution_time=500 -d max_input_time=500 -d memory_limit=500M -f /path/to/your/admin/cron.php
I use a line like this in the file /etc/cron.d/moodle:
*/5 * * * * nobody wget -q -O /dev/null URL/admin/cron.php
so, i'm running cron.php through Apache, isn't it? I'll test your suggestion anyway. It's strange that the configuration of the .htaccess file manually works but automatically.
And with the .htaccess i get another problem: apache instances are greater in memory (60mb) than without it (20-25mb) and the server performance decreases.
Saludos and have a nice day!