Re: Re: Setting Cron Job for Search
Hi.
Solving the timeout issue
Firstly, you increase the execution time, by increasing the value of MAX_EXECUTION_TIME in php.ini and then if PHP is an Apache module, you'd need to restart Apache.
This is the relevant section of PHP.INI
;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;
max_execution_time = 30 ; Maximum execution time of each script, in seconds
You wouldn't want to just make this daftly high - 5 minutes for example, so experiment with increasing it until your search script doesn't timeout (also though - see the CRON job section as you may not need to change this figure).
For me, 40 seconds is fine although since upgrading to 1.9.10.1 from 1.9.2, I get this error:
"Notice: Use of undefined constant PLUGINS_DIR - assumed 'PLUGINS_DIR' in E:\services\web\tikiwiki\lib\wiki-plugins\wikiplugin_pluginmanager.php on line 42"
If anyone knows a fix for this that'd be much appreciated - at the moment I'm not sure if the indexes are being refreshed - ie. if this is just a warning, or if the index rebuild is failing because of it.
CRON job
I'm also keen to set up the index refresh as a cron job.
When you click on the " Refresh wiki search index now" link from Admin -> Search, it links to this page which I suppose contains the code that runs the index:
http://www.yourserver.com/yourtikiwikipath/tiki-admin.php?page=search&refresh_index_now=y
So I guess a cron job would run a command that includes this URI as a parameter (unless that doc/devtools/batch_refresh_indexes_tikisearch.php file that gg mentions is available somewhere - that would be a better option).
This page shows some potential options using wget or lynx or php:
http://docs.phplist.com/CronJobExamples
With the php option, you could also maybe include the -d parameter to alter max_execution_time without changing it in php.ini and therefore making it a sitewide change.
However, this leaves the problem of authentication since you can only execute this page logged in as an admin I think.
Would be interested to know if anyone's got this working.
Cheers,
Nick.