Installing and upgrading help

php_flag in .htaccess causes error 500

 
Picture of Peter Troxler
php_flag in .htaccess causes error 500
 
Out of a sudden -- after weeks of successfully running moodle -- i get this error (wich eventually is an error 500)

[alert] [client 66.119.34.39] /home/knwldg/public_html/e-dln/.htaccess: Invalid command 'php_flag', perhaps mis-spelled or defined by a module not included in the server configuration

the server runs php 4.3.3

any ideas?

/ Peter


 
Average of ratings: -
David Delgado: CLO. Senior Expert in E-learning since 1997
Re: php_flag in .htaccess causes error 500
 
Perhaps PHP is not running as an Apache module, but as a CGI program. In this case, you cannot change PHP variables in a .htaccess file, since PHP is just an external program for Apache. I have seen that before.

You can check that creating a single phpinfo.php file with just this text:

<?php phpinfo(); ?>


Among the first lines, you will see one starting by Server API. If it is FastCGI/CGI PHP is not an Apache module, but an external CGI program and that is the problem you are facing. If it is Apache, PHP is an Apache module and there must be another cause.

Anyway, I have found nothing but problems having PHP as a CGI program. I recomend you to avoid it and make it run as an Apache module. One curious thing is that this mode only allows $CFG->dbpersist = false; in your config.php in order to run Moodle properly.

Anyway, if it happened suddently, and you had the php_flag lines working fine before in your .htaccess, you should try the first old, easy trick: just restart apache and pray. wink If it does not work try the second old, nasty trick: what was the last change you did before you Moodle stopped working? It is very likely that this was the cause, just undo that change. smile

Hope this helps.
 
Average of ratings: -
Picture of Peter Troxler
Re: php_flag in .htaccess causes error 500
 
Thanks

Server API is CGI -- so it probably has to do with what your first suggestion is.
(see http://www.knwldg.net/phpinfo.php)

The trouble is I do not run it on a server where I could restart apache & pray sad I have to ask my support & pray ....

And the last thing I did to Moodle was all via the Moodle interface, (posting messages and uploading files). This should hardly affect .htaccess and php_flag lines ?

/ Peter
 
Average of ratings: -
Martin Dougiamas
Re: php_flag in .htaccess causes error 500
Core developersDocumentation writersMoodle HQPlugin developersTesters
You should ask your host to sort this out - it's probably some change they made recently to the PHP setup.  I notice the build date of the PHP is November 7...
 
Average of ratings: -
David Delgado: CLO. Senior Expert in E-learning since 1997
Re: php_flag in .htaccess causes error 500
 
Anyway, just removing the php_flag and php_value sentences from your .htaccess could solve your problem. It is very likely that those PHP options are set by default and that your Moodle server would run properly without them in your .htaccess file. You could even delete or rename your .htacces file and I guess your Moodle would still work (mine did). Just try and tell us if this solves your problem. smile
 
Average of ratings: -
Picture of Peter Troxler
Re: php_flag in .htaccess causes error 500
 
David -- many thanks!

This seems to have done the job.

I was considering commenting the php_flag statements out but didn't dare since I'm not into php had no idea whether this would cause any harm. After your reassuring words I tried & the site is running again and Moodle seems to work fine.

/ Peter
 
Average of ratings: -