Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem finding default .PHP file under Apache

Status
Not open for further replies.

segnosaur

Programmer
Oct 30, 2008
1
CA
Currently having a problem debugging a PHP-based app running under Linux/Apache.

Here's the issue: The project is an open source project written in PHP. The 'main' entry point is called 'index.php'. The application uses the URL to determine functionality.

For example:

and

Both find the default site properly.

Now, in other installations, the software is set up to access other portions of the site using:
That should cause the application to run the index.php application and access the information from 'secondpage'. This fails.
However, it does work correctly if we use:

So, from what I can gather, Apache is not able to find the default 'index.php' file unless its spelled out explicitly.

The httpd.conf file does have a 'DirectoryIndex index.php' line (otherwise the default web page won't work.)

Anyone have any idea why the database access is failing? (In particular, the line.)
 
I have a similar example. I use squirrelmail as a web based (php) email application. The squirrelmail php application is located in my /usr/share/squirrelmail folder, but it is accessed as In the /usr/share/squirrelmail folder there is one file called index.php.

The one setting that I see that is different from my configuration that works as intended and yours is that in my apache2.conf file I have an alias directive that says: alias /squirrelmail /usr/share/squirrelmail. This causes the URL that ends with squirrelmail to load index.php located in the directory. In your case you would want alias /secondpage /location/to/index.php.
 
can you please print your httpd.conf ?

Elad Levy,
IT Project Manager, CISSP
 
I don't want to post the entire file because it would both be outrageously long and contains non public information but here is an example from my apache2.conf that shows an example of using alias directives to reference a site:

Alias /drupal6 /usr/share/drupal6

<Directory /usr/share/drupal6/>
Options +FollowSymLinks
AllowOverride All
order allow,deny
allow from all
</Directory>

This site would then be available as .
 
Where did you put the DirectoryIndex ?

Elad Levy,
IT Project Manager, CISSP
 
Here is an other example:

Alias /squirrelmail /usr/share/squirrelmail

<Directory /usr/share/squirrelmail>
Options Indexes FollowSymLinks
<IfModule mod_php4.c>
php_flag register_globals off
</IfModule>
<IfModule mod_php5.c>
php_flag register_globals off
</IfModule>
<IfModule mod_dir.c>
DirectoryIndex index.php
</IfModule>

# access to configtest is limited by default to prevent information leak
<Files configtest.php>
order deny,allow
deny from all
allow from 127.0.0.1
</Files>
</Directory>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml

 
<Directory /usr/share/squirrelmail>"

Where did you put the virtual host configuration for this ?


Elad Levy,
IT Project Manager, CISSP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top