Browser trys to download php files
Hi,
I am a newb to linux, but thought this post should go here... I have SUSE 9.3, I wanted to setup a local webserver to do some test on running Mambo or something similar... I have compiled: MySQL - 4.0.26 Apache - 1.3.34 PHP - 4.4.2 From Source, I know that there maybe newer versions of these available but the HOWTO guide I followed used these version so I used them as well. Everything complied and installed fine (or so it seems) but when I try and view a local php file (eg php.info) my browser tries to download the file instead of actually viewing it? It also does the same with .html files and .htm files...I don't think it is my browers settings cause I can view these same files on the internet it's just locally that I have these problems I am sure there some thing wrong with either my php.ini file or my http.conf files...but not sure which one? I have browsed the net and this site for hours looking for solutions to this but I can't seem to find anybody that has had similar problems on this site...and the links that google give me are mostly broken or deleted. Is there anybody there that has had the same problem? or know of where the problem lies? Thanks! Sorry I should have said, I found some similar instances on the forums but none of the fixes worked for me! |
You need to run those files via Apache and view them via a URL (e.g., http://localhost/foo.php ) in order for the browser to receive the proper MIME type definition, and for the PHP to actually be interpreted (run).
|
Its probably that youre missing the httpd.conf instruction to feed the php pages thru the php parser. Check to see if your conf includes lines like these, they could also be in some other conf file that is included via the httpd.conf:
Code:
AddType application/x-httpd-php .php |
That is not the issue (Edit: in reference to: the DirectoryIndex, I missed the AddType setting in your post, sorry about that) , because:
Quote:
|
Quote:
|
The "correct" location to specify the php mime type in SuSE is in /etc/apache2/conf.d/php4.conf (assuming you're running php4). These lines should be present:
AddType application/x-httpd-php .php AddType application/x-httpd-php .php3 AddType application/x-httpd-php .php4 AddType application/x-httpd-php-source .phps for support for .php, .php3, .php4, and .phps extensions. Likewise, the DirectoryIndex definitions (for php files) are normally defined in here by default: DirectoryIndex index.php DirectoryIndex index.php3 DirectoryIndex index.php4 |
Browser trys to download php files
Hi Everybody,
Thanks for all the speedy replies! :) Artanicus, I have these lines in my httpd.conf file both of them actually and no luck.... Egghead, thanks for the suggestion but unfortunately that did help either.... KimVette, i have searched my whole Pc for foo.php and don't have it anywhere, and with regard to your last post, I am not running Apache2, I have apache 1.3 from source and php 4, so there is no /etc/apache2/ directory on my machine...do you think it maybe better to install apache2 (Using yast)? If so how do I uninstall apache 1.3 if I compiled it from source? Once again thanks for the replys! |
Sp@rticus,
foo.php was just an example KimVette gave. As KimVette is saying you need to access the php file as URL not as filesystem files. Put the php files in the Document Root, make sure php is enabled\loaded in httpd.conf and then try accessing them as URL. eg elinks http:\\localhost\test.php Paste your httpd.conf here so that we can see where your webroot is and if php is enabled or not. |
Browser trys to download php files
:p Little embarassed there, misunderstood what KimVette meant...sorry...lol
The thing is I am doing that in my browser (Firefox 1.5) I am typing http://localhost/info.php I have also tried http://127.0.0.1/info.php and no luck... Here is my httpd.conf file....(I just deleted out all the commented lines to make it smaller) Code:
ServerType standalone |
Okay strange,now I have not changed anything....and now it displays .html and .htm files fine it's just .php files that can't be read
|
Browser trys to download php files
OK, I did some further investigations into this and according to some posts on other forums I need to add
Code:
LoadModule php4_module modules/libphp4.so Code:
AddModule mod_php4.c Code:
Syntax error on line 223 of /usr/local/apache/conf/httpd.conf: I assume that it is trying to find libphp4.so in that particular directory...which I need to change to the directory that it's in, but I cannot find libphp4.so anywhere on my machine? So my question would now be how do I install it, I have tried YAST but YAST does not find it. I am sure its part of another package, but wich one. Am I even on the right track here? Thanks |
Where did you install php? Cause thats where libphp*.so will be. ITs not always called libphp4/5.php but sometimes just libphp.so a locate for it might reveal the location if your db is up2date, if not updatedb will refreshen it, or you could just do;
Code:
find /usr/ -name "libphp*.so*" Code:
ln -s /whree/it/is/libphp.so /usr/local/apache/modules/ |
Ok thanks, I found it in a weird place, strange that the find command from the command line found it but not from the gui,linked it anyway, althougth I did not have a modules folder I only have a libexec folder, so I linked it to there, and just edit my conf file to show that.
But now it gives me a new error: lol (Suppose now I know why its called trial and error) Code:
Syntax error on line 223 of /usr/local/apache/conf/httpd.conf: If that is the cause this is the command I used to compile php last time: Code:
./configure \ Thanks for the help once again |
I've compiled apache && php && mysql myself only once, as it took me a year for the first time to get running and everything compatible within the trio.. After that ive used prebuilt packages and never had a problem since.. So, you will surely get off easier if you install Apache and php from YaST. Undefined symbol errors are on of the nastiest, usually the solution is simply: "these two versions are not compatible with each other, try some other combination" .. d:
|
lol...a year..sheesh..ok maybe your suggestion is right and I need to try it from YAST...but now how do I uninstall my already installed versions...? Do I run
make clean or make uninstall as running man make does not show much help... Thanks |
All times are GMT -5. The time now is 05:40 PM. |