LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 04-03-2007, 08:36 AM   #1
rlee923
Member
 
Registered: Jan 2006
Location: Australia
Distribution: Fedora Core 6
Posts: 88

Rep: Reputation: 17
apache2 not parsing .php file?


Hello~

I've installed php5, apache2, and mysql from the lastest tarballs.

I think everything is installed fine(sigh*).

I tried phpinfo() on index.php and it shows me all the configuration properly, but when I tried to actually do some sample pages, mozilla wouldn't parse the php file as usual and just comes up with popup saying that what do you want to open this file with?

When I saw that i was screaming... F******K.

Somebody help me please~.

P.S
I am running FC6 with SELinux and I did modify httpd.conf file
for parsing php part by including these two lines,

AddType application/x-httpd-php .php .phtml .php3 .html .htm AddType application/x-httpd-php-source .phps

P.S II-

I actually wrote something to check the interoperability between mysql and php - checking whether php can connect to mysql db and stuff- and it actually works. Php file with the code is called test.php, so.. I am not sure why it wouldn't work for other files named such as abc_de.php.
 
Old 04-03-2007, 08:46 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
well it sounds like it is working, but the mimetype being sent to the browser is not being recognised, what does firefox or wireshark or whatever say the content-type of the file being sent actually is? should be text/html and if it is a normal webpage being sent. in that case then it'd be displayed. what would normally happen under fedora / redhat is that you'd use rpm's from yum or other official resources and that will automatically include all relevant configuration, e.g. php is configured under apache by the file /etc/httpd/conf.d/php.conf being dropped in by the php rpm.

btw...

Code:
WORD FINDER RESULTS
Your query f******k turned up these results:

    * feedback
    * firework
    * fishhook
    * flapjack
    * flyspeck
    * footwork
    * forelock
    * fretwork
    * fullback
which one was it?

Last edited by acid_kewpie; 04-03-2007 at 08:49 AM.
 
Old 04-03-2007, 09:01 AM   #3
rlee923
Member
 
Registered: Jan 2006
Location: Australia
Distribution: Fedora Core 6
Posts: 88

Original Poster
Rep: Reputation: 17
wow thanks for the speedy reply.

It says it's a php script.

Also, I didn't do lampsetup through rpm, I just installed from getting tarballs and configuring myself.

And I don't think I need to answer the other question.

Oh, and I did search forum before posting this, and the only thing that looked hopeful was removing cache, but it didn't work.

Last edited by rlee923; 04-03-2007 at 09:05 AM.
 
Old 04-03-2007, 09:15 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
weell what actually is the content-type header you receive? there are plenty of FF extensions, but i just use wireshark and capture the raw traffic. it's up to the browser to recieve a correct mime type and do something with it. if it's not told it's got html outpout (remember that php itself is just serverside code to output html or other data to a client) then it'll take other actions like sacing it to disk if it's "application/data" or something.
 
Old 04-03-2007, 09:23 AM   #5
rlee923
Member
 
Registered: Jan 2006
Location: Australia
Distribution: Fedora Core 6
Posts: 88

Original Poster
Rep: Reputation: 17
How do you check the content-header type?
And what are FF extensions?

it really does only say it's php script

it firstly gives me the file name

and one the next line it says it's a php script
and then it gives me the location of the file.

After that it just says what should firefox do with this file?

:S

I am just going crazy~!
 
Old 04-03-2007, 09:50 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
FF = firefox. search for an extension for firefox which will show you http headers
 
Old 04-03-2007, 10:46 AM   #7
benjithegreat98
Senior Member
 
Registered: Dec 2003
Location: Shelbyville, TN, USA
Distribution: Fedora Core, CentOS
Posts: 1,019

Rep: Reputation: 45
If you have lynx installed you can type:
lynx -head http://<webserver>/test.php

If you don't have it then "yum install lynx" will get it on there for you.

Also I have
AddType text/html .php
in my config files for apache...
 
Old 04-04-2007, 04:54 AM   #8
rlee923
Member
 
Registered: Jan 2006
Location: Australia
Distribution: Fedora Core 6
Posts: 88

Original Poster
Rep: Reputation: 17
LOL

I downloaded lynx and tried what you've suggested me, thank you, apparently at the end of the header

for the file I was trying open through Firefox, it gives me x-pad-avoid-browser bug.

Man..... D/L new version of FF and try again I guess.

Btw both of them have text/html as the content-type so I don't think it's apache2's problem.

Any suggestion on the browsers other than Firefox?

Cheers
 
Old 04-04-2007, 07:49 AM   #9
benjithegreat98
Senior Member
 
Registered: Dec 2003
Location: Shelbyville, TN, USA
Distribution: Fedora Core, CentOS
Posts: 1,019

Rep: Reputation: 45
Something tells me it is the specific file you are trying to serve.

Read through this thread:
http://lists.evolt.org/archive/Week-...29/149294.html
 
Old 04-05-2007, 10:41 PM   #10
rlee923
Member
 
Registered: Jan 2006
Location: Australia
Distribution: Fedora Core 6
Posts: 88

Original Poster
Rep: Reputation: 17
Ok.. I just tried opening a dummy php file, without any other code other than

<?php
?>

and even this file gives me the pop up screen asking me what I want to do with it.

But the other php file has far more code than this and it works.

error.. I might try and see the mime setup .

Btw this is the code of the other file that I wrote to check whether mysql works properly or not.

Cheers.
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass =

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');

$dbname = 'test';
mysql_select_db($dbname);

print "test successful\n"

?>
 
Old 04-06-2007, 12:20 AM   #11
aznluvsmc
Member
 
Registered: Aug 2004
Location: Newmarket, Ontario
Distribution: OpenSuse 10.2
Posts: 184

Rep: Reputation: 30
I ran into this problem too installing Apache 2.0, PHP 5 on FC6. I fixed it by adding the following line to my httpd.conf file:

AddHandler php5-script .php

I think this line tells Apache that all files ending .php should be parsed using the php interpreter.
 
Old 04-06-2007, 12:28 AM   #12
benjithegreat98
Senior Member
 
Registered: Dec 2003
Location: Shelbyville, TN, USA
Distribution: Fedora Core, CentOS
Posts: 1,019

Rep: Reputation: 45
Here is what I get when I view my headers.

HTTP/1.1 200 OK
Date: Fri, 06 Apr 2007 04:22:10 GMT
Server: Apache/2.2.0 (Fedora)
X-Powered-By: PHP/5.1.6
Connection: close
Content-Type: text/html; charset=UTF-8

Can you post what you get?

Is there a reason you chose to manually install as opposed to just using the Fedora 6 official RPMs? It would've been much easier that way.....
 
Old 04-06-2007, 12:31 AM   #13
aznluvsmc
Member
 
Registered: Aug 2004
Location: Newmarket, Ontario
Distribution: OpenSuse 10.2
Posts: 184

Rep: Reputation: 30
That is my header when testing my phpinfo script. I chose to manually install because I needed SSL and statically linked mod_Perl support.

HTTP/1.1 200 OK
Date: Fri, 06 Apr 2007 04:30:03 GMT
Server: Apache/2.2.4 (Unix) mod_ssl/2.2.4 OpenSSL/0.9.8e PHP/5.2.1 mod_perl/2.0.3 Perl/v5.8.8
X-Powered-By: PHP/5.2.1
Content-Type: text/html
 
Old 04-06-2007, 01:03 AM   #14
rlee923
Member
 
Registered: Jan 2006
Location: Australia
Distribution: Fedora Core 6
Posts: 88

Original Poster
Rep: Reputation: 17
HTTP/1.1 200 OK
Date: Fri, 06 Apr 2007 04:59:10 GMT
Server: Apache/2.2.4 (Unix) PHP/5.2.1
X-Powered-By: PHP/5.2.1
Connection: close
Content-Type: text/html

Now it doesn't come with browser error message..

The reason I am installing manually is because I have to know how to lamp setup on other disro for one of the machines at the company and they have not decided which distro goes on it.

I'll try few things more and post again.

Btw I've tried Addhandler thing, but it didn't work work Thanks for the reply though
 
Old 04-06-2007, 01:10 AM   #15
aznluvsmc
Member
 
Registered: Aug 2004
Location: Newmarket, Ontario
Distribution: OpenSuse 10.2
Posts: 184

Rep: Reputation: 30
That's odd that the AddHandler didn't work. Where did you place it and what exactly did you type in? I double checked on the Apache documentation and it says that AddHandler is required to pass off specific extensions to different modules to handle them.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Debian / Apache2 / PHP5 / Firefox not parsing locally Garybtx Linux - Server 2 11-13-2006 07:57 PM
PHP Parsing ToothlessRebel Programming 20 10-25-2006 08:35 PM
parsing text file in php ohcarol Programming 1 08-25-2006 10:18 AM
PHP PNG image file parsing Proud Programming 4 08-04-2004 01:55 PM
php not parsing chens_83 Linux - General 9 02-19-2003 05:53 AM


All times are GMT -5. The time now is 04:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration