5.0 Editing httpd.conf
- You can open httpd.conf in two ways.
- Start Menu --> Programs --> Apache HTTP Server --> Configure Apache Server --> Edit the Apache httpd.conf
- Open folder [Drive]:\server\Apache\conf\httpd.conf
Running PHP 5 as an Apache Module
- Add following line in the file (can copy and paste to the end of httpd.conf):
LoadModule php5_module "e:/server/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Configuring the Default Index Page
- Find DirectoryIndex. And add index.php.
From -->DirectoryIndex index.html index.html.var
To -->DirectoryIndex index.html index.html.var index.php
This line tells Apache which file names to use when it looks for the default page for a given directory. - Save your file and restart Apache by click Start --> All Programs -- > Apache HTTP Server 2.2 --> Control Apache Server --> Restart or by right-click the icon in the system tray and select restart.
- If all is well, Apache will start up again without any error.
- If Apache cannot start, try Start Menu--> Apache HTTP Server --> Configure Apache Server --> Review Error Log and see what are the problem.
Configuring Document Root
- I prefer to set my Directory Root other than default htdocs in Apache folder.
- Find DocumentRoot "E:/server/Apache/htdocs" and change to other folder. I pick e:\server\www\.
From --> DocumentRoot "E:/server/Apache/htdocs"
To --> DocumentRoot "E:/server/www" - Do the same for,
Testing the PHP.
- Make a new file named phpinfo.php by using any text editor.
- Type this in the file.
- Put the file in the E:\server\www\ (--> because previously we had assigned this directory as default).
- Open your favorite web browser and type http://localhost/phpinfo.php.
.
No comments:
Post a Comment