Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have the following problem - after moving to a new platform PHP files aren't found unless URL contains their extension. So, if /var/www contains file problem.php, the URL http://localhost/problem.php displays correctly, but http://localhost/problem does not. I have tried the following:

  • Checked if MultiViews are enabled in the configuration file:

    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
  • Checked if mod_negotiation is loaded via phpinfo():

Loaded Modules: core mod_log_config mod_logio mod_version prefork http_core mod_so mod_alias mod_auth_basic mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_deflate mod_dir mod_env mod_mime mod_negotiation mod_php5 mod_reqtimeout mod_rewrite mod_setenvif mod_status

  • Just in case the above was a stress-induced hallucination, tried loading the mod_negotiation2 and restarting the server:

    leviathan www # a2enmod negotiation
    Module negotiation already enabled
    leviathan www # service apache2 restart
      Restarting web server apache2                                                                                             apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
     ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
                                                                                                                          [ OK ]
    leviathan www # 
  • Made sure .htaccess isn't causing this by testing in a directory without .htaccess file.

But all for naught, and I still get 404 errors, and I completely fail to understand why. What am I doing wrong? My platform is Linux Mint 14.

share|improve this question

1 Answer 1

I found a solution. Add the following line into the /etc/apache2/mods-enabled/mime.conf:

AddType application/x-httpd-php .php .phtml .html .htm

Then restart apache with:

# service apache2 restart

And it's done. I suppose it's a bug in Linux Mint's configuration.

Source: "Serving pages without PHP file extension [apache]" thread on webdeveloper.com forum

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.