LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-18-2003, 11:31 PM   #1
krumholz
LQ Newbie
 
Registered: Jul 2002
Location: Chicago
Distribution: RH9
Posts: 24

Rep: Reputation: 15
Apache 2.0 and PHP


This is a newbie question :-)

I am installing Apache 2.0 with PHP.

I am having problems and have a strange issue the following works:

<? phpinfo(); ?>

but the following does not work. the source code appears on the page as
if it is not being processed.

<?php phpinfo(); ?>

I read in a newsgroup to try the second. I am wondering if this could some how be part of my problem. any ideas why the second line does not work.
 
Old 08-19-2003, 01:21 AM   #2
gargamel237
Member
 
Registered: Aug 2003
Location: Los Angeles
Distribution: gentoo
Posts: 52

Rep: Reputation: 15
Mysterious. The opposite has always been true for me where only the long form works. Check the config files of both apache and php.
 
Old 08-19-2003, 06:15 AM   #3
krumholz
LQ Newbie
 
Registered: Jul 2002
Location: Chicago
Distribution: RH9
Posts: 24

Original Poster
Rep: Reputation: 15
Quote:
Check the config files of both apache and php

What do i look for ? Apache is set up to look for files that end in php and what should the php.ini file contain ?

Thanks
 
Old 08-19-2003, 06:45 AM   #4
Burke
Member
 
Registered: Dec 2002
Location: Virginia, USA
Posts: 131

Rep: Reputation: 15
You may also try re-formatting your code.. to be on 3 lines instead of 1.
ie:
<?php
phpinfo();
?>

I'm not sure why, but I've seen this actually work when your problem was occuring on one of my machines.
 
Old 08-19-2003, 07:20 AM   #5
VincentB
Member
 
Registered: Jun 2003
Location: Brussels, Belgium
Distribution: Ubuntu 6.10
Posts: 139

Rep: Reputation: 15
Hello,

What is the output of this <?php phpinfo(); ?> on your computer?
Could you give more details (error message for instance)?

Vincent
 
Old 08-19-2003, 07:47 AM   #6
krumholz
LQ Newbie
 
Registered: Jul 2002
Location: Chicago
Distribution: RH9
Posts: 24

Original Poster
Rep: Reputation: 15
As i mentioned above, the only thing that appears on the page within the browser is the php code. It is as if apache didnt process the code as php, but rather displayed the source as if it was contained within an html page.

Also, I did try breaking the source across three lines.
 
Old 08-19-2003, 01:01 PM   #7
gargamel237
Member
 
Registered: Aug 2003
Location: Los Angeles
Distribution: gentoo
Posts: 52

Rep: Reputation: 15
this seems to be the relevant section of php.ini

; Allow the <? tag. Otherwise, only <?php and <script> tags are recognized.
; NOTE: Using short tags should be avoided when developing applications or
; libraries that are meant for redistribution, or deployment on PHP
; servers which are not under your control, because short tags may not
; be supported on the target server. For portable, redistributable code,
; be sure not to use short tags.
short_open_tag = On
 
Old 08-19-2003, 01:33 PM   #8
krumholz
LQ Newbie
 
Registered: Jul 2002
Location: Chicago
Distribution: RH9
Posts: 24

Original Poster
Rep: Reputation: 15
After looking at the ini file and tweaking the code, It works. I think my problem was that i put a space netween the ? and the PHP portion of the tag. At least that was the last thing I fixed and now the pages works correctly. :-)

Thanks !!!!!
 
  


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
Apache 2, PHP 5, SuSE 9.2 - cannot run php files dickohead Linux - Networking 6 06-28-2006 10:25 AM
php apache or php cgi - php learner rblampain Linux - Security 3 12-17-2004 11:10 PM
slackware, apache and PHP from .tgz - problems with PHP szymon Slackware 2 09-06-2004 04:57 PM
reinstalled apache, php, still no php support SuSE 8.2 hindenbergbaby Linux - Software 1 10-14-2003 01:42 PM
php-nuke with apache php mysql c0c0deuz Linux - Software 0 03-30-2003 06:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:23 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
Open Source Consulting | Domain Registration