Web Server Configuration
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsWeb DesignWeb Server Configuration

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 10th, 2006, 10:16 PM
metropolis2k metropolis2k is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Posts: 3 metropolis2k User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 35 m 14 sec
Reputation Power: 0
Question PHP pages won't load, show source code (Apache 2/PHP 5)

I am trying to set up a web server on my windows xp machine. I chose to run Apache (2, latest version), PHP 5 and MySQL. At first I tried it with IIS but that didn't work out quite as I anticipated (didn't show ASP pages, so I figured PHP scripts wouldn't run with it either). So what I did, I uninstalled IIS and downloaded and installed Apache 2 and configured it the default way. Edited the httpd.conf file using the recommended settings etc. After this I used the PHP 5 zip distribution file and unpacked it to c:\php. I edited the php.ini file using the way that php.net describes it to do. Now, when I'm starting the apache server and attempt to load a simple php script test file, it just displays the source code of the script, instead of actually executing it. I have tried everything to overcome this problem (changed short_open_tag to on in php.ini, added the recommended lines to the apache httpd.conf file etc) but nothing works and it's driving me crazy.

Anybody here able to help me with that? It would be much appreciated.

Rudy

Reply With Quote
  #2  
Old April 11th, 2006, 08:43 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 9
"didn't show ASP pages, so I figured PHP scripts wouldn't run with it either" - Although this isn't necessarily true, I think Apache is a better option for PHP.

I would like to clarify first, as I don't see that you've stated it... You have your PHP file in Apache's home directory and are trying to access it with your browser pointed at http://localhost/somefile.php correct?

Have you added the lines to the apache conf file for AddType and LoadModule?
__________________
Daryl's Homepage | My Blogroll | My Profile | Firefox supporter!
DevArticles Forum Moderator

"The net is a waste of time, and that's exactly what's right about it." -- William Gibson

Reply With Quote
  #3  
Old April 11th, 2006, 09:27 AM
metropolis2k metropolis2k is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Posts: 3 metropolis2k User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 35 m 14 sec
Reputation Power: 0
I have configured c:\web as my apache webdir and consequently have added the two lines you mentioned (loadmodule and addtype) to my conf file. Still showing php source code though (and it's only a simple time/date display script too)

Reply With Quote
  #4  
Old April 11th, 2006, 10:39 AM
metropolis2k metropolis2k is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Posts: 3 metropolis2k User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 35 m 14 sec
Reputation Power: 0
Haha, I think I'll just try EasyPHP, that is supposed to have everything covered. Still stumps me though why the stupid thing shows source code instead of the execution of a simple script php.

Reply With Quote
  #5  
Old April 12th, 2006, 09:15 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 9
Wait, don't giveup so soon.
If you didn't have the Apache configurations setup, you might have missed some other stuff.

Apache doesn't just know how to read a PHP file... it must be configured to send the script to the PHP interpreter first...

I found a simple blog post which covers how to set up Apache and PHP on Windows. There's also a couple articles here on Devarticles.

Reply With Quote
  #6  
Old April 13th, 2006, 01:20 PM
infamous-online infamous-online is offline
Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 404 infamous-online User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 27 m 25 sec
Reputation Power: 8
from the sounds of your respones you've done nothing to make sure php works with either server.

with apache in your httpd.conf file you'll have to add these 3 lines.

LoadModule php5_module c:\php5\php5apache2.dll
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps


of course, you would have to point to your own php folder.


with IIS the process is the same, except that you only have to point the isapi file. using your iis manager point to the isapi file like this, c:\php5\php5isapi.dll and that's it.

also make sure your php5ts.dll is in the system32 folder.
__________________
Apache Expert

Reply With Quote
  #7  
Old April 22nd, 2009, 09:11 PM
lazykate lazykate is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2009
Posts: 1 lazykate User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m
Reputation Power: 0
Short tags?

I had this problem and it was in php.ini short_open_tag was defaulted to off.

<?php pages worked OK

<? pages showed the source

I know this is an old thread, but might still help someone searching!

Reply With Quote
  #8  
Old May 28th, 2009, 01:30 PM
sfm sfm is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2009
Posts: 1 sfm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 21 sec
Reputation Power: 0
Thumbs up PHP showing source

Quote:
Originally Posted by lazykate
I had this problem and it was in php.ini short_open_tag was defaulted to off.

<?php pages worked OK

<? pages showed the source

I know this is an old thread, but might still help someone searching!


It did, and ended countless hours that had driven me mad.

I registered to this board just to say

THANK YOU!!!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsWeb DesignWeb Server Configuration > PHP pages won't load, show source code (Apache 2/PHP 5)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
Stay green...Green IT