Page 1 of 2
Can't get php to work
Posted: Thu Jun 19, 2003 12:56 pm
by Liansky
HI there. I'm new to both this forum and proggramming php.
I downloaded the latest php(4.3.2) and manually installed it, and then i installed the latest Apache(2.0.46) via the installer.
The problem is, i inserted the "hello world" example into the apache folder, and all i get is the heading and nothing else. Hello world does not appear on the web page. The echo function does not seem to work.
An example of the "hello world" example....
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php echo "<p>Hello World</p>"; ?>
</body>
</html>
I can get it to work using a html extension, but only gives me the heading when using the php extension.
Here's a list of things i did....
copied c:\\php\php4ts.dll to c:\\winnt\system32
copied c:\\php\php.ini-reccomended to c:\\winnt and renamed it to php.ini
set doc root in php.ini file to point to apache
added code to the apache config file to configure php and apache as module
changed extension_dir(in php.ini) to be eqaul to c:/php/extensions
changed :extension = php_bz2.dll and took away the ';'
What else should i do to make the thing to work.
I use win2000 by the way...
Posted: Thu Jun 19, 2003 5:38 pm
by cactus
The problem could be due to the miss-association of .php extension in your apache config.
When you ran the script did it show everything you dipslayed above, including the "<?php echo "<p>Hello World</p>"; ?>" and not just "Hello World" ?
The following references should point you in the right direction:
http://uk.php.net/manual/en/install.windows.php
http://uk.php.net/manual/en/install.apa ... he.windows
http://httpd.apache.org/docs/windows.html
Regards,
Posted: Thu Jun 19, 2003 6:22 pm
by Liansky
Thank you oh so much for giving me the links. I'll try them now...
When i ran the script, it only showed the heading(PHP Test), and a blank page...
Posted: Fri Jun 20, 2003 2:50 am
by twigletmac
What did the source code of the page look like?
Mac
Posted: Fri Jun 20, 2003 2:01 pm
by Liansky
Source code?? You have to more specific on that one...
Posted: Fri Jun 20, 2003 2:03 pm
by Liansky
To be more specific, the echo doesn't work....
Posted: Fri Jun 20, 2003 2:04 pm
by nielsene
Did you try a "view/show source" on the page?
Posted: Fri Jun 20, 2003 3:22 pm
by Liansky
Um, i have no idea what that is. I'm shamefully new at this.
Maybe i'll just delete everything, and start all over again...
Posted: Fri Jun 20, 2003 3:39 pm
by releasedj
Take a look at the PHP manual for setting up Apache 2
http://www.php.net/manual/en/install.apache2.php.
This will give you some guidelines into setting up the server for php.
Posted: Fri Jun 20, 2003 5:45 pm
by Liansky
I did, and i cannot figure out where i went wrong. I even made notes on every single change that i made.
But, i'm re-installing my operating system, so i'll try to do it over. My pc started going all bonkers after i tried to install Enter The Matrix.... which didn't install right. How typical....
Posted: Fri Jun 20, 2003 9:40 pm
by nielsene
nielsene wrote:Did you try a "view/show source" on the page?
Liansky wrote:Um, i have no idea what that is....
Ok after you finish the re-installing you mention, try this:
1) Try loading your hello world example, make sure the hello world file has a .php extension, not a .html
2) If the "hello world" doesn't show up, go to the menu bar of your browser, select "View" and then select "Source" (in MSIE) or "Page Source" (in Mozilla/Netscape)
3) Is the <?php echo ... ?> line visible in the source window that opens?
Posted: Sat Jun 21, 2003 5:04 am
by volka
if you use the php zip package from
http://php.net/downloads you can do the installation by the book (aka install.txt). But note the
ATTENTION: Apache 2 Users section.
you might test the php installation stand-alone first.
Create a small script file in your php directory, e.g. called
test.php containing something like <?php phpinfo(); ?>
now open a command shell, change to your php directory and type
php.exe -l test.php
If php itself works properly it should return
No syntax errors detected in test.php
Now you can move the script file to the htdocs directory of your apache.
if you request
http://localhost/test.php now and see nothing, open the source view. If the complete script is shown your Apache isn't set up to let php handle php-scripts and you have to check
Installing PHP for Apache as module in install.txt again (if you're going to install php as module.
Installing PHP for Apache as CGI binary if you plan to run php as cgi)
Posted: Sat Jun 21, 2003 5:11 am
by releasedj
Maybe it's worth getting a package which installs PHP, MySQl and Apache together to start with.
Posted: Sat Jun 21, 2003 6:07 am
by volka
yo, I'm always too focused on the initial question.
phptriad has been mentioned here some times.
wampp is another package
wampp 2.2
ZIP RAR 06. june 2003
42 MB 33 MB released
apache 2.0.46, MySQL 4.0.13, PHP 4.3.2 + PEAR, Perl 5.8.0, mod_php 4.3.2, mod_perl 1.99_10, mod_ssl 2.0.46, openssl 0.9.7b, PHPMyAdmin 2.5.1, Webalizer 2.01-10, Mercury Mail Transport System for Win32 and NetWare Systems v3.32, JpGraph 1.12.1, Fastsream NetFile Server 5.6.0.511, (WEB-DAV + MOD AUTH MYSQL experimental); well suitably as server service under NT, w2k, XP Prof. [last modify: 06.06.02]
Posted: Sat Jun 21, 2003 10:17 am
by Liansky
Volka, you are a <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span> genius without even knowing it for Christs sakes. All i had to do was move my file to htdocs. I mean <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>, i thought i had to leave it in the main apache folder. Thank you very much and God <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span> bless...
To all of the others: You see, i know how to read a goddamn manual. Just a pity the goddamn manual aint specific on where to move the source code...