Connecting Tech Pros Worldwide Forums | Help | Site Map

Problem getting started with PHP after installing Apache and PHP

Newbie
 
Join Date: Apr 2007
Posts: 3
#1: Apr 2 '07
It pains me to ask such a dumb question but...

I already use PHP widely on a host server but I want to pre-test scripts on my (Windows) machine. I installed Apache(2_2) without problems but, having then installed PHP5 (Windows binary) carefully following instructions (default settings), it shows me the raw PHP code not the interpreted stuff. Even if I run PHP from a command line with a minimal script, it still shows me the raw code and not what I want to see, so it does not seem to be anything to do with my Apache installation/config.

Troubleshooting guides just say "make sure that it shows you..." but it does not. I have searched for an answer - honestly.

TIA
Bev

ronverdonk's Avatar
Moderator
 
Join Date: Jul 2006
Location: The Netherlands
Posts: 4,139
#2: Apr 2 '07

re: Problem getting started with PHP after installing Apache and PHP


You sure that your Apache configuration (in httpd.conf) does recognize the PHP extension? Do you have in there one or more ADDTYPE statements that look like
Expand|Select|Wrap|Line Numbers
  1. AddType application/x-httpd-php .php
Ronald :cool:
Newbie
 
Join Date: Apr 2007
Posts: 3
#3: Apr 2 '07

re: Problem getting started with PHP after installing Apache and PHP


Quote:

Originally Posted by ronverdonk

You sure that your Apache configuration (in httpd.conf) does recognize the PHP extension? Do you have in there one or more ADDTYPE statements that look like

Expand|Select|Wrap|Line Numbers
  1. AddType application/x-httpd-php .php
Ronald :cool:

Yes, precisely that line is there. But if it was just Apache's config, then using PHP from the command line to open the file should still give me the result and not the source code, which is what I get.

There must be a beginner's 'gotcha' in there somewhere.

Bev
Newbie
 
Join Date: Apr 2007
Posts: 3
#4: Apr 2 '07

re: Problem getting started with PHP after installing Apache and PHP


In case anyone treads this way again, it turned out that all my legacy PHP used "<?" to introduce the script instead of "<?php". I *now* know that the default is not to accept that.

Bev
ronverdonk's Avatar
Moderator
 
Join Date: Jul 2006
Location: The Netherlands
Posts: 4,139
#5: Apr 2 '07

re: Problem getting started with PHP after installing Apache and PHP


Thanks for sharing this experience with us.

Ronald :cool:
Motoma's Avatar
Moderator
 
Join Date: Jan 2007
Location: Maine, USA
Posts: 2,904
#6: Apr 2 '07

re: Problem getting started with PHP after installing Apache and PHP


Apache 2 will only run with PHP 5.2 or greater.
I usually use the WAMP5 package to install these in a windows environment.

Quote:

Originally Posted by coaa

It pains me to ask such a dumb question but...

I already use PHP widely on a host server but I want to pre-test scripts on my (Windows) machine. I installed Apache(2_2) without problems but, having then installed PHP5 (Windows binary) carefully following instructions (default settings), it shows me the raw PHP code not the interpreted stuff. Even if I run PHP from a command line with a minimal script, it still shows me the raw code and not what I want to see, so it does not seem to be anything to do with my Apache installation/config.

Troubleshooting guides just say "make sure that it shows you..." but it does not. I have searched for an answer - honestly.

TIA
Bev

Reply


Similar PHP bytes