file access error

Team,

I am trying to install a php script and in-between i get file access error :

unable to access /index.php

i have chowned the directory and have also given chmod -R 755 to files, but still not resolved.

Given below default directive generated by virtualmin:

SuexecUserGroup "#509" "#509" ServerName mydomain.com ServerAlias www.mydomain.com ServerAlias webmail.mydomain.com ServerAlias admin.mydomain.com DocumentRoot /home/mydomain/public_html/web ErrorLog /var/log/virtualmin/mydomain.com_error_log CustomLog /var/log/virtualmin/mydomain.com_access_log combined ScriptAlias /cgi-bin/ /home/mydomain/cgi-bin/ DirectoryIndex index.html index.htm index.php index.php4 index.php5 Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI allow from all AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch AddHandler fcgid-script .php AddHandler fcgid-script .php5 FCGIWrapper /home/mydomain/fcgi-bin/php5.fcgi .php FCGIWrapper /home/mydomain/fcgi-bin/php5.fcgi .php5 allow from all AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch RewriteEngine on RewriteCond %{HTTP_HOST} =webmail.mydomain.com RewriteRule ^(.*) https://mydomain.com:20000/ [R] RewriteCond %{HTTP_HOST} =admin.mydomain.com RewriteRule ^(.*) https://mydomain.com:10000/ [R] RemoveHandler .php RemoveHandler .php5 php_admin_value engine Off IPCCommTimeout 3001 Alias /dav /home/mydomain/public_html DAV on AuthType Basic AuthName "mydomain.com" AuthUserFile /home/mydomain/etc/dav.digest.passwd Require valid-user ForceType text/plain Satisfy All RemoveHandler .php RemoveHandler .php5 RewriteEngine off

I feel the problem is because of some restrictions created by the above directive.

Please help me making correct changes in the directive to resolve the issue.

thanks and regards

Please help…

thanks and regards

Howdy,

Well, the default directives are well tested and normally work out of the box… it sounds like something unusual is going on.

If you look in $HOME/logs/error_log, do you see any errors listed in there?

Also, what if you try creating another script, perhaps named test,php, with the following contents:

<?php phpinfo(); ?>

What happens when you try to access that in your browser?

-Eric

Hello Eric,

Given below error message received during installation:

Attention! An error occurred at this installation step.
Please repeat the current step. If the error persists, skip the step.
Forbidden You don’t have permission to access /index.php on this server.

php.info() file again not accessible (checked in the middle of installation, when get stuck with the above error )

Forbidden
You don’t have permission to access /test.php on this server

I have enclosed 2 files:

  1. Contents of error_log - error-log.txt
  2. Contents of .access.php file located in the root folder of the script

Please help in resolving the issue.

Thanks and Regards

It sounds like there’s a file or directory permissions issue of some sort… what is the output of these commands:

ls -ld /home/mydomain ls -ld /home/mydomain/public_html ls -l /home/mydomain/public_html/.htaccess

Hello Eric,

[root]# ls -ld /home/mydomain
drwxr-x—. 10 mydomain mydomain 4096 Sep 2 18:36 /home/mydomain

[root]# ls -ld /home/mydomain/public_html
drwxr-x—. 11 mydomain mydomain 4096 Sep 2 20:53 /home/mydomain/public_html

[root]# ls -l /home/mydomain/public_html/.htaccess
-rw-------. 1 mydomain mydomain 860 Sep 2 20:53 /home/mydomain/public_html/.htaccess

Ah, the permissions on your .htaccess file may be too restrictive.

You may want to make that .htaccess file “755” by running this command:

chmod 755 /home/mydomain/public_html/.htaccess

After that, are you able to access the test.php script?

-Eric

Hello Eric,

I have tried both of the given below: But, nothing works.

chmod 755 /home/mydomain/public_html/.htaccess

chmod 777 /home/mydomain/public_html/.htaccess

Both the installation screen and access to test.php generate the given below error :

Internal Server Error

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

Please contact the server administrator, root@localhost 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.

Please help. Thanks and Regards

After running “chmod 755 /home/mydomain/public_html/.htaccess”, what error(s) show up in the Apache error log?

-Eric

Hello Eric,

(13)Permission denied: /home/mydomain/public_html/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

[Tue Sep 03 11:20:06 2013] [alert] [client 223.182.25.37] /home/mydomain/public_html/.htaccess: Option FollowSymLinks not allowed here

Request help. Thanks

The most recent error message suggests that there’s an error with the .htaccess file… what happens if you comment out the line containing “FollowSymLinks”?

-Eric

Hello Eric,

I tried deleting the line containing ‘Option FollowSymLinks’ from my .htaccess file
(was that what i was supposed to do ?)

I am able to access my test.php displaying php.info, but no progress on the installation.

Given below latest error msg in the log:

[Tue Sep 03 20:56:51 2013] [crit] [client 223.238.216.241] (13)Permission denied: /home/mydomain/public_html/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable,

It almost sounds like something is changing the permissions on that file… what is the output of this command:

ls -l /home/mydomain/public_html/.htaccess

Hello Eric,

You are correct.

When i give, chmod 755 to .htaccess, it shows

-rwxr-xr-x

But, the moment i run the installation, get struck and check the permission, it is set to

-rw-------

Not able to figure out what is changing the permission of .htaccess

Please help

What program are you attempting to install? It sounds like it’s the installation process of that program that’s causing the issue you’re seeing.

Unfortunately, I’m not sure how to fix that other than making changes to the installation script itself to prevent it from doing that.

-Eric