Teen Programmers Unite  
 

 

Return to forum top

Need help with PHP (very noob-like question)

Posted by CodeRed [send private reply] at January 14, 2002, 07:43:52 PM

I got Apache set up and running properly and PHP installed and I copied the first example code in the PHP documentation and tried to access it but all I got was the HTML part, not the PHP part.

The code is:

<html>
<head><title>Example</title></head>
<body>
<?php
echo "Hi, Iım a PHP script!";
?>
</body>
</html>

It is contained in the file test.php in the apache htdocs folder. I access it by typing http://localhost/test.php but I get a blank screen that says "Example" in the title bar, so the HTML is working fine, but not the PHP code.

Posted by buzgub [send private reply] at January 14, 2002, 07:45:33 PM

What do you see when you view the pages source?

Posted by CodeRed [send private reply] at January 14, 2002, 07:51:33 PM

I see the exact same thing that is in the test.php file. I shouldn't see the php code should I? what the hell is wrong?

Posted by buzgub [send private reply] at January 14, 2002, 08:24:44 PM

You need to have a loadModule line for the php interpreter, and to have restarted the apache server after that's set up. Is that all happening?

Posted by CodeRed [send private reply] at January 14, 2002, 08:47:09 PM

How would I do that? What file? What do I write?

Posted by buzgub [send private reply] at January 14, 2002, 08:56:36 PM

RTFM. http://www.php.net/manual/en/install.windows.php

Posted by CodeRed [send private reply] at January 15, 2002, 02:26:58 AM

"The installation wizard gathers enough information to set up the php.ini file and configure the web server to use PHP"

Well, it didn't. It said something like "Sorry cannot currently configure php for apache, you will have to do it manually" I can't figure out how to do that, I read the manual install instructions below the InstallShield section but it doesn't say anything about apache

Posted by CodeRed [send private reply] at January 15, 2002, 02:27:35 AM

Oh, I'm wrong, never mind

Posted by CodeRed [send private reply] at January 15, 2002, 02:35:03 AM

No, I still need help. The manual says:

"You will need to change the 'extension_dir' setting to point to your php-install-dir, or where you have placed your 'php_*.dll' files. ex: c:\php\extensions

If you are using OmniHTTPd, do not follow the next step. Set the 'doc_root' to point to your webservers document_root. For example: c:\apache\htdocs or c:\webroot"

But this is my php.ini file:

////////////////////////////////////////////////////////
; php.ini for PEAR tests
include_path=..

[mail function]
SMTP= localhost ; for Win32 only
sendmail_from= me@localhost.com ; for Win32 only

[Session]
session.save_path= C:\Program Files\PHP\sessiondata ; argument passed to save_handler

[PHP]
error_reporting= E_ALL; display all errors, warnings and notices
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

As you can see NONE of the stuff mentioned in the manual is in here, and it doesn't say exactly where to add it.

Posted by gian [send private reply] at January 15, 2002, 02:44:54 AM

Use the CGI module, as it is much easier to use... read the manual, as it *does* have stuff about adding an "AddHandler" to the apache config...

Posted by CodeRed [send private reply] at January 15, 2002, 07:57:55 PM

I got it, thanks. Wow it is easy, I should have learned this a long time ago

Posted by gian [send private reply] at January 15, 2002, 08:00:19 PM

Indeed it is...

You must be logged in to post messages and see which you have already read.

Log on
Username:
Password:
Save for later automatic logon

Register as a new user
 
Copyright TPU 2002. See the Credits and About TPU for more information.