views:

108

answers:

3

Hello,

Originally I had following .htaccess file:

php_value display_errors 1
php_value error_reporting 7

AddDefaultCharset utf-8

Options -Indexes
<Files ~ ".*\.(info|tpl)$">
    Order allow,deny
    Deny from all
</Files>

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /index.php/$1 [L,QSA]

Which triggered 500 internal server error, so I moved first two lines to the php.ini file.

after that, error disappeared, but redirect is not working, it simply redirects to the empty page, error log shows: file not found also, another log shows:

PHP Warning:  Unknown: open_basedir restriction in effect. File() is not within the allowed path(s): (/home/:/usr/lib/php:/usr/local/lib/php:/tmp/:/usr/local/:/usr/bin) in Unknown on line 0

I tried to write in RewriteLog which triggered 500 server error again

A little help? Thank you in advance

P.S.

cPanel 11.24.5-STABLE (Build: 38506)
Apache version 2.2.15 (Unix)
MySQL version 5.0.85-community
PHP version 5.2.9
Operating system Linux

Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_fcgid/2.3.5
A: 

As your reg-ex suggests

<Files ~ ".*\.(info|tpl)$">

you are allowing only .info and .tpl files to be accessed. Am i getting something wrong here?

Edit: Made comments when realised the error on my side.

pinaki
my bad. just noticed the deny from all there.
pinaki
it can be due to the <Files> directive. the apache docs suggest to use <FilesMatch> when dealing with multiple files.Can you try <FilesMatch ".*\.(info|tpl)$"> and check once?
pinaki
tried it, same thing happens.open_basedir error is generated, I think there is something wrong with that open_basedirI checked it, and it shows:/home/:/usr/lib/php:/usr/local/lib/php:/tmp/:/usr/local/:/usr/bin Should I try to add /home/mydomain/ as well?
Giorgi
i wud suggest that you try the full path to your home instead of ~ there. In some hosted environments, ~ might not be supported.
pinaki
A: 

You should look into the apache log - the error will be there and you will know what to fix afterward.

Mikulas Dite
+1  A: 

It looks like PHP is trying to open file with empty path, so there is clearly some error in the PHP script you're trying to access. Just check the access log on which URL did you get this error and try to fix the PHP script.

Michal Čihař