PDA

View Full Version : Problem Viewing Local PHP files



CaptinMoor
17-11-2007, 11:40 AM
Hi there guys and girls, well I have a bit of a problem. When trying to view .PHP files that I have hosted on my local server I cannot view them. Both Firefox and IE try to download these files.

When I do in fact download them and then view by selecting the application (Firefox or IE) the browser window opens and then just keeps opening more and more and more pages.

I have had a pretty decent search on google but have not found anything that can resolve this problem.

I think that this is more than likely a configuration problem with the Ubuntu Server that I am running. However I cannot be sure.

Here is the version of Apache2 that I am running

Server version: Apache/2.0.55
Server built: Aug 16 2007 22:27:29
Server's Module Magic Number: 20020903:11
Architecture: 32-bit
Server compiled with....
-D APACHE_MPM_DIR="server/mpm/prefork"
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D HTTPD_ROOT=""
-D SUEXEC_BIN="/usr/lib/apache2/suexec2"
-D DEFAULT_PIDLOG="/var/run/apache2.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_LOCKFILE="/var/run/apache2/accept.lock"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="/etc/apache2/mime.types"
-D SERVER_CONFIG_FILE="/etc/apache2/apache2.conf"

Also you can try viewing the PHP pages for yourself by visiting my server. This is located at 58.28.158.178.

The main files that I am having problems with are:

mydnsconfig/ 17-Nov-2007 11:12 -
php/ 17-Nov-2007 10:50 -
phpmyadmin/ 08-May-2006 23:57 -


Any help would be greatly appreciated.

Cheers

Captin ;)

stu161204
17-11-2007, 12:04 PM
This may sound like a silly question but have you got PHP installed on your web server?? (if you haven’t you will need to download php from http://nz.php.net/ & install it)

CaptinMoor
17-11-2007, 12:45 PM
This may sound like a silly question but have you got PHP installed on your web server?? (if you havenít you will need to download php from http://nz.php.net/ & install it)

There is never a silly question. Only silly answers. Anway Yeah, I have got it installed. I installed it when I built the server. However had to go and make sure it was all working still though.

Good question, any other ideas??

vinref
17-11-2007, 02:14 PM
Document structure elements?

i.e.,


<!DOCTYPE HTML PUBLIC "-//W3C//DTD... etc

That stuff is essential, and tells the browser how the file should be displayed.

TGoddard
18-11-2007, 10:36 PM
Your web browser will decide what to do with a document based on the MIME type sent back by the server. If you are getting the download box then the server is probably sending the PHP source document as a binary/unknown file (application/octet-stream). Try saving the downloading file - if the saved file is the PHP code then you will need to make the server run them as CGI scripts instead of treating them as ordinary files.

Morgenmuffel
19-11-2007, 07:11 AM
Probably a dumb question but do you have your addtype or addhandler set for php

have a look in your apache httpd.conf is there a handler in there that mentions php?

something like




AddType application/x-httpd-php .php .phtml



I had a similar problem years ago and it was because my PHP wasn't set up correctly, i had to add something to my httpd.conf

This thread should help (http://www.webmasterworld.com/apache/3418477.htm)