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

I've configured my Apache with an alias to another directory in the httpd.conf like this:

Alias <a_dir> "<full path>"

This works fine for regular HTML documents like <a_dir>/home.html, but PHP-files like <a_dir>/script.php are not processed on the server (i.e. servered to the browser as a regular text-file).

As far as I can tell, PHP is properly installed - in the "normal" directory the files are processed. I've tried to also include a ScriptAlias, but that didn't change anything.

What am I missing?

share|improve this question

2 Answers 2

Can you provide any error messages you're seeing in /var/log/apache2/access.log(or whatever path you're using)? I have just tried this on my ubuntu maverick box with the following:

Alias /a_dir/ "/home/USERNAME/phptest/index.php"

my index.php contains simply:

<?php
phpinfo()
?>

Let me have a look at the errors and access logs and should be able to know more

share|improve this answer
    
I'm not getting any errors, the file is simply served as a text file adn nothing is displayed in the browser. The access log only has the line ::1 - - [12/Apr/2011:11:04:49 +0200] "GET /smartersoftware/index.php HTTP/1.1" 200 19 –  IronGoofy Apr 12 '11 at 9:06
    
what does index.php look like? –  vsltd Apr 12 '11 at 9:23
    
Just like the one you had in your answer. –  IronGoofy Apr 12 '11 at 9:47
    
Could you share the httpd.conf or apache2.conf? I'm new here so not sure about where this would go but imagine [pastie](pastie.org ) would be best. –  vsltd Apr 12 '11 at 9:54
    
It's pretty much a common httpd.conf file see for yourself at pastie.org/1786253 –  IronGoofy Apr 12 '11 at 10:16

The alias was workking fine, it seems that I needed the following lines in my config:

<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

With this, the php-file is properly processed. I'm not sure why php-files in another directory worked fine without it, but it looks like everything is working now.

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.