PHP installation test wont work!

Hi,

I am brand new to PHP and MySQL, and am trying to install both on WinXP where I just installed Apache 1.3.1 I think - and it also has Oracle 9i database running.

Basically, I type in http://localhost into my browser (Mozilla) and it shows the successful installation page for apache. I then installed PHP 5 from the installer, and have edited the config file for apache and the php.ini file which i have copied to windows, windows/system32 etc. PHP is in c:/php. When i installed php it said it hadnt configured apache.

i have changed doc root and extension_dir in php and accordingly in apache conf file. i have also added the AddType application... stuff in Apache. I think I have done it all ok, and then I have the test script saved asa php file in my doc root folder - c:/web:

<html>
<head>
      <title>PHP Test</title>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
      <h1>PHP Test</h1>
      <p>
      <b>An Example of PHP in Action</b><br />
            <?php echo "The Current Date and Time is: <br>";
                  echo date("g:i A l, F j Y.");?>
      </p>

      <h2>PHP Information</h2>
      <p>
            <?php phpinfo(); ?>
      </p>
</body>
</html>

I keep getting the error 404 when I try to test php in the browser by typing http://localhost/test.php

The requested URL /php/php.exe/test.php was not found on this server.

Apache/1.3.31 Server at localhost Port 80

and http://localhost doesnt even work in internet explorer.

any clues as to where I am going wrong - is it anything to do with Oracle and the apache that it has? when i try and stop the oracle apache it has an error in an sqlplus file which wasnt happening before and in fact a couple of errors from oracle have been happening at startup since.

Many thanks for your help ;o)
emmy21Asked:
Who is Participating?
 
sgalzinConnect With a Mentor Commented:
Hi,

Just in case you want to do a clean install from scratch, here are some notes I've written out for myself (please note it's what I consider a minimum effort's installation, i.e. not any optimizations / security concerns). Good luck !

Stephane.

*** BEFORE YOU START ***
download Apache2 : http://mir2.ovh.net/ftp.apache.org/dist/httpd/binaries/win32/apache_2.0.50-win32-x86-no_ssl.exe
download PHP5 : http://fr.php.net/distributions/php-5.0.1-Win32.zip
download PhpMyAdmin : http://ovh.dl.sourceforge.net/sourceforge/phpmyadmin/phpMyAdmin-2.6.0-rc1.zip
download MySQL : http://mir2.ovh.net/ftp.mysql.com/Downloads/MySQL-4.0/mysql-4.0.20d-win.zip

*** APACHE ***
- Install Apache to "<diskDriveLetter>:\<applicationFoler>" using the file apache_2.0.50-win32-x86-no_ssl.exe
  - DomainName =  <default>
  - ServerName =  localhost
  - ServerAdmin = webmaster@yourdomain.com
  - ServerPort =  80
- Edit the Apache configuration file "<diskDriveLetter>:\<applicationFoler>\Apache Group\Apache2\conf\httpd.conf" :
  - make sure the value of the port for the "Listen" setting is 80 (and not 8080) :
      Listen 80
  - make sure the value of the port for the "ServerName" setting is 80 (and not 8080) :
      ServerName localhost:80
  - replace the value of the "DocumentRoot" setting to :
      DocumentRoot "<diskDriveLetter>:/<folderOfYourChoice>/<subFolderOfYourChoice>/www"
- Test installation :
  - put the attached file index.html in folder <diskDriveLetter>:\<folderOfYourChoice>\<subFolderOfYourChoice>\www\
      copy index.html "<diskDriveLetter>:\<folderOfYourChoice>\<subFolderOfYourChoice>\www\index.html"
  - start Apache in console (using the shortcut provided in "Control Apache Server")
  - start your favorite Internet browser and go to http://127.0.0.1 :
      the page should say "Available projects on 127.0.0.1 (static) :"
  - kill the Apache console by pressing <Ctrl + c>

*** PHP ***
- Extract php-5.0.1-Win32.zip to "<diskDriveLetter>:\<applicationFoler>\php"
- Create a standard PHP configuration file "<diskDriveLetter>:\<applicationFoler>\php\php.ini" :
      copy "<diskDriveLetter>:\<applicationFoler>\php\php.ini-recommended" "<diskDriveLetter>:\<applicationFoler>\php\php.ini"
- Edit the Apache configuration file "<diskDriveLetter>:\<applicationFoler>\Apache Group\Apache2\conf\httpd.conf" :
  - add the follinwg line after the last LoadModule statement :
      LoadModule php5_module "<diskDriveLetter>:/<applicationFoler>/php/php5apache2.dll"
  - add the two follinwg lines after the last AddType statement :
      AddType application/x-httpd-php .php
      PHPIniDir "<diskDriveLetter>:/<applicationFoler>/php"
  - add the value "index.php" to the beginning of the DirectoryIndex list so that the list becomes :
      DirectoryIndex index.php index.html index.html.var
- Test installation :
  - put the attached file index.php in folder <diskDriveLetter>:\<folderOfYourChoice>\<subFolderOfYourChoice>\www\
      copy index.php "<diskDriveLetter>:\<folderOfYourChoice>\<subFolderOfYourChoice>\www\index.php"
  - start Apache in console
  - start your favorite Internet browser and go to http://127.0.0.1 :
      the page should say "Available projects on 127.0.0.1 (dynamic) :"
  - kill the Apache console by pressing <Ctrl + c>

*** MYSQL ***
- Extract phpMyAdmin-2.6.0-rc1.zip to "<diskDriveLetter>:\<folderOfYourChoice>\<subFolderOfYourChoice>\www"
- Launch the setup.exe program in mysql-4.0.20d-win.zip and start a typical installation in folder :
      "<diskDriveLetter>:\<applicationFoler>\mysql"
- Copy the libmysql.dll library provided by PHP to your Windows system folder :
      copy "<diskDriveLetter>:\<applicationFoler>\php\libmysql.dll" "c:\winnt\system32\libmysql.dll"
- Edit the PHP configuration file "<diskDriveLetter>:\<applicationFoler>\php\php.ini" :
  - change the extension directory :
      extension_dir = "./" to "<diskDriveLetter>:/<applicationFoler>/php/ext/"
  - activate mysql by uncommenting
      extension=php_mysql.dll
- Test installation :
  - execute in a command prompt :
      "<diskDriveLetter>:\<applicationFoler>\mysql\bin\mysqld" --console
  - start Apache in console
  - start your favorite Internet browser and go to http://127.0.0.1 and follow the phpMyAdmin-2.6.0-rc1 hyperlink
  - in the MySQL command prompt, kill MySQL by pressing <Ctrl + c>
  - kill the Apache console by pressing <Ctrl + c>





**********
index.html
**********
<html><head><title>root</title></head><body>
<center><h3>Available projects on 127.0.0.1 (static) :</h3></center><br><br>
</body>
</html>




**********
index.php
**********
<html><head><title>root</title></head><body>
<center><h3>Available projects on 127.0.0.1 (dynamic) :</h3></center><br><br>
<?php
$currentDirectory = dir ( "." );
while ( false !== ( $entry = $currentDirectory->read () ) ) if ( is_dir ( $entry ) && ( $entry != "." ) && ( $entry != ".." ) ) echo "<a href=\"" . $entry . "/\"> " . $entry . "</a><br />\n";
$currentDirectory->close();
?>
</body></html>
0
 
UmeshMySQL Principle Technical Support EngineerCommented:
Hi,

Did you restart apache server after changing config(httpd.conf) file ? if not restart & check the same once..

are you  running PHP as CGI or apache module?

Check this link..

http://php.us.themoes.org/manual/en/install.windows.apache1.php


Hope this helps!
0
 
gtkfreakCommented:
Does this work? http://127.0.0.1/test.php
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
gtkfreakCommented:
If http://127.0.0.1/test.php works, then check if you have an entry for it in your host file. To find the host file in windows, type:
dir host* /s/p at the dos prompt.
0
 
emmy21Author Commented:
Thanks to everyone for your help, I have come so far from when I first posted this question - which is the silver lining of when new things go wrong.

Basically I thin my initial problem was that I had installed a second Apache where I already had one with Oracle, this annoyed me as I thoght it was a bit silly to install a second copy, so I found some instructions on how to modify Oracle's apache and it all improved from there, I now have MySql up an running - as well as managing to enable oracle and run database queries from my oracle databases with php!

Thanks for your help, sure there will be more questions from me at some point!
0
 
CorsariCommented:
Thank to sgalzin for his tutorial

I've fixed some "bugs" and rewritten it here with some GUI improvements

http://fastec.altervista.org/Apache_PHP_MySQL.html
0
 
sgalzinCommented:
wow !

nice job, corsari : it is so much more readable (thanks to the html). i haven't tested it yet but i'm sure you're right about the bug fixes (my version was *very* minimal).

thanks for the effort, i'll redirect my friends to your page from now on !

stephane.
0
 
CorsariCommented:
Thank you stephane (sgalzin)

Yesterday I've completed the http://fastec.altervista.org/Apache_PHP_MySQL.html page with download for the two test files.

"bugs" in your memo where '\' and '/' (mainly). This because httpd.conf uses '/' (slashes *nix style) while php.ini uses '\' (DOS style),
last --> the last Apache release installs as service by default and a nice traybar Apache Monitor with both click and right-click support and several functions ... including RESTART, STOP and START of the service.

Bye

Robert
0
 
CorsariCommented:
P.S. .. naturally I've updated all the download links to the last release except for MySQL which is proposed by default to 4.x and optionally to the 5.x
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.