Apache 2.0 & PHP problems

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
kurupt4
Forum Newbie
Posts: 10
Joined: Tue Dec 17, 2002 2:27 pm
Location: Tustin, CA

Apache 2.0 & PHP problems

Post by kurupt4 »

I have installed RedHat Linux 8.0, it installed Apache 2.0, it syas that the PHP package has been installed, it also is loading the php module when Apache starts, but I am unable to run any php files, I receive the Server Error when I do.

Can someone please help me figure this out.....

Thank you in advance

Leo Zayas
User avatar
Johnm
Forum Contributor
Posts: 344
Joined: Mon May 13, 2002 12:05 pm
Location: Michigan, USA
Contact:

Post by Johnm »

Post the error.
Is is parsing php at all?
Make sure that it is looking in the correct place for the php.ini file.

/usr/lib/php.ini
/usr/local/lib/php.ini
Are common places to put it.



John M
User avatar
kurupt4
Forum Newbie
Posts: 10
Joined: Tue Dec 17, 2002 2:27 pm
Location: Tustin, CA

More problems

Post by kurupt4 »

Thanks for the reponse John, I don't think it is because it is just ignoring the php tags, how do I know where it is looking for php.ini and others.... I am a newbie to php so I really appreciate your help and suggestions........
User avatar
Johnm
Forum Contributor
Posts: 344
Joined: Mon May 13, 2002 12:05 pm
Location: Michigan, USA
Contact:

Post by Johnm »

First of all, let's find out where it is. On your Linux box enter this at the command line:

Code: Select all

locate php.ini
John M
User avatar
kurupt4
Forum Newbie
Posts: 10
Joined: Tue Dec 17, 2002 2:27 pm
Location: Tustin, CA

Post by kurupt4 »

okay done, it is at /etc/php.ini
User avatar
Johnm
Forum Contributor
Posts: 344
Joined: Mon May 13, 2002 12:05 pm
Location: Michigan, USA
Contact:

Post by Johnm »

now do this:

Code: Select all

cp /etc/php.ini /usr/local/lib/php.ini
That is the default location on linux as far as I know. Then restart your web server and try it again.
If it works go ahead and remove the php.ini from the /etc/ directory.
If not, try copying it to the /usr/lib/ directory.

Code: Select all

cp /etc/php.ini /usr/local/php.ini
John M
User avatar
kurupt4
Forum Newbie
Posts: 10
Joined: Tue Dec 17, 2002 2:27 pm
Location: Tustin, CA

Post by kurupt4 »

John,

I copied the file over then restarted Apache, then ran my test script, the browser window was blank and when I went to source view I saw this:

<html>
<head><title>PHP Tests</title>
<body>
<? echo "Hello World"; ?>
</body>
</html>

What's next?....thank you so much
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

Try

Code: Select all

<?php echo "Hello World"; ?>
User avatar
Johnm
Forum Contributor
Posts: 344
Joined: Mon May 13, 2002 12:05 pm
Location: Michigan, USA
Contact:

Post by Johnm »

Sorry I left ya like that, I had to go pick up my daughter. You can try just echoing out "Hello World" but if you are seeing the php tags the code is not being parsed. Can you show me the flags you set when you configured Apache?
I am looking for something like this:

Code: Select all

./configure --prefix=/custom/apps/apache2 --enable-module=most --activate-module=src/modules/php4/libphp4.a
John M
User avatar
kurupt4
Forum Newbie
Posts: 10
Joined: Tue Dec 17, 2002 2:27 pm
Location: Tustin, CA

Post by kurupt4 »

that's okay John, no problem, I really appreciate you helping me.

Thank you too Kamuna, putting the php in the tag worked, however I heard you could also use ASP style tags <% %>, how is this done?

right now when I used the <?php echo "Hello World" ?> it worked just fine.

Is there like a conf file that I can change so it will accept <? by itself and <% ?

Thank you so much to both of you

Leo
User avatar
kurupt4
Forum Newbie
Posts: 10
Joined: Tue Dec 17, 2002 2:27 pm
Location: Tustin, CA

Post by kurupt4 »

sorry my sincere apologies that should have been TAKUMA and not the way I spelled it, very sorry....
User avatar
Johnm
Forum Contributor
Posts: 344
Joined: Mon May 13, 2002 12:05 pm
Location: Michigan, USA
Contact:

Post by Johnm »

Yes,
In the php.ini file you can change it so that <? ?> is acceptable. Do not forget to "clean up" the old copies of the php.ini file in the directoried where it is not used (/etc/php.ini etc) to avoid later confusion.


Glad things worked out for you.
John M
User avatar
kurupt4
Forum Newbie
Posts: 10
Joined: Tue Dec 17, 2002 2:27 pm
Location: Tustin, CA

Post by kurupt4 »

Thank you again so much John, I have done that and it is working good.... now I must go read and find out how to get it working with mySQL, any ideas or suggestions for good quality stuff on PHP and mySQL would be greatly appreciated.....

You guys are the best!
User avatar
Johnm
Forum Contributor
Posts: 344
Joined: Mon May 13, 2002 12:05 pm
Location: Michigan, USA
Contact:

Post by Johnm »

us the : phuse link at the top of the page and search in there. I am certain you will fins plenty of info. Also, I believe that the php.net site has some stuff on it too.



John M
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

kurupt4 wrote:sorry my sincere apologies that should have been TAKUMA and not the way I spelled it, very sorry....
Hehe, I'm kinda use to that... It isn't a Enlgish name off course, it's Japanese. :D
Post Reply