500 Internal Server Error

500 Internal Server Error

Abdul rahman Alarjawi -
回帖数:1


I'm trying to migrate a moodle server from host to another host . On the old server Moodle is working. i copy the moodle folder and the moodledata to the new Server and migrate  the Database and change the config.php with the new informations. if i try to open the moodle site i get this problem

-------------------------------------------------

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

-------------------------------------------------



and if i open the server error log i get Invalid command error 





-------------------------------------------------

 /home/update/public_html/moodle/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration

/home/update/public_html/moodle/.htaccess: Invalid command 'php_flag', perhaps misspelled or defined by a module not included in the server configuration

-------------------------------------------------

my .htaccess looks like



-------------------------------------------------

DirectoryIndex index.php index.html index.htm

php_value memory_limit 40M (adjust to your version of Moodle)

php_flag magic_quotes_gpc 1

php_flag magic_quotes_runtime 0

php_flag file_uploads 1

php_flag session.auto_start 0

php_flag session.bug_compat_warn 0


AcceptPathInfo on



LimitRequestBody 0

php_value upload_max_filesize 2M

php_value post_max_size 2M

-------------------------------------------------

and if a remove all php_value and php_flag  from .htaccess i get anthoer error log

-------------------------------------------------

AH01071: Got error 'PHP message: PHP Warning:  unlink(/home/update/moodledata/cache/core_component.php): Permission denied in /home/update/public_html/moodle/lib/classes/component.php on line 295PHP message: PHP Deprecated:  Array and string offset access syntax with curly braces is deprecated in /home/update/public_html/moodle/lib/weblib.php on line 2888PHP message: PHP Deprecated:  Array and string offset access syntax with curly braces is deprecated in /home/update/public_html/moodle/lib/weblib.php on line 2889PHP message: PHP Deprecated:  Array and string offset access syntax with curly braces is deprecated in /home/update/public_html/moodle/lib/weblib.php on line 2891PHP message: PHP Deprecated:  Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in /home/update/public_html/moodle/lib/deprecatedlib.php on line 3478PHP message: PHP Deprecated:  Array and string offset access syntax with curly braces is deprecated in /home/update/public_html/moodle/lib/moodlelib.php on line 5544'

-------------------------------------------------


 my PHP Version  is 7.4.33 on the old and new host


:my Server API on the old host is 

CGI/FastCGI

:and on the new host is

FPM/FastCGI


can i pls get help?

回复Abdul rahman Alarjawi

Re: 500 Internal Server Error

Leon Stringer -
Core developers的头像 Particularly helpful Moodlers的头像

You've correctly identified that the change in PHP server API is causing a problem. The new server appears to be Apache with PHP-FPM which does not support php_value and php_flag settings in .htaccess.

Most of the messages in the error log are because you have Moodle 3.5 (probably 3.5.3) which supports at most PHP 7.2. For PHP 7.4 support I recommend upgrading to Moodle 3.9.

However there's also a Permission denied error so you may need to check that the user account running PHP (possibly apache, www-data or php-fpm) has full access to Moodledata.