Jump to content

PHP and Apache installation


Recommended Posts

Hi,

1) I am running XP (home edition), with no IIS. I installed Apache (httpd-2.0.55-win32-src), which run ok; I can view an htm file i.e [a href=\"http://localhost/hello.htm\" target=\"_blank\"]http://localhost/hello.htm[/a]. Thereafter I run php4.exe (php-4.4.2-Win32). When I tried .php file I receive error “Page cannot be found.” please let me why I can not run the file and how to correct it.

2) Is possible to run php on IIS, if yes, please let me know how.

thanks
Manbhatti
Link to comment
Share on other sites

Did you run the php installer if you did that would of done nothing, apart from extract the files from installer to installation folder you specified, most probably C:\php

In order to get your pages to work you will need to configure Apache so it uses PHP as Module which is easy to do.

You will need to find the Apache config file which is called httpd.conf. Open that file up for editing in Notepad or what ever editor you wish to use.

And scroll downwards until you come across the following:
[code]#LoadModule ssl_module modules/mod_ssl.so[/code]
You will need to add the following line to after the line stated above:
[code]LoadModule php4_module ""C:/php/php4apache2.dll"[/code]
Now directly after that line add the following:
[code]#PHPIniDir
PHPIniDir "C:/php"[/code]

You're almost done. Now scroll down and find the following line:
[code]DirectoryIndex index.html index.html.var[/code]Now add a space a after index.html.var and type index.php so the DirectoryIndex line should look like this:
[code]DirectoryIndex index.html index.html.var index.php[/code]

Now scroll down a little further and find the following:
[code]AddType application/x-gzip .gz .tgz[/code]Now add the following directly after it:
[code]
#PHP5
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-phps .phps[/code]

You have now configured APache to use PHP as an Apache Module. Now save the httpd.conf file ie File -> Save or Ctrl+S for short.

After changing the httpd.conf file go to where you have installed PHP to, which I presume is C:\php, and go to a folder called [b]sapi[/b] (C:\php\sapi) now move a file called [b]php4apache2.dll[/b] to the root of the PHP folder (C:\php\). ANother step is to rename a fiole called php.ini-recommend to just php.ini (only if a file called php.ini is not there).

Once you have followed the steps above. You will need to restart Apache for the changes to take affect. To do so there should be an icon in the lower right hand corner of the screen in the taskbar with a small green triange inside a white circle pointing to the right and a purple feather pointing upwards to the left.

If you do click it and Select Apache 2 from the menu and then select Restart. Apache should restart and attempt to apply the changes made to the httpd.conf file. If apache doesn't come up with a warningthen you have successfully configured Apache and PHP to work together.

Now go to [a href=\"http://localhost/\" target=\"_blank\"]http://localhost/[/a] in web browser and find your .php file. Click it and the output of the file should be displayed in the browser window. If no .php files are listed in the directory index when you go to [a href=\"http://localhost/\" target=\"_blank\"]http://localhost/[/a] you will need to move your .php files to the folder where you store your files be seen by the webserver.

Hope that helps.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.