Solved

PHP installation test wont work!

Posted on 2004-08-24
9
31,911 Views
Last Modified: 2013-12-13
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)
0
Comment
Question by:emmy21
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 26

Expert Comment

by:ushastry
ID: 11894505
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
 
LVL 4

Accepted Solution

by:
sgalzin earned 500 total points
ID: 11914780
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
 
LVL 9

Expert Comment

by:gtkfreak
ID: 11915667
Does this work? http://127.0.0.1/test.php
0
 
LVL 9

Expert Comment

by:gtkfreak
ID: 11915676
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:emmy21
ID: 11923059
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
 

Expert Comment

by:Corsari
ID: 12151616
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
 
LVL 4

Expert Comment

by:sgalzin
ID: 12158439
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
 

Expert Comment

by:Corsari
ID: 12165097
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
 

Expert Comment

by:Corsari
ID: 12165117
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

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now