Apache2 won’t load index.php files

I have also noticed that apache won’t even load HTML files from the root (/var/www) directory. As far as I can see. Apache won’t load any page from the root directory. For example when I give to my browser http://localhost/ firefox will display me a dialog asking me to SAVE a PHTML file.

It seems like there is a problem with the webroot directory in particular. For example if i give http://localhost/phpmyadmin/ firefox will properly display the index.php of phpmyadmin included in this directory. Also if I create a folder in web-root let’s suppose myFolder if I point firefox to http://localhost/myFolder the page will display properly showing the index file no matter if it is html php or any other possible extension. Apache just denies to read ANY index file when given http://localhost/ prompting me to save the phtml file . I have also noticed that if I put an index.php (or any other php file) in the web-root directory and point the browser to http://localhost/anypossiblephpfile.php I will only get a wonderful dialog asking me to save a php file.

What is going on here? I know I am not very smart but I still can’t understand what might be causing the issue. Could it be there file-permission problem? (ok, ok don’t shoot)

ZST, thank you for your reply. I’ve tried what you said and everything looks fine. Just to make you know I have made a clean install from ubuntu’s repos, so there is not any “old” binary or config file.

Could it just be a browser issue?

HELP!! SOMEBODY!

非常奇怪,可能真是浏览器问题,按照上面这人所说的,莫名其妙phpadmin就能登入了,而如果是原来的名字phpMyAdmin,则会又让你保存phtml文件!

当然在这之前还修改了http.conf,添加如下内容:

AddType application/x-httpd-php .php

# Include module configuration:
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf
<IfModule mod_php5.c>
AddType application/x-httpd-php .php .phtml .php3
AddType application/x-httpd-php-source .phps
</IfModule>

LoadModule php5_module /usr/lib/apache2/modules/libphp5.so

NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@localhost

DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2’s
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory “/usr/lib/cgi-bin”>
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined
ServerSignature On

Alias /doc/ “/usr/share/doc/”
<Directory “/usr/share/doc/”>
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

</VirtualHost>

2 comments to Apache2 won’t load index.php files

  • Merhaba serkan bey ben yaptıklarımı size anlatıp hatayıda yazayım.Ayrıntı olraak Localde e7alıştırmaya e7alışıyorum xp proda.Aldığım hata: The requested operation has failed kurmak istediğim programların sfcrfcmleri:Apache 2.2.11Php 5.2.8 (installer)Php 4.4.9 (zip dosya)Mysql 5.1 (kuruldu sorunsuz)apache ve php ile ilgili sorun yaşıyorum.Yaptığım değişiklikler sırasıyla:1-)PHPIniDir “C:/Program Files/PHP/”LoadModule php5_module “C:\Program Files\PHP\php5apache2.dll” LoadModule lerin en altına ekledim. Bende httpd.conf dosyasına kendi eklemedi.Ben elle eklemek zorunda kaldım. php5apache2.dll yoktu benim surumde ve php5apache2_2.dll olanı yuklemiş php kurulumda fakat internetten php5apache2.dll yi indirdim fakat aynı hatayı alıyorum.2-)DocumentRoot bf6lfcmfcnfc değiştirdim. D:/Inetpub/wwwroot/ ta tutuyorum verileri.3-) directoryi değiştirdim. 4-) DirectoryIndex bf6lumu değiştirdim. index.html yazıyordu. DirectoryIndex index.php index.php3 index.php4 index.php5 index.shtml index.html index.htm bu şekilde yaptım.5-)ScriptAlias /cgi-bin/ C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/ bolumunu # işareti ile kapattım.6-)Php 4.4.9 sitesinde zip şeklinde indirip C:/ surucusune ae7tım. ve php4 ie7in vermiş oldugunuz kodları httpd.conf dosyamın sonunda ekledim fakat yukarıdaki hatayı alıyorum sfcrekli.Ben bu sorunları hem yfckseltmelerde hemde yeni kurulumlarda hep yaşıyorum maalesef. Hazır paket programlar kullanmak istemiyorum inatdına ayrı ayrı kurmaya e7alışıyorum. İyi c7alışmalar Dilerim.

  • I didn’t genuinely wish to have the game at the house just I figure’d he could be been really encountering a lot this in turn your past year. family law, movement several times a day, The demise of the his or her grandmother, So i asked my lover if it becomes alright if he caused the Xbox to the house and we might lift it to the online market place so can play on the internet. my girl agreed,

Leave a Reply to Marina Cancel reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>