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:
http://www.webhostingtalk.com/showthread.php?t=421482
.htaccess
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.
Yeah, i’m really sorry to say this but I have come across this before on other CMS solutions, I think it total slipped my mind.
I added the register globals off setting to the htaccess file to ensure the system was ensuring a more secure environment, security is something on my mind.
I will remove this from the htaccess file for v0.2RC due in the next week, and will create a php.ini. I need to check that this works when installed as a module and when not, off the top of my head I think it does.
Thanks for your feedback, it all helps. Things like this can slip through the net then kick you in the butt when you remember them later on.
nice write up 🙂
smiffy6969
Hi
Just an update, this problem is now resolved as of v0.2RC, which, fingers crossed will be out this friday (18th July).
I have removed the setting from the .htaccess file, I will not be replacing it with a php.ini file.
I decided not to add the php.ini file this might cause other issues I don’t want to open a can of worms here, instead I will instruct users in the user manual to ensure they have this set to off, to ensure a safe environment.
By default register globals should be off, but just incase……
I have added some system checks to the admin home page, this includes version check, to instruct users when a new version of razorCMS is out, and environment check to instruct the user of the state of register globals, if set to on, it instructs you to switch it off. Hopefully this should instruct users to switch it off correctly via the master setting or by contacting there host supplier, rather than using mashed work arounds.
I think this should be enough to solve this issue.
smiffy6969
smiffy6969
Thanks for the heads up. I will install v0.2RC when it comes out and see how the install process goes. I need to visit your site so I can see what else is new in v0.2RC.
Quick question, do you think it’s worth me taking the time to test v0.1 which is what I have installed or should I scrape that and start afresh with v0.2RC? I’m thinking I’ll do the latter but wanted your input.
Go for v0.2 should be head and shoulders above v0.1, has seen a lot of bugs repaired, usefull features added……
I have just finished updating the user manual, dev notes, gonna have one last poke around before releasing tomorrow.
thanks for so much interest, much appreciated.
I think v0.2 will be around for a while, need to get some good bedding in, I am going to concentrate on blade packs for a while unless any major bugs arise.
smiffy6969
I was at my wits end trying to figure out what in the world happened to my website. I was getting an internal server error. My entire site was down from homepage to contact pages and everything in between. I tried several solutions from other sites and finally came to the point where I figured I just needed to reinstall the site completely. Then I did one more search and found your site. deleted my php file as you indicated and copied the line from my htaccess file and uploaded them both – like you said… works like a charm. Thanks for taking the time to submit this post.