473,387 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

PHP does not parse .PHP files

I have this problem with PHP that someone might be able to help.

With CLI, I am able to execute my .php files. For example, if I type
"php phpinfo.php" , this works fine on my system.

If I put the phpinfo.php file is in /var/www/html and I try to access
it through the browser, I get the content of the file and not the
execution of the file. Instead of display the info of PHP, I got the
text of the file as:

<?php
phpinfo();
?>
Why?
Thanks
Jul 17 '05 #1
7 9577
Phong Ho wrote:
I have this problem with PHP that someone might be able to help.

With CLI, I am able to execute my .php files. For example, if I type
"php phpinfo.php" , this works fine on my system.

If I put the phpinfo.php file is in /var/www/html and I try to access
it through the browser, I get the content of the file and not the
execution of the file. Instead of display the info of PHP, I got the
text of the file as:

<?php
phpinfo();
?>
Why?
Thanks


Do you have a webserver such as Apache running on the machine where
you expect this to happen? Because it's the webserver, not the
browser, that needs to know about php. The browser only does html.

Margaret
--
(To mail me, please change .not.invalid to .net, first.
Apologies for the inconvenience.)
Jul 17 '05 #2
"Phong Ho" wrote:
I have this problem with PHP that someone might be able to help.

With CLI, I am able to execute my .php files. For example, if I type "php phpinfo.php" , this works fine on my system.

If I put the phpinfo.php file is in /var/www/html and I try to access it through the browser, I get the content of the file and not the
execution of the file. Instead of display the info of PHP, I got the text of the file as:

<?php
phpinfo();
?>
Why?
Thanks


Is that directory in the path of your webserver’s htdocs directory?
CLI is not sensitive to this, but php executed as a webpage is.

--
http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-parse-fi...ict131346.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=438212
Jul 17 '05 #3
Phong Ho wrote:
I have this problem with PHP that someone might be able to help.

With CLI, I am able to execute my .php files. For example, if I type
"php phpinfo.php" , this works fine on my system.

If I put the phpinfo.php file is in /var/www/html and I try to access
it through the browser, I get the content of the file and not the
execution of the file. Instead of display the info of PHP, I got the
text of the file as:

<?php
phpinfo();
?>
Why?


You have to access the file through your /correctly configured/ server

http://localhost/phpinfo.php

and not through the file system

*this does not work*
file:///var/www/html/phpinfo.php
--
USENET would be a better place if everybody read: | to email me: use |
http://www.catb.org/~esr/faqs/smart-questions.html | my name in "To:" |
http://www.netmeister.org/news/learn2quote2.html | header, textonly |
http://www.expita.com/nomime.html | no attachments. |
Jul 17 '05 #4
Let me clarify this. The path of my Apache webserver is at
/var/www/html and I have a .php test file in this directory.

When I try to access to my test file through the browser
using http://localhost/phpinfo.php

I got:
<?php
phpinfo();
?>

Basically, Apache is sending the .php file without interpreting it
first.

I look at my httpd.conf file, I do have the right setting:

LoadModule php4_module libexec/libphp4.so
AddType application/x-httpd-php .php .phtml

I suspect Apache fails to load the libphp4.so at startup. How do I
verify that
Apache did load libphp4.so? I believe I have to use ld command but I
am not sure!!

I use Apache 2.0.x and php.4.3.x

Thanks


Pedro Graca <he****@hotpop.com> wrote in message news:<sl*******************@ID-203069.user.uni-berlin.de>...
Phong Ho wrote:
I have this problem with PHP that someone might be able to help.

With CLI, I am able to execute my .php files. For example, if I type
"php phpinfo.php" , this works fine on my system.

If I put the phpinfo.php file is in /var/www/html and I try to access
it through the browser, I get the content of the file and not the
execution of the file. Instead of display the info of PHP, I got the
text of the file as:

<?php
phpinfo();
?>
Why?


You have to access the file through your /correctly configured/ server

http://localhost/phpinfo.php

and not through the file system

*this does not work*
file:///var/www/html/phpinfo.php

Jul 17 '05 #5
On 20 Jul 2004 22:01:19 -0700
pe********@yahoo.com (Phong Ho) wrote:
Let me clarify this. The path of my Apache webserver is at
/var/www/html and I have a .php test file in this directory.

When I try to access to my test file through the browser
using http://localhost/phpinfo.php

I got:
<?php
phpinfo();
?>

Basically, Apache is sending the .php file without interpreting it
first.

I look at my httpd.conf file, I do have the right setting:

LoadModule php4_module libexec/libphp4.so
AddType application/x-httpd-php .php .phtml

I suspect Apache fails to load the libphp4.so at startup. How do I
verify that
Apache did load libphp4.so? I believe I have to use ld command but I
am not sure!!

I use Apache 2.0.x and php.4.3.x


Have you remembered to restart apache after changing the configuration?
If apache can't load the php-module it'll complain at startup I
believe...

Madsen

--
Anders K. Madsen --- http://lillesvin.linux.dk

"There are 10 types of people in the world.
Those who understand binary - and those who don't."

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA/ftylNHJe/JASHcRAiCSAJ9YuWIu5XObLQBNNgLq8mEsbfGeJACfWENI
oygV1qgzLJkTrshhyoGheuA=
=u/gP
-----END PGP SIGNATURE-----

Jul 17 '05 #6
Of course, I use apachectl stop, start and restart. Apache does not
complain about anything.
Does anyone have Apache 2.0.x, php.4.3.x and MySQL 4.0.x on Fedora 1.0
to work properly?
Thanks
"Anders K. Madsen" <ma****@lillesvin.linux.dk> wrote in message news:<20040721071319.7eda0008@lapsvin>...
On 20 Jul 2004 22:01:19 -0700
pe********@yahoo.com (Phong Ho) wrote:
Let me clarify this. The path of my Apache webserver is at
/var/www/html and I have a .php test file in this directory.

When I try to access to my test file through the browser
using http://localhost/phpinfo.php

I got:
<?php
phpinfo();
?>

Basically, Apache is sending the .php file without interpreting it
first.

I look at my httpd.conf file, I do have the right setting:

LoadModule php4_module libexec/libphp4.so
AddType application/x-httpd-php .php .phtml

I suspect Apache fails to load the libphp4.so at startup. How do I
verify that
Apache did load libphp4.so? I believe I have to use ld command but I
am not sure!!

I use Apache 2.0.x and php.4.3.x


Have you remembered to restart apache after changing the configuration?
If apache can't load the php-module it'll complain at startup I
believe...

Madsen

Jul 17 '05 #7
Fedora uses by default the httpd.conf in /etc/httpd/conf . It does not
use the httpd.conf in /usr/local/apache2/conf as I thought.

"Anders K. Madsen" <ma****@lillesvin.linux.dk> wrote in message news:<20040721071319.7eda0008@lapsvin>...
On 20 Jul 2004 22:01:19 -0700
pe********@yahoo.com (Phong Ho) wrote:
Let me clarify this. The path of my Apache webserver is at
/var/www/html and I have a .php test file in this directory.

When I try to access to my test file through the browser
using http://localhost/phpinfo.php

I got:
<?php
phpinfo();
?>

Basically, Apache is sending the .php file without interpreting it
first.

I look at my httpd.conf file, I do have the right setting:

LoadModule php4_module libexec/libphp4.so
AddType application/x-httpd-php .php .phtml

I suspect Apache fails to load the libphp4.so at startup. How do I
verify that
Apache did load libphp4.so? I believe I have to use ld command but I
am not sure!!

I use Apache 2.0.x and php.4.3.x


Have you remembered to restart apache after changing the configuration?
If apache can't load the php-module it'll complain at startup I
believe...

Madsen

Jul 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Stuart Baker | last post by:
I just installed PHP (4.3.3) on a WinXP (SP1) system using IIS (5.1) as the web server. I am using FrontPage 2002 and would like to be able to debug my PHP scripts locally. Since FP does not handle...
8
by: tooheys | last post by:
This may be to simple for the level of material I've already seen here, but nothing ventured. I have two web page linked from http://www.rhodeisland-aa.org/ricsmeetings/index.htm They are...
11
by: Ben | last post by:
Greetings, I am looking for a way to search for and delete files based on a pattern mask. For example, the search method would find all files matching a certain pattern containing wildcards (e.g....
0
by: tolisss | last post by:
Hi to all i have some validation code inside ListChanged event and i have that collection bound to a grid. If i change a value on the grid the event fires ok. But if i change a value of the...
21
by: William Stacey [MVP] | last post by:
Anyone know of some library that will parse files like following: options { directory "/etc"; allow-query { any; }; // This is the default recursion no; listen-on { 192.168.0.225;...
0
by: marfi95 | last post by:
I have 2 questions. First a little background. I have an app that is used by my entire team to parse files and some other stuff that we normally do during the day. This app is driven very...
1
by: M | last post by:
I have a directory of files that I would like to upload with some data to a table so that I can store the files in the db. I'm not trying to parse files into rows, I want to stick the actual file...
11
by: MonkeeSage | last post by:
A quick question about how python parses a file into compiled bytecode. Does it parse the whole file into AST first and then compile the AST, or does it build and compile the AST on the fly as it...
4
by: katwala | last post by:
I am trying to write a script to do the following. Go thru the file until it finds an expression ("9227493"). Once this expression is found, I want the script to search in a reverse fashion until...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.