问题
I work with php in a Ubuntu 13.04 environment.
I've configured apache so that in my home directory I have a public_html directory where I keep all the websites I'm working on and I can access them with localhost/~homedir/website. Everything used to work fine, but some days ago I downgraded php to version 5.3 to try and solve a problem (which then I didn't) and then I came back to php 5.4.9. This happened some days ago and I don't remember if after all this I checked any of my websites. Anyway, today I tried accessing one and it didn't work. On the apache error.log file I have this:
File does not exist: /home/carlo/public_html/website/index.php/welcome
Negotiation: discovered file(s) matching request: /home/carlo/public_html/website/index (None could be negotiated).
The .htaccess I usually use is like this:
RewriteEngine on
RewriteBase /~carlo/website/
RewriteCond $1 !^(index\.php|cache|captcha|fonts|forum|media|img|min|css|js|scripts|images|uploads|docs|robots.txt|sitemap.xml|sitemap|public|tools|assets|xd_receiver.htm)
RewriteRule ^(.*)$ index.php/$1 [L]
On a side note, phpmyadmin is working. I can access it with localhost/phpmyadmin. In /etc/apache2/conf.d/apache.conf I have this:
Alias /phpmyadmin /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
Options FollowSymLinks
DirectoryIndex index.php
<IfModule mod_php5.c>
AddType application/x-httpd-php .php
php_flag magic_quotes_gpc Off
php_flag track_vars On
php_flag register_globals Off
php_admin_flag allow_url_fopen Off
php_value include_path .
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/php-gettext/
</IfModule>
What I think is that downgrading and upgrading php some configuration file changed, but I don't know which one and what to do. Can you help me figuring it out? Shall I post some other info?
EDIT:
I think I've found out the problem. Apparently, upgrading php the following instructions were reactivated:
# To re-enable php in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
<IfModule mod_userdir.c>
<Directory /home/*/public_html>
php_admin_value engine Off
</Directory>
</IfModule>
So, commenting them solved the issue (I hope)
回答1:
Add in .htaccess file and try
Options +FollowSymLinks
来源:https://stackoverflow.com/questions/16936440/php-websites-dont-work-after-changin-php-version