Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: How to configure PHP and Apache. |
|
Author |
|
peacemaker
Joined: 23 May 2008 Posts: 80
|
Posted: Mon 02 Jun '08 1:38 Post subject: How to configure PHP and Apache. |
|
|
Hi All. This post is for those who has difficulty in configuring the PHP with apache server. After this i faced another major problem which was later solved by James. If u perform following things then hopefulll it will get configured properly.
if not then i m sorry as i am also beginner.But i would like toshare this as few beginner may face same type of problems.
After installing php,mysql,apache if u dont see the php script running then following is the solution for that
Step 1
Edit file httdc.config in the c:\program files\apache software Foundation\apache2.2\config\httpd.confg file
then insert the following statements
LoadModule php5_module "E:/program
files/php/php5apache2_2.dll" (here my installation drive is E:\ so
here is E:\ if u have C:\ then give that path)
AddType application/x-httpd-php .php
PHPIniDir "E:/program files/php/" (Give the address of the PHP
folder installed with)
Action application/x-httpd-php "/php/php-cgi.exe"
Write above three statements after the long list of LoadModule is
over add these three statements.
After this save the file and then restart the apache server. After
starting u will see in the status bar of the apache server screen like.....
"Apache 2.2/PHP5.2.6" means the php is configured with the
apache server.
Still u may get the same result after doing this. If it works fine ur
done else follow the Step 2
Step 2
First check the Error log file If at the end of the file u can see a
error
function not found in file "php_sam.dll"
if u get this file error then do following procedure
open PHP.ini file search for word "sam"
in the bottom of the file u will see
[PHP_SAM]
extension=php_sam.dll
when u see these two statements just comment them like as
below
#[PHP_SAM]
#extension=php_sam.dll
save the file and restart the apache server
After this run the code
<?php phpinfo(); ?>
after this in the browser use the http:\localhost and the ".php" file
of above code
hope ur code will work properly.
As the local host is the "C:\program\files\...\htdocs\" directory. If u
wish to change this directory
to some other directory and make that directory as local host for ur
project use following step.
Step 3
Open agian the file
E:\program files\apache software
foundation\apache2.2\config\httpd.confg file
Search the word "DocumentRoot"
DocumentRoot "E:/Program Files/Apache Software
Foundation/Apache2.2/htdocs"
u will see the path to this as ur current local "htdocs" dirctory
path (which is rt local host)
Change it to the folder u want to use as ur local host.(First make
that folder)
AS A PRECAUTION DONT DELTE THE ORIGINAL PATH JUST COMMENT
THEM, AS IF THIS DOESNT WORKS THEN
THOSE CAN BE UNCOMMENTED AND AND CAN BE USE AGAIN AS
NORMAL.
It will look like this
DocumentRoot "E:\MyFolder"
After this go further down and u will see commant
<Directory "<Directory "E:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
give the same path that u gave for the "DocumentRoot"
so it will look like this
<directory "E:\MyFolder">
Save the file and again start the apache server
Again run the phpinfo(); file in the browser with some html code to
recognize that
its new foder.
hope it works properly as its working fine with me.
HAPPY PROGRAMMING
Still if its not working then keep on cheking the error log file hope that might helpful for further problem.
Hi James i will highly appriciate if u find anything wrong in the above code and i request u to plz let me know else it will be some misguiding to the beginner. so plz let me know immediately i will correct them immediately. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Mon 02 Jun '08 19:58 Post subject: |
|
|
Please remove Action application/x-httpd-php "/php/php-cgi.exe"
You can only use PHP as module or as cgi.
By the way: There is A Fast, Reliable and Proven Setup :: Apache PHP MySQL Perl in the how to forum |
|
Back to top |
|
|
|
|
|
|