Connecting Tech Pros Worldwide Forums | Help | Site Map

Apache2 Not Recognizing PHP

solitary.wanderer52@gmail.com
Guest
 
Posts: n/a
#1: Nov 5 '06
I just finished installing PHP5 on Linux (Debian/Ubuntu/Mepis)/Apache2
using Synaptic. I have tried creating simple html pages, placing them
in /var/www and pointing the browser at http://127.0.0.1/(those pages)
and they are displayed correctly.

I have created a basic PHP page (abc.php) and it looks like:

<?
phpinfo();
?>

This page also exists in the /var/www directory and when I point the
browser to http://127.0.0.1/abc.php, the page gets loaded into a text
editor.

How can I fix this?


TIA, Steve


Mladen Gogala
Guest
 
Posts: n/a
#2: Nov 5 '06

re: Apache2 Not Recognizing PHP


On Sat, 04 Nov 2006 19:52:50 -0800, solitary.wanderer52 wrote:
Quote:
I just finished installing PHP5 on Linux (Debian/Ubuntu/Mepis)/Apache2
using Synaptic. I have tried creating simple html pages, placing them
in /var/www and pointing the browser at http://127.0.0.1/(those pages)
and they are displayed correctly.
>
I have created a basic PHP page (abc.php) and it looks like:
>
<?
phpinfo();
?>
>
This page also exists in the /var/www directory and when I point the
browser to http://127.0.0.1/abc.php, the page gets loaded into a text
editor.
>
How can I fix this?
>
>

Well, you have to put the instructions to recognize page type into the
httpd.conf. These instructions usually look like this:

$ grep -i php /etc/httpd/conf/httpd.conf
LoadModule php5_module /usr/lib/httpd/modules/libphp5.so
AddType application/x-httpd-php .php
$

My PHP pages execute properly.

--
http://www.mladen-gogala.com

solitary.wanderer52@gmail.com
Guest
 
Posts: n/a
#3: Nov 6 '06

re: Apache2 Not Recognizing PHP


Mladen Gogala wrote:
Quote:
On Sat, 04 Nov 2006 19:52:50 -0800, solitary.wanderer52 wrote:
>
Quote:
I just finished installing PHP5 on Linux (Debian/Ubuntu/Mepis)/Apache2
using Synaptic. I have tried creating simple html pages, placing them
in /var/www and pointing the browser at http://127.0.0.1/(those pages)
and they are displayed correctly.

I have created a basic PHP page (abc.php) and it looks like:

<?
phpinfo();
?>

This page also exists in the /var/www directory and when I point the
browser to http://127.0.0.1/abc.php, the page gets loaded into a text
editor.

How can I fix this?
>
>
Well, you have to put the instructions to recognize page type into the
httpd.conf. These instructions usually look like this:
>
$ grep -i php /etc/httpd/conf/httpd.conf
LoadModule php5_module /usr/lib/httpd/modules/libphp5.so
AddType application/x-httpd-php .php
$
>
My PHP pages execute properly.
>
--
http://www.mladen-gogala.com
Okay, I added the following to my httpd.conf file (which is located in
/etc/apache2:

LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
AddType application/x-httpd-php .php .php5

When I restart or force-reload the web server, the page loads, but
displays no info (I am using FF 1.5.0.7). If I have it display source,
I get:

<?
phpinfo();
?>

So, this is an improvement. Any further ideas???


Steve

Riemer Palstra
Guest
 
Posts: n/a
#4: Nov 6 '06

re: Apache2 Not Recognizing PHP


On 2006-11-06, solitary.wanderer52@gmail.com
<solitary.wanderer52@gmail.comwrote:
Quote:
When I restart or force-reload the web server, the page loads, but
displays no info (I am using FF 1.5.0.7). If I have it display
source, I get:
>
><?
phpinfo();
?>
Looks like you don't have short_open_tag support on (which is good,
actually.) What if you change the first line to say <?php instead of <?

--
Riemer Palstra Amsterdam, The Netherlands
riemer@palstra.com http://www.palstra.com/
solitary.wanderer52@gmail.com
Guest
 
Posts: n/a
#5: Nov 6 '06

re: Apache2 Not Recognizing PHP



Riemer Palstra wrote:
Quote:
On 2006-11-06, solitary.wanderer52@gmail.com
<solitary.wanderer52@gmail.comwrote:
Quote:
When I restart or force-reload the web server, the page loads, but
displays no info (I am using FF 1.5.0.7). If I have it display
source, I get:

<?
phpinfo();
?>
>
Looks like you don't have short_open_tag support on (which is good,
actually.) What if you change the first line to say <?php instead of <?
>
--
Riemer Palstra Amsterdam, The Netherlands
riemer@palstra.com http://www.palstra.com/
===

Riemer,

Thanks so much for your reply. Works like a charm. And now I even
have phpinfo giving info about mysql, which is what I originally wanted
before changes on my part seemed to foul everything up.

Where does one enable short_open_tag and why do you feel that not
having it is good?

Thanks again, Steve

Riemer Palstra
Guest
 
Posts: n/a
#6: Nov 6 '06

re: Apache2 Not Recognizing PHP


On 2006-11-06, solitary.wanderer52@gmail.com
<solitary.wanderer52@gmail.comwrote:
Quote:
Where does one enable short_open_tag and why do you feel that not
having it is good?
Normally you can define it in php.ini or any other place you put your
PHP configuration directives. In most situations it won't cause any
harm, but sometimes it could (potentially) cause confusion with XML
tags.

--
Riemer Palstra Amsterdam, The Netherlands
riemer@palstra.com http://www.palstra.com/
Closed Thread


Similar PHP bytes