Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Include Virtual not working correctly in Apache 2.2

Posted on 2007-11-21
13
Medium Priority
?
1,350 Views
Last Modified: 2013-11-18
I recently migrated to a new server with apache2.2 and php 5.x.  Now I'm having problems with a few scripts that used to work fine under apache1.3 and php 4.x.

The problem boils down to the php virtual() function and the html include virtual function.

Here's what is happening:

<?php virtual("/test/"); ?> - doesn't work

<?php virtual("/test/index.html"); ?> - works fine

Both of these worked fine on the last server running apache1.x.

Why isn't apache2 able to find the index file and include it?

Thanks!
0
Comment
Question by:keefe007
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 2
13 Comments
 
LVL 5

Expert Comment

by:administradores
ID: 20331320
Hello

Is the directory index set correctly in your conf?

DirectoryIndex index.html
0
 
LVL 5

Expert Comment

by:administradores
ID: 20331330
This also for php.

DirectoryIndex index.html index.php
0
 

Author Comment

by:keefe007
ID: 20331342
DirectoryIndex is set correctly and loading http://www.domain.com/test/ results in the correct index being displayed.
0
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 

Author Comment

by:keefe007
ID: 20331354
I should add:

<!--#include virtual="/test/"--> - doesn't work
<!--#include virtual="/test/index.html"--> - works fine
0
 
LVL 19

Expert Comment

by:darron_chapman
ID: 20331492
The problem appears to be with your particular install and not Apache2 in general.  I was able to test out your scenario on my install (Apache2 and PHP5 running on XP) and it worked as expected.  Can you post your httpd.conf file?
0
 
LVL 5

Expert Comment

by:administradores
ID: 20331712
I did and worked too.
0
 

Author Comment

by:keefe007
ID: 20331960

#
# This is the main Apache HTTP server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see 
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.  
 
ServerRoot "/etc/httpd"
Listen 80
 
#LoadModule php4_module /usr/lib/apache/libphp4.so 
LoadModule php5_module /usr/lib/apache/libphp5.so 
#LoadModule suphp_module /usr/lib/apache/mod_suphp.so
LoadModule php5_module        /usr/lib/apache/libphp5.so
 
User apache
Group apache
 
ServerAdmin username@mydomain.com
DocumentRoot "/var/www/html"
 
<Directory /home/*>
    AllowOverride All
    Options -MultiViews -Indexes +FollowSymlinks +Includes
<Limit GET POST OPTIONS PROPFIND>
    Order allow,deny
    Allow from all
</Limit>
<LimitExcept GET POST OPTIONS PROPFIND>
    Order deny,allow
    Deny from all
</LimitExcept>
</Directory>
 
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
 
<Directory "/var/www/html">
    Options Indexes FollowSymLinks Includes
    AcceptPathInfo On
    AllowOverride None
    Order allow,deny
    Allow from all
   <IfModule mod_suphp.c>
        suPHP_Engine On
        suPHP_UserGroup webapps webapps
   </IfModule>
</Directory>
 
<IfModule dir_module>
    DirectoryIndex index.html index.htm index.shtml index.php index.php5 index.php4 index.php3 index.phtml index.cgi
</IfModule>
 
<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</FilesMatch>
 
ErrorLog /var/log/httpd/error_log
LogLevel debug
 
<IfModule log_config_module>
    #replace %b with %O for more accurate logging
    <IfModule logio_module>
      LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
      LogFormat "%h %l %u %t \"%r\" %>s %O" common
      LogFormat "%O" bytes
 
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>
 
    CustomLog /var/log/httpd/access_log common
</IfModule>
 
<IfModule alias_module>
    # Include some DirectAdmin alias
    Include conf/extra/httpd-alias.conf
</IfModule>
 
<Directory "/var/www/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>
 
DefaultType text/plain
 
<IfModule mime_module>
    # This is needed for PHP
    Include conf/extra/httpd-php-handlers.conf
 
    TypesConfig conf/mime.types
    AddType application/x-gzip .tgz
    AddEncoding x-compress .Z
    AddEncoding x-gzip .gz .tgz
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddHandler cgi-script .cgi
    AddHandler type-map var
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
</IfModule>
 
#EnableMMAP off
#EnableSendfile off
 
#######################################################################################
# Do not change anything in included files, because they are rewritten by DirectAdmin #
#######################################################################################
 
# Server-pool management (MPM specific)
Include conf/extra/httpd-mpm.conf
 
# Multi-language error messages
Include conf/extra/httpd-multilang-errordoc.conf
 
# Fancy directory listings
Include conf/extra/httpd-autoindex.conf
 
# Language settings
Include conf/extra/httpd-languages.conf
 
# User home directories
#Include conf/extra/httpd-userdir.conf
 
# Real-time info on requests and configuration
Include conf/extra/httpd-info.conf
 
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
 
# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf
 
# Distributed authoring and versioning (WebDAV)
Include conf/extra/httpd-dav.conf
 
# Various default settings
Include conf/extra/httpd-default.conf
 
# Secure (SSL/TLS) connections
Include conf/extra/httpd-ssl.conf
 
# Deflate module settings
Include conf/extra/httpd-deflate.conf
 
# All the DirectAdmin vhosts
Include conf/extra/directadmin-vhosts.conf
 
# All suPHP directives
Include conf/extra/httpd-suphp.conf
 
# All the other includes needed by the custombuild script
Include conf/extra/httpd-includes.conf
 
#######################################################################################
# End of included files that are rewritten by DirectAdmin                             #
#######################################################################################
 
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
 
# Alias for RoundCube webmail
Alias /roundcube /var/www/html/roundcube/

Open in new window

0
 

Author Comment

by:keefe007
ID: 20331968
I've been testing this in /var/www/html/ but have also tested in /home/
0
 
LVL 19

Expert Comment

by:darron_chapman
ID: 20332156
The only thing that pops out at me in the http.conf file is that you're loading php5_module twice.  I'm pretty sure this isn't the culprit though.  Nothing else in this file indicates a problem.  I tried to replicate the issue with my install and I couldn't.  This file does load other external files that may have information that could lead you to the answer.  The file says that you shouldn't modify those files directly:

# Do not change anything in included files, because they are rewritten by DirectAdmin #

I'm not familiar with DirectAdmin....
0
 
LVL 5

Expert Comment

by:administradores
ID: 20332863
Could you please post also the includes, because there must be some missconfig there, since i tryed with a Redhat server and also with windows and everything worked fine.

0
 
LVL 5

Expert Comment

by:administradores
ID: 20332866
Also as i understand you're in a production server isn't?
0
 

Author Comment

by:keefe007
ID: 20334237
Thanks for the comment darron_chapman.  I did take that extra call to php5 out but as you expected it didn't have any effect.

I was able to do further troubleshooting and it appears the problem lies in the mod_deflate config.  I started commenting the includes out one by one and found that everything works when mod_deflate is disabled.  Here's what that conf looks like:
   1.
      #
   2.
      # Required modules: mod_deflate
   3.
      #
   4.
      # Please see the documentation at
   5.
      # <URL:http://httpd.apache.org/docs/2.2/mod/mod_deflate.html>
   6.
      # for further details before you try to setup deflate module.
   7.
      #
   8.
       
   9.
      <Location />
  10.
      # Insert filter
  11.
      SetOutputFilter DEFLATE
  12.
       
  13.
      # Netscape 4.x has some problems...
  14.
      BrowserMatch ^Mozilla/4 gzip-only-text/html
  15.
       
  16.
      # Netscape 4.06-4.08 have some more problems
  17.
      BrowserMatch ^Mozilla/4\.0[678] no-gzip
  18.
       
  19.
      # MSIE masquerades as Netscape, but it is fine
  20.
      BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  21.
       
  22.
      # Don't compress images and other uncompressible content
  23.
      SetEnvIfNoCase Request_URI \
  24.
       \.(?:gif|jpe?g|png|rar|zip|exe)$ no-gzip dont-vary
  25.
       
  26.
      # Make sure proxies don't deliver the wrong content
  27.
      Header append Vary User-Agent env=!dont-vary
  28.
      </Location>

Open in new window

0
 
LVL 5

Accepted Solution

by:
administradores earned 1500 total points
ID: 20349550
Hello keefe007

I could reproduce the same error and the problem are the php files, and guessed it must be a mod_header bug but not sure, and researched a bit and found 2 tickets about the same error.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43939

If php files are ignored the error is gone, and with html there are no errors.






24.\.(?:gif|jpe?g|png|rar|zip|exe|php)$ no-gzip dont-vary

Open in new window

0

Featured Post

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question