1

I have quite a strange problem with my Apache server.

I have two files containing <?php phpinfo(); ?>. They are both placed on the same server, however in different vhosts. The vhosts look like this:

First one:

<VirtualHost *:80>
        DocumentRoot /var/www/[...]/public_html
        ServerName something
        <Directory />
                AllowOverride All
        </Directory>
</VirtualHost>

Second one:

<VirtualHost *:80>
        DocumentRoot /var/www/[...]/public_html
        ServerName something
        ServerAlias something

        <Directory />
                AllowOverride All
        </Directory>
</VirtualHost>

As you see they are almost equal. However, if I point to the phpinfo.php on the second vhost, the source is sent to the client. On the first one phpinfo is executed and shown to the user successfully.

What can cause this difference?

4
  • Are you sure both files end in .php?

  • Are you using <? and not <?php in one of the sources?

  • Even though you say that there is no .htaccess file that doesn't work would you mind pasting the content of it?

  • Try reverting the order of the virtual hosts to see if anything changes.

  • Try once without any extra directory directives.

| improve this answer | |
  • <? was used of course. Well I can't control what people put on the server ;-) Maybe the configuration was a bit too strict. Setting "short_open_tag = On" solved the issue. – phidah Oct 26 '09 at 0:15
  • Now you should watch out for "<?xml" entries in your files as it will now be parsed by PHP and fail. – mr-euro Oct 26 '09 at 15:09
3

"AllowOverride All" means that any apache setting can be overridden by a .htaccess file in the DocumentRoot of each vhost (or in a subdirectory of the DocumentRoot). Check if your php settings are configured there.

| improve this answer | |
  • There is no .htaccess file in the document root that doesn't work. – phidah Oct 25 '09 at 12:38
0

Do you think you can post the full server configs?

What are the file names of both files?

I would also venture to guess that an .htaccess file is there, but without seeing the other config files we can't say for sure.

| improve this answer | |

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.