Wow Web Designs Forums Home

Search
   
Members

Calendar

Help

Home
Search by username
Not logged in - Login | Register 
Wow Web Designs Forums > Scripting > PHP > How To Install and Configure PHP5 and Apache HTTP Server 2.0.50.


How To Install and Configure PHP5 and Apache HTTP Server 2.0.50.
 Moderated by: Aycan  

New Topic

Reply

Print
AuthorPost
klimaks
Member
 

Joined: Thu Dec 29th, 2005
Location:  
Posts: 52
Status:  Offline
Mana: 
 Posted: Mon Feb 20th, 2006 11:31 am

Quote

Reply
moneygeek wrote: Hi all,

I am having a similar problem and wondering if someone

would please point me in the right direction.

I have the following installed:

Windows XP Home, Apache 2, MySQL 5, PHP 5

Apache does not load with the following command line in the "httpd.conf" file:

AddModule mod_php5.c

When i take this out of the config file then apache starts
Apache 2.0 and higher doesnt require AddModule mod_php5.c line. It is for older versions, that is why it does not work.

I am using a PHP5 Learnin guide and the script listed below brings up a blank screen

<html>
<head> <title>MySQL Connection Test</title> </head>
<body>
<h2>

<?php
$connection=mysql_connect("localhost", "root","")
or die("sorry - unable to connect to MySQL");
echo("Congratulations - you are connected to MySQL");
?>

</h2>
</body> </html>


Thank you for any help you can offer.

moneygeek
On default php 5.0 does not print out error messages. To print out error messages change display_errors = Off to display_errors = On. That's why you dont get the "Sorry - unable to connect to MySQL" line.

moneygeek
Member
 

Joined: Sun Feb 19th, 2006
Location:  
Posts: 3
Status:  Offline
Mana: 
 Posted: Tue Apr 11th, 2006 01:03 am

Quote

Reply
Thank you for your reply!

mark-o-matic
Member


Joined: Mon Apr 17th, 2006
Location: Australia
Posts: 218
Status:  Offline
Mana: 
 Posted: Mon Apr 17th, 2006 10:48 am

Quote

Reply
goodtutorials.com is a good place to go mainley stuff about photo shop but theres a bit of stuff about php for starters :D

moneygeek
Member
 

Joined: Sun Feb 19th, 2006
Location:  
Posts: 3
Status:  Offline
Mana: 
 Posted: Mon Apr 17th, 2006 11:51 am

Quote

Reply
Thank you for the info, i will check it out!

MG

mark-o-matic
Member


Joined: Mon Apr 17th, 2006
Location: Australia
Posts: 218
Status:  Offline
Mana: 
 Posted: Fri Apr 21st, 2006 06:38 am

Quote

Reply
csg wrote: Here is the configuration for apache 1-2 and php 4-5. If you have any problems please post it.

 

Apache 1.3.x on Microsoft Windows

   This section contains notes and hints specific to Apache 1.3.x
   installs of PHP on Microsoft Windows systems. There are also
   instructions and notes for Apache 2 on a separate page.

     Note: Please read the manual installation steps first!

   There are two ways to set up PHP to work with Apache 1.3.x on Windows.
   One is to use the CGI binary (php.exe for PHP 4 and php-cgi.exe for
   PHP 5), the other is to use the Apache Module DLL. In either case you
   need to edit your httpd.conf to configure Apache to work with PHP, and
   then restart the server.

   It is worth noting here that now the SAPI module has been made more
   stable under Windows, we recommend it's use above the CGI binary,
   since it is more transparent and secure.

   Although there can be a few variations of configuring PHP under
   Apache, these are simple enough to be used by the newcomer. Please
   consult the Apache Documentation for further configuration directives.

   After changing the configuration file, remember to restart the server,
   for example, NET STOP APACHE followed by NET START APACHE, if you run
   Apache as a Windows Service, or use your regular shortcuts.

     Note: Remember that when adding path values in the Apache
     configuration files on Windows, all backslashes such as
     c:directoryfile.ext must be converted to forward slashes, as
     c:/directory/file.ext.
     _________________________________________________________________

Installing as an Apache module

   You should add the following lines to your Apache httpd.conf file:

   Example 2-3. PHP as an Apache 1.3.x module

   This assumes PHP is installed to c:php. Adjust the path if this is
   not the case.

   For PHP 4:
# Add to the end of the LoadModule section
LoadModule php4_module "c:/php/php4apache.dll"

# Add to the end of the AddModule section
AddModule mod_php4.c

   For PHP 5:
# Add to the end of the LoadModule section
LoadModule php5_module "c:/php/php5apache.dll"

# Add to the end of the AddModule section
AddModule mod_php5.c

   For both:
# Add this line inside the <IfModule mod_mime.c> conditional brace
AddType application/x-httpd-php .php

# For syntax highlighted .phps files, also add
AddType application/x-httpd-php-source .phps
     _________________________________________________________________

Installing as a CGI binary

   If you unzipped the PHP package to C:php as described in the Manual
   Installation Steps section, you need to insert these lines to your
   Apache configuration file to set up the CGI binary:

   Example 2-4. PHP and Apache 1.3.x as CGI
ScriptAlias /php/ "c:/php/"
AddType application/x-httpd-php .php

# For PHP 4
Action application/x-httpd-php "/php/php.exe"

# For PHP 5
Action application/x-httpd-php "/php/php-cgi.exe"

# specify the directory where php.ini is
SetEnv PHPRC C:/php

   Note that the second line in the list above can be found in the actual
   versions of httpd.conf, but it is commented out. Remember also to
   substitute the c:/php/ for your actual path to PHP.

   Warning

   By using the CGI setup, your server is open to several possible
   attacks. Please read our CGI security section to learn how to defend
   yourself from those attacks.

   If you would like to present PHP source files syntax highlighted,
   there is no such convenient option as with the module version of PHP.
   If you chose to configure Apache to use PHP as a CGI binary, you will
   need to use the highlight_file() function. To do this simply create a
   PHP script file and add this code: <?php
   highlight_file('some_php_script.php'); ?>.
     _________________________________________________________________

Apache 2.0.x on Microsoft Windows

   This section contains notes and hints specific to Apache 2.0.x
   installs of PHP on Microsoft Windows systems. We also have
   instructions and notes for Apache 1.3.x users on a separate page.

     Note: You should read the manual installation steps first!

   Warning

   We do not recommend using a threaded MPM in production with Apache2.
   Use the prefork MPM instead, or use Apache1. For information on why,
   read the following FAQ entry

   You are highly encouraged to take a look at the Apache Documentation
   to get a basic understanding of the Apache 2.0.x Server. Also consider
   to read the Windows specific notes for Apache 2.0.x before reading on
   here.

     PHP and Apache 2.0.x compatibility notes: The following versions of
     PHP are known to work with the most recent version of Apache 2.0.x:

     * PHP 4.3.0 or later available at http://www.php.net/downloads.php.
     * the latest stable development version. Get the source code
       http://snaps.php.net/php4-latest.tar.gz or download binaries for
       Windows http://snaps.php.net/win32/php4-win32-latest.zip.
     * a prerelease version downloadable from http://qa.php.net/.
     * you have always the option to obtain PHP through anonymous CVS.

     These versions of PHP are compatible to Apache 2.0.40 and later.

     Apache 2.0 SAPI-support started with PHP 4.2.0. PHP 4.2.3 works
     with Apache 2.0.39, don't use any other version of Apache with PHP
     4.2.3. However, the recommended setup is to use PHP 4.3.0 or later
     with the most recent version of Apache2.

     All mentioned versions of PHP will work still with Apache 1.3.x.

   Warning

   Apache 2.0.x is designed to run on Windows NT 4.0, Windows 2000 or
   Windows XP. At this time, support for Windows 9x is incomplete. Apache
   2.0.x is not expected to work on those platforms at this time.

   Download the most recent version of Apache 2.0.x and a fitting PHP
   version. Follow the Manual Installation Steps and come back to go on
   with the integration of PHP and Apache.

   There are two ways to set up PHP to work with Apache 2.0.x on Windows.
   One is to use the CGI binary the other is to use the Apache module
   DLL. In either case you need to edit your httpd.conf to configure
   Apache to work with PHP and then restart the server.

     Note: Remember that when adding path values in the Apache
     configuration files on Windows, all backslashes such as
     c:directoryfile.ext must be converted to forward slashes, as
     c:/directory/file.ext.
     _________________________________________________________________

Installing as a CGI binary

   You need to insert these three lines to your Apache httpd.conf
   configuration file to set up the CGI binary:

   Example 2-5. PHP and Apache 2.0 as CGI
ScriptAlias /php/ "c:/php/"
AddType application/x-httpd-php .php

# For PHP 4
Action application/x-httpd-php "/php/php.exe"

# For PHP 5
Action application/x-httpd-php "/php/php-cgi.exe"

   Warning

   By using the CGI setup, your server is open to several possible
   attacks. Please read our CGI security section to learn how to defend
   yourself from those attacks.
     _________________________________________________________________

Installing as an Apache module

   You need to insert these two lines to your Apache httpd.conf
   configuration file to set up the PHP module for Apache 2.0:

   Example 2-6. PHP and Apache 2.0 as Module
# For PHP 4 do something like this:
LoadModule php4_module "c:/php/php4apache2.dll"
AddType application/x-httpd-php .php

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

# configure the path to php.ini
PHPIniDir "C:/php"

     Note: Remember to substitute the c:/php/ for your actual path to
     PHP in the above examples. Take care to use either php4apache2.dll
     or php5apache2.dll in your LoadModule directive and not
     php4apache.dll or php5apache.dll as the latter ones are designed to
     run with Apache 1.3.x.

     Note: If you want to use content negotiation, read related FAQ.

   Warning

   Don't mix up your installation with DLL files from different PHP
   versions. You have the only choice to use the DLL's and extensions
   that ship with your downloaded PHP version.

thanks this also helped me :)

redXIII
Member
 

Joined: Wed May 10th, 2006
Location:  
Posts: 3
Status:  Offline
Mana: 
 Posted: Wed May 10th, 2006 10:10 pm

Quote

Reply
Hello everyone,

I am new to the world of web development and I sure could use some assistance. I am trying to setup an Apache 2.2.2 webserver with PHP5 on Windows XP Pro computer. However, when I try to run test.php which contains <?php phpinfo(); ?> my IE browser spits out:

You are not authorized to view this page

You might not have permission to view this directory or page using the credentials you supplied.

HTTP Error 403 - Forbidden

Internet Explorer

 
I can successfully launch Apache as the service starts up fine. What must I edit in httpd.conf file go get my PHP files to show. I even tried another PHP file that works fine on another server but it won't show up on my machine.

Please help, I'm stuck.:?

Last edited on Wed May 10th, 2006 10:37 pm by redXIII

klimaks
Member
 

Joined: Thu Dec 29th, 2005
Location:  
Posts: 52
Status:  Offline
Mana: 
 Posted: Thu May 11th, 2006 10:17 am

Quote

Reply
"If you use Apache 2.2.x, the included DLLs (php4apache2.dll and php5apache2.dll) will not work for you as they are specific to the Apache 2.0.x API. There is an open bug report to address this issue but if you can't wait then go to the following URL and download an appropriate DLL for Apache 2.2.x"

http://www.apachelounge.com/download/ to find a working one

redXIII
Member
 

Joined: Wed May 10th, 2006
Location:  
Posts: 3
Status:  Offline
Mana: 
 Posted: Tue May 16th, 2006 05:11 am

Quote

Reply
Thanks, this really got me going. :)

shankhar
Member
 

Joined: Tue Jul 11th, 2006
Location:  
Posts: 1
Status:  Offline
Mana: 
 Posted: Tue Jul 11th, 2006 07:20 am

Quote

Reply
Hi all,

I installed Apache 2.2.2 and configured in my Windows XP SP2
          it runned sucessfully

After that i unpacked PHP 5.1.4 and configured in php.ini file and httpd.conf and then i restarted apache but it tells
Error in first line in httpd.conf:

    what i had included in the first line of httpd.conf is
            LoadModule php5_module "c:/php/php5apache2.dll"
            AddType application/x-httpd-php .php
            PHPIniDir "C:/php"

what is the solution?

Please help me yar

Thanks


klimaks
Member
 

Joined: Thu Dec 29th, 2005
Location:  
Posts: 52
Status:  Offline
Mana: 
 Posted: Thu Jul 13th, 2006 09:41 am

Quote

Reply
Maybe you should read ALL replies in this topic ?

csg
Member
 

Joined: Sun Apr 17th, 2005
Location: Kennewick, Washington USA
Posts: 114
Status:  Offline
Mana: 
 Posted: Thu Jul 13th, 2006 02:13 pm

Quote

Reply
I'm not bad mouthing anyone but it seems people just jump to the end of this topic and post there problem. And once I saw someone create a new topic which was already discussed in this one. So everyone please read through every reply. Your most likely to find what your looking for. Then post your question if everything discussed didn't work. That would save alot of us alot of time. Thanks! :D

Hint to shankhar. look above your post for your answer.

jyuzhan
Member
 

Joined: Wed Aug 2nd, 2006
Location:  
Posts: 3
Status:  Offline
Mana: 
 Posted: Thu Aug 3rd, 2006 12:03 am

Quote

Reply
I have a problem here.   After I added this in httpd.conf  :

LoadModule php5_module "c:/php-5.1.4-Win32/php5apache.dll"

I started Apache 2, I keep getting the error of:

"httpd.exe: cannot load c:/php-5.1.4-Win32/php5apache.dll into server: The specified module could not be found."

Can someone please help me with this please?

 

csg
Member
 

Joined: Sun Apr 17th, 2005
Location: Kennewick, Washington USA
Posts: 114
Status:  Offline
Mana: 
 Posted: Thu Aug 3rd, 2006 12:20 am

Quote

Reply
Looks like the module your using is not for the right version of apache your using. As posted earlier if u have apache 2.2.x then go here for the right module

http://www.apachelounge.com/download/

If you have apache 2.0.x I think u can still the link above to get the proper module. I don't use it so I'm not sure.

jyuzhan
Member
 

Joined: Wed Aug 2nd, 2006
Location:  
Posts: 3
Status:  Offline
Mana: 
 Posted: Thu Aug 3rd, 2006 04:19 pm

Quote

Reply
In http://www.apachelounge.com/download/ , I downloaded the file httpd-2.2.3-win32-x86-ssl.zip   and unzip the directory of "modules" and replaced my "module" directory in the Apache installation.  However, I got the same error.   Is replacing the module directory what you suggested please?  thx a lot,

jyuzhan
Member
 

Joined: Wed Aug 2nd, 2006
Location:  
Posts: 3
Status:  Offline
Mana: 
 Posted: Thu Aug 3rd, 2006 05:40 pm

Quote

Reply
Hi, I got it fixed from :  http://www.apachelounge.com/forum/viewtopic.php?t=570 

thx,

klimaks
Member
 

Joined: Thu Dec 29th, 2005
Location:  
Posts: 52
Status:  Offline
Mana: 
 Posted: Fri Aug 4th, 2006 06:58 am

Quote

Reply
IMHO most of you beginning PHP gurus should use something like Xampp or some other premade packages... http://www.apachefriends.org/en/xampp.html

Last edited on Fri Aug 4th, 2006 06:58 am by klimaks

TheZPS
Member
 

Joined: Tue Aug 8th, 2006
Location:  
Posts: 1
Status:  Offline
Mana: 
 Posted: Wed Aug 9th, 2006 03:16 am

Quote

Reply
OK, I'll admit that I am very new to this, but I have read every post twice and tried many different things to get Apache & PHP to work.

I am trying to install Apache & PHP (& MySQL eventually, but I havent gotten that far) to make some dynamic web-sites. I dont know PHP or MySQL, and havent used Apache before.

I have tried the following

XAMP-didnt seem to do anything, so I uninstalled it

Manually installing it based on instructions on this thread and on the Apache Lounge. Ive downloaded the VC++ thing from Windows

 

Apache seems to work fine, I can see HTML on it and everything.

With XAMP, and manual installing when I tried viewing PHP files I would get a standard internet explorer error message. I uninstalled everthing & tried installing Webserv (another packaged installer thing, like XAMP...I guess). Now, with Webserv installed, I dont get an error message when viewing PHP files. The browser just seems to ignore the PHP. for example

I type

Hello <? echo "world" ; ?>

           into a .txt file and save it as a .php file in the document root. All I see in the browser is

Hello

 

Any insight or advise would be helpful. Like I said, I am very new to this. Thanks

 

P.S. Also, I have uninstalled & installed Apache, PHP & MySQL several times, and may have to do so again. If I just uninstall it might bits of the program remain that would interfere with it if I download it again? How can I be sure that I have gotten rid of it so I can re-install it?

dannyboy1981
Member
 

Joined: Wed Aug 30th, 2006
Location:  
Posts: 1
Status:  Offline
Mana: 
 Posted: Wed Aug 30th, 2006 01:59 pm

Quote

Reply
Hello
I have just joint the site since I read it and found it to be quite helpful.
Ok down to business.
I just installed Windows 2000 NT server and uninstalled the IIS. Installed the Apached 2.0.59 and it installed and the service initiated smoothly.
Using the instructions posted at http://www.ricocheting.com/server/php.html
I installed php 5.1.6
             I added the lines-

LoadModule php5_module "e:/php/php5apache2.dll"
AddType application/x-httpd-php .php
PHPIniDir "e:/php"
Which in my case was
LoadModule php5_module "C:/php/php5apache2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"
Made the test file to see if the php has been configured to Apache by writing
the script

<?php
phpinfo();
?>

and naming it test.php
I placed it into the directory where apache's DocumentRoot was.
Opened a browser and tried http://localhost/test.php
Instead of the browser showing me a bunch of variables and settings, it
gives me the option of downloading the test.php file.

This is my first time in doing so hence any and every hellp in this regard is
highly appreciated.



[code]

klimaks
Member
 

Joined: Thu Dec 29th, 2005
Location:  
Posts: 52
Status:  Offline
Mana: 
 Posted: Mon Sep 4th, 2006 07:16 am

Quote

Reply
dannyboy1981 wrote: Which in my case was
LoadModule php5_module "C:/php/php5apache2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"

Those are actually the lines that tell Apache to run .php files through php. I suppose you didn't restart apache after you made changes to http.conf file ?

shirishdesh
Member
 

Joined: Tue Sep 12th, 2006
Location:  
Posts: 1
Status:  Offline
Mana: 
 Posted: Tue Sep 12th, 2006 10:31 am

Quote

Reply
Hi,

I have tried with apache 2.0.5x and php5 but in vain. I am able to get apache install page. but if i call phpinfo.php file nothing is displayed. please help.

php.ini file in c:\php folder

apache in c:\apache2\apache2

 

 

 


 Current time is 03:11 am
Page:  First Page Previous Page  1  2  3  Next Page Last Page  




Powered by WowBB 1.7 - Copyright © 2003-2006 Aycan Gulez
Page processed in 0.2585 seconds (10% database + 90% PHP). 21 queries executed.