Click to See Complete Forum and Search --> : PHP4 on win 98
trooper
05-04-2001, 08:39 AM
Hi
I've just installed apache 1.3.19 and php4 (not via phpinstaller).
My httd.conf file has the follwing code
LoadModule php4_module g:/php4/sapi/php4apache.dll
AddType application/x-httpd-php .php4
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
I know that php is recognised by the server because when the server loads up it says
Apache/1.3.19 (Win32) PHP4/4.0.5 running
I have 2 questions
What is the code i need to put to get the server to allow html files to have php in them, and,
why does none of my php code actually get parsed by the server.
I have put in <? echo "hello"?> in an html file and it doesn't show up!
Any help would be much appricated
Thanks Guys
Gary
Gary, if you do not mind, forward me the any replies you receive. I am facing this exact challange.
Thanks.
ldivinag
05-04-2001, 12:39 PM
cause you missed the important syntax:
<?php ...?>
otherwise, if you dont have that, it doesnt know what language to process...
for example, here's how to get PHP info:
<? php phpinfo(); ?>
Hi,
look into your installation guide for installing php4 with the apache server.
Did you forget to put the php.ini into the windows directory.
Another mistake could be, that you missed to setup the action add command.
with best regards
ts
ame12
05-05-2001, 07:08 AM
See some example 'hello world' pages here:
http://badblue.com/helpphps.htm
http://badblue.com/helpphpf.htm
If these don't work, Apache is not conf'ed correctly.
Dave
mithril
05-05-2001, 09:47 PM
gary mailer wrote:
-------------------------------
My httd.conf file has the follwing code
LoadModule php4_module g:/php4/sapi/php4apache.dll
AddType application/x-httpd-php .php4
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Hey Gary,
The answer to your problem lies in the information above, or rather what's not in the information above:)
Add the following line:
AddType application/x-http-php .html .htm
restart Apache, and all HTML files will be magically parsed:) You can use the AddType directive to make PHP read whatever extension you wish. Regarding the comments about using short tags (ie. <? ?>), you must have the shot_open_tag directive in php.ini set equal to on to use that tag format. I think it's enabled by default. Although the polically correct method is to use full tags, it doesn't really matter. If you want to be HTML 4.0 compliant you can also use:
<script language = "php">
// some code
</script>
This has advantages since some of the dodgier, but most common GUI editors (cough, cough.... Frontpage), will play ducks and drakes with code embedded using the normal php tags. Hope this helps!!!
Cheers,
Geoff A. Virgo
sounds like a daft suggestion but make sure your files end in a .php extension or similar
when I first started running php it took me a while to work out that this was my problem - I instantly assumed there was a problem with the installation. Things improved when I switched from Personal Web Server (yuck!) to Xitami (and more recently OmniHTTPD).
Probably just betraying my newbie tendencies!
PHP Builder
Copyright WebMediaBrands Inc. All Rights Reserved.