Apache start error – “DocumentRoot must be a directory”

Fix for the “DocumentRoot must be a directory” error when changing the document root from default in the apache configuration file (httpd.conf)

I was going through this error for around 10 days now. I was setting up a new linux server for test on a Red Hat Linux Enterprise Edition 5. I changed the documentroot from “/etc/httpd” to “/web/portal” and when I restarted the apache server it gave me the error saying “DocumentRoot must be a directory”. I made sure I had the permissions right on the folder and the folder existed but the error seemed to persist.

I went through many forums and then came across this post. The solution was to make sure the Security settings for the linux system were setup properly. So what was needed was to adjust the setting in the security level settings using the command system-config-securitylevel (or redhat-config-securitylevel) and then the server started without any problem.

Learning a little bit of system administration

I am learning usage of VMware to setup multiple servers on a single physical system.

After working on web development on a localhost and pushing changes to a staging then production server for a long time, now I am going to learn how to setup a developer server, staging server,  production server, database servers and other required servers on a given number of resources optimally using Virtual Machines.

Currently at work we use VMware on host systems  and run multiple servers on the same system making optimal usage of the resources. First thing I am doing is reading up on technical information about VMware here. Then I will be learning how to set ip addresses within a network and assign DNS to them. Then I will install a linux server on  one of the VM clients and setup a server etc..

I will be doing all this in my laptop and from now on instead of installing linux on a seperate partition as I have been doing for years, I will be installing it on a VM host on my laptop and will operate them from my windows like I always wanted to do (without rebooting the system).

I have played around with these virtual pc stuff in my school days but never went too deep into it. This is the time when I need to go into it deep. I am very excited to experiment with all this. I should have learned all these earlier but never mind. Its never too late to learn 🙂

jQuery ready state for DOM

Today I was trying out jQuery and trying to addClass to a p tag. I was doing it at the top of the page i.e.

{code type=’codetype’}

<head>

<script src=”jqeury.js”>

$(“p”).addClass(“selected”)

</script>

</head>

<body>

<p>Hello</p>

</body>

{/code}

This will not work because the p tag is below the jQuery code. jQuery looks for the p tag above the lines it was written in.

To overcome this problem, you can either write the above script withing  $(docment).ready(function() {}) function or write the jQuery script after the p tag was written.

i.e.

{code type=’codetype’}

<head>

<script src=”jqeury.js”>

$(document).ready(function(){

$(“p”).addClass(“selected”);

};

</script>

</head>

<body>

<p>Hello</p>

</body>

{/code}

or

{code type=’codetype’}

<head></head>

<body>

<p>Hello</p>

<script src=”jqeury.js”>

$(“p”).addClass(“selected”)

</script>

</body>

{/code}

When using the ready() function the jQuery statement is executed after the DOM has loaded completely thus allowing the p tag below the code to be found.

PHP Short Tags

My project which was written using Codeigniter framework used php short tags and I did some research and setup my localhost to work with it.

PHP short tags refer to the alternative way of writing php tags in a web script. i.e. <?= [function/variable]  ?>instead of <? php  echo [function/variable] ?>


Today while working on one my projects, I found that I needed to turn on PHP SHORT TAGS in the php.ini to make it work properly. The project uses codeigniter framework and the previous developer used php short tags in his code which was not setup on my localhost. So I enabled it by editing the php.ini file and setting the short_open_tag variable to on and then restarted the apache server and it worked.

Welcome

Hi World,

I love to share my experiences and learnings so I started blogging in 2006. Did it extensively (daily) but then suddenly got so busy with my studies that I had to indefinitely pause my blogging. I occasionally miss blogging and feel like doing it but all my blog sites have been shutdown so I tried transferring all those posts, but it takes time. Its been hard to make time to move all of them to a single location and start writing blogs again.

I hope I make time to do it in the future.

Cheers,

Ranjeesh