LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-29-2001, 09:30 AM   #1
DoubleLetter
Member
 
Registered: Jun 2001
Location: Sharjah, United Arab Emirates
Distribution: Mandrake Linux 10.1
Posts: 132

Rep: Reputation: 15
Php & Apache question


Hello,

I've Apache 1.3x installed on Rh 7.1, with php4 as a module. Now cgi perl and cgi python is working fine and normal html browsing. But when I tried to view a dynamic php page Netscape returns the raw page:

<html>
<body>
<?echo "hello";?>
</body>
</html>

I've chmod the index.php file to readable and executable, but to no effect.

What could be the error ?

Thanks,

Best Regards,
Ahsan A.
 
Old 08-30-2001, 07:16 AM   #2
DoubleLetter
Member
 
Registered: Jun 2001
Location: Sharjah, United Arab Emirates
Distribution: Mandrake Linux 10.1
Posts: 132

Original Poster
Rep: Reputation: 15
Hello again,

Could something be wrong with my configuration ??

I've posted my httpd.conf file at http://spython.sourceforge.net/httpd.txt

I'd appreaciate any help...

Thanks...
 
Old 08-30-2001, 09:19 AM   #3
jharris
Senior Member
 
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 47
Re: Php & Apache question

Quote:
Originally posted by DoubleLetter
<html>
<body>
<?echo "hello";?>
</body>
</html>
Shouldn't this be either
Code:
<html>
<body>
<? echo "hello"; ?>
</body>
</html>
or
Code:
<html>
<body>
<?PHP echo "hello"; ?>
</body>
</html>
cheers

Jamie...
 
Old 08-30-2001, 09:36 AM   #4
DoubleLetter
Member
 
Registered: Jun 2001
Location: Sharjah, United Arab Emirates
Distribution: Mandrake Linux 10.1
Posts: 132

Original Poster
Rep: Reputation: 15
I'm in the office right now, so I cant try that.

But I DID try

<?php echo "hello";?>

Does case matter ? I'm sure in THAT respect it doesn't. And even if that WAS the error. Netscape would have still interpreted the page as html.

It doesn't even understand the <html> tags. It just shows the entire source.

Regards..
 
Old 08-30-2001, 10:08 AM   #5
SensFan
Member
 
Registered: May 2001
Location: Toronto, Canada
Distribution: Slackware
Posts: 67

Rep: Reputation: 15
Based on theat apache config file it appears ok. I played with the one here at work, I removed the Addtype directive restarted it and then it didn't do any of the PHP code, but did do HTML. Then I removed the modules from the config and again it just didn't execute any PHP code, but returned HTML.

I think maybe it's a problem with the file itself like maybe corrupt in ftp or something? maybe make a fresh file and try that? Or try a regular HTML file first. If PHP wasn't installed right you'd still have HTML ok, and you wouldn't see the tags.

The browser is getting a file from the server. The browser seems to have trouble reading the file, a file problem may also explain why the php code was never executed and is therefore returned as is, not as html. Permission problems wouldn't let you even access the file so I don't think thats it. And php code errors would just be an error returned.

hope some of this helps


Cheers,
 
Old 08-30-2001, 11:47 AM   #6
hself
LQ Newbie
 
Registered: Aug 2001
Posts: 1

Rep: Reputation: 0
Try this

But I DID try

<?php echo "hello";?>


Try this instead

<?php echo ("hello"); ?>
 
Old 08-30-2001, 03:31 PM   #7
Teller_30
LQ Newbie
 
Registered: Aug 2001
Location: Oregon Coast
Distribution: RH7.2
Posts: 27

Rep: Reputation: 15
reintall php modules

I had a similar problem.. what fixed it for me was to reinstall the php modules after I changed the .conf file.

Don't ask me why this needed to be done, but it did work for me.
 
Old 08-31-2001, 01:37 AM   #8
DoubleLetter
Member
 
Registered: Jun 2001
Location: Sharjah, United Arab Emirates
Distribution: Mandrake Linux 10.1
Posts: 132

Original Poster
Rep: Reputation: 15
Hello again,

Thank you for your replies.

I solved the problem...

There's a line on the httpd.conf file:


<IfDefine HAVE_PHP4>
LoadModule php4_module modules/libphp4.so
</IfDefine>

I changed this to:

#<IfDefine HAVE_PHP4>
LoadModule php4_module modules/libphp4.so
#</IfDefine>

and this code:

<IfDefine HAVE_PHP4>
AddModule mod_php4.c
</IfDefine>

to:

#<IfDefine HAVE_PHP4>
AddModule mod_php4.c
#</IfDefine>

And it worked.

Weird, though.
 
Old 10-16-2001, 03:23 PM   #9
MartinF
LQ Newbie
 
Registered: May 2001
Posts: 1

Rep: Reputation: 0
I've been having similar problems.

Apache runs just fine. I used the rpm to install php4 but cannot get any parsed php out of from the server.

All indications point to php4 and apache running OK. The php.ini file is in the right place, all the entries for php and perl are in the httpd.conf file.

No clue what could be happening.

I tried commenting the <IfDefine HAVE_PHP4> lines on the apache config file but it had no effect.

I'm at a loss.

Any input would be appreciated

.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Slackware guide for AMP Apache MySQL & PHP xushi Slackware 35 05-11-2006 11:18 AM
ISS & ASP/.NET or Apache & PHP fuelinjection General 3 12-06-2005 07:41 AM
From RedHat9 to FreeBSD (Apache 2 & Mysql & PHP 4) guardian653 *BSD 5 12-11-2003 05:31 PM
Apache & PHP & Mysql thomas050682 Linux - Networking 5 03-03-2003 03:21 PM
Apache & PHP & RH8 hammerstein02 Linux - Software 3 02-07-2003 04:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:18 PM.

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
Open Source Consulting | Domain Registration