when trying to view a .php file my browser tries to download
Moderator: General Moderators
when trying to view a .php file my browser tries to download
I have istalled Apache/1.3.27 Server on a .NET windows 2003 server and the nessesary files to install PHP.
but when I try to view a website which is PHP based apache shows me the folderlist and not the index.php file.
I have checked if all files are on the right places and that should be ok.
Can somebody help me?
but when I try to view a website which is PHP based apache shows me the folderlist and not the index.php file.
I have checked if all files are on the right places and that should be ok.
Can somebody help me?
take a look at http://httpd.apache.org/docs/mod/mod_dir.html#directoryindex e.g.This directive needs mod_dir to be enabled
Code: Select all
DirectoryIndex index.html index.php /forbidden.htmlsome answers needed.
I have checked my httpd.conf file and as far as i know mod_dir is enabled, but where do i place the line you described in the box above ?
I have tried it but it didn;t work,
I have uninstalled apache 1.3 and installed apache 2.0 and followed all the instructions as described in the manual and still have the problem that if I want to open a file named phpinfo.php my browser wants to download the file instead of showing the results in my browserscreen. 
The default httpd.conf (shipped with the installation) contains a section
causing your apache to only search for index.html in each directory. Replaced by#
# DirectoryIndex: Name of the file or files to use as a pre-written HTML
# directory index. Separate multiple entries with spaces.
#
<IfModule mod_dir.c>
DirectoryIndex index.html
</IfModule>
apache will search for a file index.html, if not found for a file index.php in each directory and the last try is /forbidden.html (a file in your DocumentRoot whatever directory has been requested, e.g. to present a custom "directory listing forbidden"-page)<IfModule mod_dir.c>
DirectoryIndex index.html index.php /forbidden.html
</IfModule>
oops, I missed that post. No, that probably can't be fixed via DocumentRoot.that if I want to open a file named phpinfo.php my browser wants to download the file instead of showing the results in my browserscreen.
But again take a look at httpd.conf. There should be a line
remove the hasmark to uncomment the line. There should also be a section#LoadModule info_module modules/mod_info.so
change it to#
# Allow remote server configuration reports, with the URL of
# http://servername/server-info (requires that mod_info.c be loaded).
# Change the "..." to match your domain to enable.
#
#<Location /server-info>
# SetHandler server-info
# Order deny,allow
# Deny from all
# Allow from ....
#</Location>
Code: Select all
<Location /server-info>
SetHandler server-info
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>This should show you the "Apache Server Information"-page.
If php is installed correctly there should be something like
if not check again the installation steps in install.txt (if you've downloaded the zip-package of php from http://www.php.net/downloads.php)Server Version: Apache/1.3.27 (Win32) PHP/4.3.1
...
Module Name: mod_php4.c
Content handlers: application/x-httpd-php , application/x-httpd-php-source , text/html
Configuration Phase Participation: Create Directory Config, Merge Directory Configs, Child Exit
http://www.php.net/manual/en/installation.php will guide you, too.
bad news
I have tried everything you wrote down but still can't get it to work.
It seems that the mod_php4.c can't be loaded.
The server_info tells me the following about php....
http://prj-romeijn.demon.nl/server-info
It seems that the mod_php4.c can't be loaded.
The server_info tells me the following about php....
http://prj-romeijn.demon.nl/server-info
php is loaded.Module Name: sapi_apache2.c
[I just installed apache2 on my box (again). Hey, this tray thingeling let me even choose between apache and apache2, nice
in the httpd.conf that ships with the default installation, there is a line
add theAddType image/x-icon .ico
Code: Select all
AddType application/x-httpd-php .phpFinally it works
Thank you all for all the help and tips you gave me today. 
last question
In what directory should the tmp be ?
what is the usual path?
what is the usual path?
doesn't matter at all. Only make sure that the apache-process has read/write access to it. I e.g. have a directory e:\webserverDocumentRoot (httpd.conf) and doc_root point to e:/webserver/htdocs.
upload_tmp_dir to e:/webserver/uploadtmp
and session.save_path to e:/webserver/sessions
Code: Select all
*E:\webserver
*ftp
*htdocs
*icons
*sessions
*uploadtmpupload_tmp_dir to e:/webserver/uploadtmp
and session.save_path to e:/webserver/sessions
all changed
thanx very much