My expectation was that konqueror, apache and php4 would work "right out of the box" after I updated my SuSE Linux 7.1 system to 7.2, but so far I have not had any luck running even a simple php script. Are there any specific "tweaks" that need to be done in order to get this setup working? Here is the script I am working with ("phptest.html"): <html> <head> <title>PHP Test Example</title> </head> <body> <?php echo <hr>; echo date("H:i, jS F"); echo <p>; echo Hi, I am a PHP script!<p>; echo <hr>; ?> </body> </html> When I open this file with konqueror (or Netscape), the output I get looks like this: The window/document shows the title bar "PHP Test Example" Within the browser window it shows: ; echo date("H:i, jS F"); echo ; echo Hi, I am a PHP script! ; echo -------------------------<a horizontal rule>___________________ ; ?> Any ideas on what I am doing wrong or what I need to do to fix this? TIA, Sean -- Theo. Sean Schulze theo.schulze@myokay.net "[T]he key to maintaining leadership in the economy and the technology that are about to emerge is likely to be the social position of knowledge professionals and social acceptance of their values." -- Peter Drucker
On Thursday 13 September 2001 09:27, Theo. Sean Schulze wrote: Hi,
Here is the script I am working with ("phptest.html"):
Try calling the file - phptest.php You need to give php files the right extension so that apache knows whats in them Phil -- Linux 2.4.4-4GB 10:46am up 1 day, 12 min, 1 user, load average: 1.88, 0.60, 0.35
On Thursday 13 September 2001 12:47, you wrote:
On Thursday 13 September 2001 09:27, Theo. Sean Schulze wrote:
Hi,
Here is the script I am working with ("phptest.html"):
Try calling the file - phptest.php
You need to give php files the right extension so that apache knows whats in them
I was under the impression that the <?php .... ?> tags were supposed to tell the browser and apache what to use to run the script. In any case, when I changed the filename to phptest.php and tried to open it with konqueror, konqueror just showed me the "Open with..." dialog box. Not even after entering /usr/bin/php as the application to open it with and checking the association creation button would konqueror display the page. Cheers, Sean -- Theo. Sean Schulze theo.schulze@myokay.net "[T]he key to maintaining leadership in the economy and the technology that are about to emerge is likely to be the social position of knowledge professionals and social acceptance of their values." -- Peter Drucker
On Thursday 13 September 2001 10:02, Theo. Sean Schulze wrote: Hi,
Try calling the file - phptest.php
You need to give php files the right extension so that apache knows whats in them
I was under the impression that the <?php .... ?> tags were supposed to tell the browser and apache what to use to run the script.
No, it uses the file extension.
In any case, when I changed the filename to phptest.php and tried to open it with konqueror, konqueror just showed me the "Open with..." dialog box.
Sounds like Apache is not set-up for php. Check that it is installed, and then look in your httpd.conf file for something like <IfModule mod_php4.c> AddType application/xhttpd-php .php AddType application/xhttpd-php .php4 </IfModule> and make sure it is uncommented. This will tell apache what files with php extensions are. Cheers Phil -- Linux 2.4.4-4GB 11:18am up 1 day, 44 min, 1 user, load average: 0.87, 0.24, 0.14
On Thursday 13 September 2001 13:25, you wrote:
On Thursday 13 September 2001 10:02, Theo. Sean Schulze wrote:
[snip]
Sounds like Apache is not set-up for php. Check that it is installed, and then look in your httpd.conf file for something like
<IfModule mod_php4.c> AddType application/xhttpd-php .php AddType application/xhttpd-php .php4 </IfModule>
and make sure it is uncommented. This will tell apache what files with php extensions are.
These uncommented lines are in my /etc/httpd/httpd.conf file: # # AddType allows you to tweak mime.types without actually editing it, or to # make certain files to be certain types. # # For example, the PHP 3.x module (not part of the Apache distribution - see # http://www.php.net) will typically use: # <IfModule mod_php3.c> AddType application/x-httpd-php3 .php3 AddType application/x-httpd-php3-source .phps AddType application/x-httpd-php3 .phtml </IfModule> # # And for PHP 4.x, use: # <IfModule mod_php4.c> AddType application/x-httpd-php .php AddType application/x-httpd-php .php4 AddType application/x-httpd-php-source .phps </IfModule> So, it shouldn't matter whether apache gets *.php or *.php4, it should still run use mod_php4.c. It is beginning to look to me like php is misbehaving. Or, am I reading this wrong? Cheers, Sean -- Theo. Sean Schulze theo.schulze@myokay.net "[T]he key to maintaining leadership in the economy and the technology that are about to emerge is likely to be the social position of knowledge professionals and social acceptance of their values." -- Peter Drucker
You are aware of course that php is SERVER SIDE scripting and has nothing
to do with the browser, right? You cannot just open a .php file directly
from a browser and see it working, you have to open it through a web server.
Avi
--On Thursday, September 13, 2001 12:02:20 PM +0200 "Theo. Sean Schulze"
I was under the impression that the <?php .... ?> tags were supposed to tell the browser and apache what to use to run the script.
-- Avi Schwartz avi@CFFtechnologies.com "I have to share the credit. I invented it, but Bill made it famous." - IBM engineer Dave Bradley describing the control-alt-delete reboot sequence
On Thursday 13 September 2001 14:57, you wrote:
You are aware of course that php is SERVER SIDE scripting and has nothing to do with the browser, right? You cannot just open a .php file directly from a browser and see it working, you have to open it through a web server.
Avi, Yes, I understand that. That is why I was concentrating my efforts on apache and php, rather than on konqueror and netscape. But I thought the browser passed some information to apache. As I look at this, I am starting to get a better idea of the relationship of all the pieces. In the meantime, I have also figured out why my script wouldn't run. It was in the wrong directory. I was trying to open a file from within my home directory and not from within the DocumentRoot directory set in /etc/httpd/httpd.conf. Once I moved the file to that directory (and corrected a syntax error or two), the script ran great. Thanks for your help. Cheers, Sean -- Theo. Sean Schulze theo.schulze@myokay.net "[T]he key to maintaining leadership in the economy and the technology that are about to emerge is likely to be the social position of knowledge professionals and social acceptance of their values." -- Peter Drucker
rename your file phptest.php or .php3 or .php4 depending on how apache is setup. Apache looks at the file extension to discover what sort of file it is and what processing needs to be applied to a file. ie unless you tell apache that a .php file goes to the php processor it will just try and display it. You need to check /etc/httpd/httpd.conf to see what files are associated with what by apache. dids
My expectation was that konqueror, apache and php4 would work "right out of the box" after I updated my SuSE Linux 7.1 system to 7.2, but so far I have not had any luck running even a simple php script. Are there any specific "tweaks" that need to be done in order to get this setup working?
Here is the script I am working with ("phptest.html"):
<html> <head> <title>PHP Test Example</title> </head> <body>
echo <hr>; echo date("H:i, jS F"); echo <p>; echo Hi, I am a PHP script!<p>; echo <hr>;
?> </body> </html>
When I open this file with konqueror (or Netscape), the output I get looks like this:
The window/document shows the title bar "PHP Test Example"
Within the browser window it shows:
; echo date("H:i, jS F"); echo
; echo Hi, I am a PHP script!
; echo -------------------------<a horizontal rule>___________________ ; ?>
Any ideas on what I am doing wrong or what I need to do to fix this?
TIA, Sean
On Thursday 13 September 2001 13:02, you wrote:
rename your file phptest.php or .php3 or .php4 depending on how apache is setup.
Apache looks at the file extension to discover what sort of file it is and what processing needs to be applied to a file.
ie unless you tell apache that a .php file goes to the php processor it will just try and display it.
You need to check /etc/httpd/httpd.conf to see what files are associated with what by apache.
After I renamed the file to phptest.php4, this is the output I got in a browser window titled "PHP Test Example": ; echo date("H:i, jS F"); echo ; echo Hi, I am a PHP script! ; echo -----------------------------<horizontal rule>--------------------------- ; ?> This is what I have in /etc/httpd/httpd.conf: <IfDefine PHP> LoadModule php3_module /usr/lib/apache/libphp3.so </IfDefine> <IfDefine PHP4> LoadModule php4_module /usr/lib/apache/libphp4.so </IfDefine> I think I will try changing the module loaded with the PHP definition to php4 vice php3, but I'm not optimistic that that will help. Thanks, Sean -- Theo. Sean Schulze theo.schulze@myokay.net "[T]he key to maintaining leadership in the economy and the technology that are about to emerge is likely to be the social position of knowledge professionals and social acceptance of their values." -- Peter Drucker
participants (4)
-
Avi Schwartz
-
dids
-
Phil Shrimpton
-
Theo. Sean Schulze