Apache Wont Display PHP

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

LiveFree
Forum Contributor
Posts: 258
Joined: Tue Dec 06, 2005 5:34 pm
Location: W-Town

Apache Wont Display PHP

Post by LiveFree »

Hello All,

Well after figuring out my WiFi card issue, I am turning my FC5 Distro into the ultimate Dev Shed!

But I have configured Apache to work with PHP (so I hoped)

But when I go to the index of a php-project, nothing shows. It doesnt ask me to download the file or anything, nothing shows.

Thanks,
Rick
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

If you open the source code view of your browser, do you see the php script there?
If so your webserver is not yet configured to let php handle php scripts.
Cladinshadows
Forum Newbie
Posts: 10
Joined: Sun Aug 06, 2006 3:57 am

Post by Cladinshadows »

I have the same problem as the above guy and my browser displays the code when I view the source.

php version:
5.1.4
Apache version:
2.0.59

Thanks for any help!
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Did you add the appropriate LoadModule and AddType directives in http.conf as explained in install.txt?
Cladinshadows
Forum Newbie
Posts: 10
Joined: Sun Aug 06, 2006 3:57 am

Post by Cladinshadows »

Yeah I did.

Here are the lines I added just encase they're wrong:

First one:
LoadModule php5_module c:/php/php5apache2.dll

Second one:
AddType application/x-httpd-php .php
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

did you restart the service?
LiveFree
Forum Contributor
Posts: 258
Joined: Tue Dec 06, 2005 5:34 pm
Location: W-Town

Post by LiveFree »

No Source Code is displayed
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

LiveFree wrote:No Source Code is displayed
What code are yu running? Check your apache error logs.
Cladinshadows
Forum Newbie
Posts: 10
Joined: Sun Aug 06, 2006 3:57 am

Post by Cladinshadows »

Yes, I did restart the service.

My friend sent me over a html file and it opened that correctly, but the phpinfo page I made to test it loads blank.

My source:
<?php
phpinfo();
?>
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

LiveFree wrote:No Source Code is displayed
Make a phpinfo() page and see if it loads. A blank page is usually a sign that there is an error in the script and that display_errors is off.

Code for your phpinfo.php page.

Code: Select all

<?php
phpinfo();
?>
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Cladinshadows wrote:Yes, I did restart the service.

My friend sent me over a html file and it opened that correctly, but the phpinfo page I made to test it loads blank.

My source:
<?php
phpinfo();
?>
Which file did you add those directives to? Where in the file did you add them?
LiveFree
Forum Contributor
Posts: 258
Joined: Tue Dec 06, 2005 5:34 pm
Location: W-Town

Post by LiveFree »

Yep I can see the phpinfo page

(Although I find it interesting you had to tell me how to do a phpinfo() page)

I cant believe display_errors is Off! I could have sworn I set that to on in the .ini
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

LiveFree wrote:Yep I can see the phpinfo page

(Although I find it interesting you had to tell me how to do a phpinfo() page)
Sorry, habit.
Cladinshadows
Forum Newbie
Posts: 10
Joined: Sun Aug 06, 2006 3:57 am

Post by Cladinshadows »

Everah wrote:
Cladinshadows wrote:Yes, I did restart the service.

My friend sent me over a html file and it opened that correctly, but the phpinfo page I made to test it loads blank.

My source:
<?php
phpinfo();
?>
Which file did you add those directives to? Where in the file did you add them?
I made a unicode text file and wrote it in, then I saved it as a .php. I saved the file as index.php and put it in the htdocs folder in my Apache folder.

As an added note, I also attempted to open the file via command prompt:

cd php
C:\php: C:\apache2\apache2\htdocs\index.php

It then asked me what program I wished to use to open the file...I'm not sure what I'm suppose to select here (if anything), but I chose Internet explorer and the file won't even open.

My php.ini is in my windows folder as well.
Last edited by Cladinshadows on Mon Aug 07, 2006 1:35 am, edited 1 time in total.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Sorry, should have clarified. I meant these...

Code: Select all

LoadModule php5_module c:/php/php5apache2.dll

AddType application/x-httpd-php .php
Where did you put these statements? Also, you restarted the server, correct? And lastly, you said that the page display is blank, but the PHP code shows in 'View Source'? Please confirm.
Post Reply