| Author | Post |
|---|
merQrey Member
| Joined: | Wed Aug 4th, 2004 |
| Location: | |
| Posts: | 1 |
| Status: |
Offline
|
| Mana: |     |
|
Posted: Wed Aug 4th, 2004 05:37 pm |
|
Hi there.
I was wondering if anyone could give me a tutorial on how to Install and Configure PHP5 and Apache HTTP Server 2.0.50.
Ive tried the configuration method for PHP 4,but this doesnt work.
Please help,as i am new to this
Thanks Guys   
|
fabio1978 Member
| Joined: | Sat Sep 3rd, 2005 |
| Location: | |
| Posts: | 1 |
| Status: |
Offline
|
| Mana: |     |
|
Posted: Sat Sep 3rd, 2005 04:22 pm |
|
Hey, I have the same problem. Apache run's ok, but when I try to open a php file, de browser wants to save it. Also embedded php code in html doesn't show up. I already looked at my httpd.conf but couldn't find any way to configure apache to use php5(which is installed).
greetings
|
csg Member
|
Posted: Sat Sep 3rd, 2005 06:57 pm |
|
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:\directory\file.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:\directory\file.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.
|
happy_girl Member
| Joined: | Sat Oct 22nd, 2005 |
| Location: | |
| Posts: | 5 |
| Status: |
Offline
|
| Mana: |     |
|
Posted: Sat Oct 22nd, 2005 06:38 am |
|
I've installed both apache2 and php5, and i also successfully added the following lines to the httpd.conf file as posted.
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"
However, when i go to run a test page i'm still getting nothing, no errors, nothing, so i'm not sure what i've done wrong... is there something else i'm missing...
also could anyone give me fast pointers on how to configure postgresql into the equation, i've installed it and it works fine, but i'm a little stuck on how it all fits in with apache2 and php5.
please help anyone...
|
csg Member
|
Posted: Sat Oct 22nd, 2005 06:43 pm |
|
I think your configuration with php and apache is fine, otherwise you'd get an error. I think your code is the problem. I've had this problem before, where there is no error or out of code. So if I could see your code I could figure it out.
Plus here is a document on postgresql.
Attachment: postgresql.zip (Downloaded 597 times)
|
happy_girl Member
| Joined: | Sat Oct 22nd, 2005 |
| Location: | |
| Posts: | 5 |
| Status: |
Offline
|
| Mana: |     |
|
Posted: Sun Oct 23rd, 2005 01:07 am |
|
could u tello me why do I get an 404 error after installing PHP5 and Apache2?
The code that i am using to test it is below: (test.php)
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<p>This is a test page.</p>
<?php echo "Hello World<br/>"; ?>
</body>
</html>
but i get a 404 file not found error when i load any php page,
in the httpd.conf file i have this code:
PHPIniDir "c:/WINDOWS"
where the php.ini file is located in the WINDOWS dir.
help?
|
csg Member
|
Posted: Sun Oct 23rd, 2005 01:57 am |
|
I noticed you don't have something in your configuration.
# For PHP 5
Action application/x-httpd-php "/php/php-cgi.exe"
I looked back at my 1st post. This command is the most inportant. It lets apache know where to send the php code to be compiled. In your case you should put:
Action application/x-httpd-php "C:/php/php-cgi.exe"
with the rest of your php configuration. That should solve that error. And that would be why you get no output.
Last edited on Sun Oct 23rd, 2005 01:58 am by csg
|
happy_girl Member
| Joined: | Sat Oct 22nd, 2005 |
| Location: | |
| Posts: | 5 |
| Status: |
Offline
|
| Mana: |     |
|
Posted: Sun Oct 23rd, 2005 02:29 am |
|
i'm still getting the 404 error: file not found.
this is everything i've added:
# to c:/WINDOWS/php.ini
doc_root = "c:\Apache2\htdocs"
extension_dir = "c:\php\ext"
# to c:/Apache2/conf/httpd
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php
Action application/x-httpd-php "C:/php/php-cgi.exe"
PHPIniDir "C:/WINDOWS"
thats everything i've added, am i missing something?
|
csg Member
|
Posted: Sun Oct 23rd, 2005 04:21 am |
|
Is your file in the right place. Check to see that your test.php is in the same place that your configuration points to. Which would be:
c:\Apache2\htdocs
Plus be sure that both places where it asks for the root document
folder.
|
happy_girl Member
| Joined: | Sat Oct 22nd, 2005 |
| Location: | |
| Posts: | 5 |
| Status: |
Offline
|
| Mana: |     |
|
Posted: Sun Oct 23rd, 2005 06:27 am |
|
yeah i've double and tripple checked and still no php pages are shown. I can display html pages by going to http://localhost/test.html.
But when i go to http://localhost/hello.php thats when i get a page not found, also is it correct that windows uses notepad to edit and view php files?
I am lost, everything seems to work except php, it is php5, would it make a diff if i used php4, cos i'm doing this on windows xp?
Is it correct that I have pointed PHPIniDir "C:/WINDOWS" when the file is located in the WINDOWS dir, is it meant to be PHPIniDir "C:/WINDOWS/php", cos i tried that and that doesn't even work.
Does php have to be setup as something like a service or something, cos i get the feeling its not running so thats why apache doesn't recognise the php files.
HELP again!
|
csg Member
|
Posted: Sun Oct 23rd, 2005 08:57 pm |
|
I use php4. I never tryed php5 yet. I think it isn't fully released, it might still be under development. You are pointing to the right ini directory. I would probly suggest using php4. Just use the configuration in my first post. I never had a prblem with php4, and every php script I use works fine. So try that.
|
bigheadchd Member

|
Posted: Sat Oct 29th, 2005 02:08 pm |
|
i've tried to put in those line after the addmodule, but i cannot even start the apache... apache 2.0.55 and php 5.0.5, can any1 help me out? 
|
csg Member
|
Posted: Sun Oct 30th, 2005 08:28 pm |
|
bigheadchd wrote: i've tried to put in those line after the addmodule, but i cannot even start the apache... apache 2.0.55 and php 5.0.5, can any1 help me out? 
What lines did you add??
|
Jammen Member
| Joined: | Tue Jan 3rd, 2006 |
| Location: | |
| Posts: | 1 |
| Status: |
Offline
|
| Mana: |     |
|
Posted: Tue Jan 3rd, 2006 09:32 am |
|
thanks csg it works
|
redz Member
| Joined: | Fri Feb 3rd, 2006 |
| Location: | |
| Posts: | 2 |
| Status: |
Offline
|
| Mana: |     |
|
Posted: Sat Feb 11th, 2006 06:50 am |
|
| Hello, I'm new here...i have problem integrating php5 with apache2 and running the server on my pc..i followed the configuration discussed here but when i tried to start apache it says cannot load C:/php/php5apache.dll into server. Another thing i discovered is that i couldn't find neither php.ini-dist nor php.ini-recommended file on my php folder. As well as the http.conf file it's nowehere in my apache folder but there is httpd file (with no file extension but i think it's a text document because of the icon) , is this the one you are referring as httpd.conf?..I think this is all because I have no internet connection, am I right? Last edited on Sat Feb 11th, 2006 07:03 am by redz
|
gunnettmd Member
| Joined: | Mon Feb 13th, 2006 |
| Location: | |
| Posts: | 1 |
| Status: |
Offline
|
| Mana: |     |
|
Posted: Mon Feb 13th, 2006 11:07 pm |
|
Hello, I recently had this problem, and corrected it by changing my C:/php/php5apache.dll to C:/php/php5apache2.dll.
The php.ini, for me, was in the c:\windows folder. Check there.
My httpd.conf was inside the Apache Group\Apache\conf folder. If you cant find it, do a search on your machine.
Hopefully this help!
|
klimaks Member
| Joined: | Thu Dec 29th, 2005 |
| Location: | |
| Posts: | 52 |
| Status: |
Offline
|
| Mana: |     |
|
Posted: Wed Feb 15th, 2006 07:59 am |
|
Try these instructions:
http://www.geocities.com/acronymarsenal/install.html
|
redz Member
| Joined: | Fri Feb 3rd, 2006 |
| Location: | |
| Posts: | 2 |
| Status: |
Offline
|
| Mana: |     |
|
Posted: Sat Feb 18th, 2006 08:17 am |
|
| It's working already..I found a very detailed configuration guidelines at evaria.com. To those who have similar problem with me just try visit this site. Thanks a lot guyz!
|
moneygeek Member
| Joined: | Sun Feb 19th, 2006 |
| Location: | |
| Posts: | 3 |
| Status: |
Offline
|
| Mana: |     |
|
Posted: Mon Feb 20th, 2006 02:38 am |
|
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
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
|
RusselDesign Member
|
Posted: Mon Feb 20th, 2006 03:43 am |
|
hi thanks for that info i never try to use php5 yet and I am going to test it
|
 Current time is 03:10 am | Page: 1 2 3 |
|