473,727 Members | 2,034 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 9590
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********@yaho o.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/JASHcRAiCSAJ9Yu WIu5XObLQBNNgLq 8mEsbfGeJACfWEN I
oygV1qgzLJkTrsh hyoGheuA=
=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****@lillesv in.linux.dk> wrote in message news:<200407210 71319.7eda0008@ lapsvin>...
On 20 Jul 2004 22:01:19 -0700
pe********@yaho o.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****@lillesv in.linux.dk> wrote in message news:<200407210 71319.7eda0008@ lapsvin>...
On 20 Jul 2004 22:01:19 -0700
pe********@yaho o.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
2589
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 the .php extension as a web page (edit, display, navigation, etc.), I am trying to set it up to parse files with the .html extension. I have added the .php and .html extensions to the Application Configuration page of IIS and I have also applied...
8
2204
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 supposed to do the same thing. These pages are Test10 and Test20 namely print out "Hello World" Test10 works (after a fashion)
11
15652
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. *FILE29*.TXT). I'm looking for a way to do this in either Visual Basic or C(++). Thanks!
0
1138
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 collection directly the event does not fire :(. Is that standard behaviour? *---------------------------------* Posted at: http://www.GroupSrv.com Check: http://wwww.HotCodecs.com *---------------------------------*
21
2665
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; }; forwarders { 4.2.2.2; }; };
0
1019
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 heavily by the options defined in my EXE.APP.CONFIG file. The way I deliver updates to my users is by placing the exe and exe.config on a shared drive. Then I load the assembly from the shared drive to see if a newer version exists or not. If so, the...
1
1564
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 in the column. Is there some kind of insert script, or bulk copy that I can use? I have about 150 docs and I would rather not go through the whole app, pick the file, upload it. etc. thx, M@
11
2700
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 reads expressions? (If the former case, why can't functions be called before their definitions?) Thanks, Jordan
4
1931
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 it finds another string ("hopid"). And I want to save that line. How would I go about doing this? My file looks like this: First Line Second Line
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9406
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9261
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9185
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9121
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8106
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6703
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4521
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2158
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.