The first try, however failed

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
zhshqzyc
Forum Newbie
Posts: 4
Joined: Tue Mar 21, 2006 8:06 pm

The first try, however failed

Post by zhshqzyc »

I just setup apache2.0,mysql 5.0 and php 5.
My Apache is installed at c:\Programs Files\Apache Group\Apache2
My MySql is installed at c:\MySQL
My Php is installed at c:\php

I save a php file named as a.php at c:\Programs Files\Apache Group\Apache2\htdocs
My web is http://127.0.0.1
We I input http://127.0.0.1/a.php

"The request URL is not on the server"

What is wrong?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

did you follow the installation instructions for PHP with Apache 2?

Moved to Web Servers.
zhshqzyc
Forum Newbie
Posts: 4
Joined: Tue Mar 21, 2006 8:06 pm

Post by zhshqzyc »

Yes, I did.

# For PHP 5 do something like this:
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php



However, I didn't do :
# configure the path to php.ini
PHPIniDir "C:/php"

because I couldn't find PHPIniDir in php.ini

Is it the cause?
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

Where did you put a.php?

It's not supposed to go into C:/php, it needs to go in your web document root.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

PHPIniDir is a directive for the httpd.conf file, not in the ini itself. The string details the location of the ini so PHP can find the correct one when it searches for it.
zhshqzyc
Forum Newbie
Posts: 4
Joined: Tue Mar 21, 2006 8:06 pm

Post by zhshqzyc »

a.php
locates at
c:\Programs Files\Apache Group\Apache2\htdocs
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Test a few things. First, on your machine, in your browser address bar, enter http://localhost/.

If you have not installed any files in the C:\Program Files\Apache Group\Apache2\htdocs folder you should get the generic Apache index page telling you the server is set up correctly. If that works, then...

Create a "hello world" HTML page and save it as C:\Program Files\Apache Group\Apache2\htdocs\hello.html. Call it using localhost:

Code: Select all

<html><head><title>Test HTML Page</title></head><body>Hello World!</body></html>
http://localhost/hello.html

If that works then...
Open up your httpd.conf file located in C:\Program Files\Apache Group\Apache2\conf folder and make sure there is a LoadModule and AddHandler that tells apache to actually parse PHP though the PHP engine. If they are there then make a phpinfo page and save it as C:\Program Files\Apache Group\Apache2\htdocs\php-info.php.

Code: Select all

<?php
phpinfo();
?>
Call it like this...

http://localhost/php-info.php

If that doesn't work, post back and let us know what is happening.
zhshqzyc
Forum Newbie
Posts: 4
Joined: Tue Mar 21, 2006 8:06 pm

Post by zhshqzyc »

http://localhost/. doesn't work.
I set
UserDir "My Documents/My Website"
is different the DocumentRoot C:\Program Files\Apache Group\Apache2\htdocs

Is it a problem?
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

make sure httpd is running in the task manager and make sure IIS is shut off. If you're running xp pro check services running in your system manager.
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

I'd add at the least make sure you don't have two webservers trying to listen at the same time to port 80....
User avatar
tasteslikepurple
Forum Commoner
Posts: 46
Joined: Thu Jan 26, 2006 3:38 am
Location: Bath, UK

Post by tasteslikepurple »

there's a good apache/php/mysql/just about everything else you need on a webserver package out there called xampp. it's an easy install and it works straight away :)

http://www.apachefriends.org/en/xampp.html

p.s. uninstall all apache and php stuff first
Post Reply