in reply to this program is not running in apache web server

You should discover that the opendir call is failing. Unless the security of your web server is horribly messed up, the web server will not have any access to the /root directory. You might want to make a separate top level directory and give the web server's account (usually apache or httpd) the appropriate access to it.
  • Comment on Re: this program is not running in apache web server