Installing razorCMS – Resolving the Internal Server Error
In my last post, Introducing the razorCMS Testing Pad, I discussed this new flat-file CMS and the small website I am building as a way to test and experiment with razorCMS. I installed a barebones system with no extra bladepacks, just the basic system. In this post I will discuss my installation experience. I won’t go over all the installation details since you can find them well documented in the User Manual, which you can download here. Installation, for the most part, is a breeze. Because it’s a flat file CMS, you don’t have to worry about creating or configuring databases or anything like that. You just need to edit one file and you’re good to go. I did run into one small problem.
I followed the manual to the letter but when I tried to load my new site, I got a 500 Internal Server Error:
Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, XXXXXX@maryspad.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
I thought it might be because I was using a subdomain so I tried it on a domain but with the same result. I even tried it on a different domain at a different webhost but no go. Only then did I think to check the error log. This was the message generated:
[Wed Jul 9 11:26:38 2008] [alert] [client xx.xxx.xxx.xxx] /home/xxxxx/public_html/razor/.htaccess: Invalid command ‘php_value’, perhaps mis-spelled or defined by a module not included in the server configuration
I googled this error and did some research and this is basically what I found out. Because my webhosts both run phpsuexec, having php.ini settings within .htacess was generating the error. The answer by “taotoon” in it’s entirety can be found on this webhostingtalk forum thread:
You cannot manipulate the php.ini settings with .htaccess when running PHP as cgi/phpsuexec. If you are using .htaccess with php_value entries within it, you would receive an internal server 500 error when attempting to access the scripts. This is because PHP is no longer running as an Apache module and Apache will not handle those directives any longer. All PHP values should be removed from your .htaccess files to avoid this issue. Placing a php.ini file in its place will solve this issue. (Please see below.)
Default settings, I need Zend Optimizer or php to run with different options than the servers default settings, can I do this? The server default settings with php.ini may restrict certain applications, it is possible to modify the settings and how php will run on your account, on a per directory basis. If you have an application that requires for example :- register_globals = On Then by creating a file named php.ini within the directory that the script is located within, with the entry register_globals = On would allow you to run that script with your settings. If you also require say Zend Optimizer to be installed for your application, you would have :-
register_globals = On zend_optimizer.optimization_level=15 zend_extension=“/usr/local/Zend/lib/ZendOptimizer.so”
You may copy the other variables from the phpinfo page as they appear within it and modify the settings as required for your scripts. Some important relevant default PHP values are as follows:- register_globals = Off register_argc_argv = Off safe_mode = On magic_quotes_gpc = Off All other settings can be viewed from your server’s phpinfo.php page.
So what I did was create a blank php.ini file within my install directory /public_html/razor. I then simply found the line “php_value register_globals 0” in the .htacess file, copied and pasted it to my new php.ini file and deleted it from my .htaccess file. This worked like a charm, and I was able to complete the install in one second, delete the install.php file as instructed, change the permissions as instructed, and have my razorCMS running beautifully.