I set up a Debian 6 VPS to host couple of small sites and it works beautifully for default one.
Next i created new user and copy/paste default vhost file and enabled it with a2ensite and only adjusted paths accordingly for that new user but for some reason PHP files aren't parsed and only their source is displayed.
So, recap: identical vhost settings, PHP module enabled, short tags on (but not used)
To make it clear: I search and found bunch of "solutions" here and on the web elsewhere but none of those seemed to work for me.
Just noticed this string in logs :
PHP Fatal error: Unknown: Failed opening required '/home/tester/public_html/index.php' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0
[Thu Mar 21 20:28:55 2013] [error] [client xxx.xxx.xxx.xxx] PHP Warning: Unknown: open_basedir restriction in effect. File(/home/tester/public_html/index.php) is not within the allowed path(s): (/home/user/public_html:/tmp) in Unknown on line 0
And this is my default vhost file content:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName domain.com
ServerAlias www.domain.com
DocumentRoot /home/user/public_html/
ErrorLog /home/user/logs/error.log
CustomLog /home/user/logs/access.log combined
<Directory "/home/user/public_html">
AllowOverride All
php_admin_flag engine on
php_admin_value open_basedir "/home/user/public_html:/tmp"
</Directory>
</VirtualHost>
Could PHP's open_basedir be the culprit of this issue?
Yes, open_basedir can be root of this problem. You must have /home/tester/public_html/ in path and you have /home/user.
Looks like it skip PHP parsing and not block access to page as I tough - I found similar problem solved here: https://bbs.archlinux.org/viewtopic.php?id=57877 .
/First version with asking for clarification deleted as not complying with ServerFault policies as I was told./
Yay! Got it working!
Checked Apache's PHP module conf settings at /etc/apache2/mods-enabled/php5.conf:
It clearly says:
So I did, then restarted Apache and voila: