Was running a 12.04 ubuntu lamp setup. Built a new one using 14.04 ubuntu. These are both instances on AWS. On the old site, a php script named "info.php" could be displayed with the URL "http://example.com/info" and would display the phpinfo() output. On the new 14.04 server, with the lamp-server packages installed, if I do not specify the .php extension, I get a file not found (works fine with the .php extension added). Why isn't the request_URI not being auto rewritten on the newer setup?

The php5 and apache2 conf options have changed as well. Under 12.04 ubuntu the php5 is 5.3.10-1ubuntu3.14 and the 14.04 ubuntu setup is 5.5.9-1ubuntu4.5.

Searching about I see a lot of discussion about rewrite rules and such, but I'm confvinced I'm missing a basic configuration/setup problem here. Can anyone help point out the stupidity of my ways here?



The difference between 12.04 and 14.04 is in the /etc/mime.types file. In 12.04 the related area is this:

application/x-httpd-php                         phtml pht php
application/x-httpd-php-source                  phps
application/x-httpd-php3                        php3
application/x-httpd-php3-preprocessed           php3p
application/x-httpd-php4                        php4
application/x-httpd-php5                        php5

In 14.04 the related area is this:

#application/x-httpd-php                        phtml pht php
#application/x-httpd-php-source                 phps
#application/x-httpd-php3                       php3
#application/x-httpd-php3-preprocessed          php3p
#application/x-httpd-php4                       php4
#application/x-httpd-php5                       php5

Notice the relevant lines are commented out in the 14.04 case. Once I uncommented those lines I was able to have .php files load without specifying the .php file extension (after restarting apache, of course).

sudo service apache2 restart

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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