Learn PHP tutorial PHP how do I code in PHP?

0

Category:

PHP - What is it?


Taken directly from PHP's home, PHP.net, "PHP is an HTML-embedded scripting language.
Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in.
The goal of the language is to allow web developers to write dynamically generated pages quickly."


This is generally a good definition of PHP. However, it does contain a lot of terms you may not be used to. Another way to think of PHP is a powerful, behind the scenes scripting language that your visitors won't see!

When someone visits your PHP webpage, your web server processes the PHP code. It then sees which parts it needs to show to visitors(content and pictures) and hides the other stuff(file operations, math calculations, etc.) then translates your PHP into HTML. After the translation into HTML, it sends the webpage to your visitor's web browser.

PHP - What's it do?

It is also helpful to think of PHP in terms of what
it can do for you. PHP will allow you to:
  • Reduce the time to create large websites.
  • Create a customized user experience for visitors based on information that you have gathered from them.
  • Open up thousands of possibilities for online tools. Check out
    PHP - HotScripts for examples of the great things that are possible with PHP.
  • Allow creation of shopping carts for e-commerce websites.

What You Should Know

Before starting this tutorial it is important that you have a basic understanding and experience
in the following:
  • HTML - Know the syntax and especially HTML Forms.
  • Basic programming knowledge - This isn't required, but if you have any traditional programming experience
    it will make learning PHP a great deal easier.

PHP - Necessary Setup

To begin working with PHP you must first have access to either of the following:
  • A web hosting account that supports the use of PHP web pages and grants
    you access to MySQL databases.
  • Have PHP and MySQL installed on your own computer. Read this lesson thorougly for more information on installing PHP.
Although MySQL is not absolutely necessary to use PHP, MySQL and PHP are wonderful complements to one another and some topics covered in this tutorial will require that you have MySQL access.

Installing PHP

For those who are experienced enough to do this yourself, simply head over to
PHP.net - Downloads and download the most recent version of PHP.
However, if you are like most of us, you will most likely want to follow a guide to installing PHP onto your computer.
These guides are kindly provided by PHP.net based on the operating system that you are using.
  • PHP - Windows - Windows Installation Guide
  • Installation on Windows systems

freeman0774 at gmail dot com
29-Jan-2010 09:33
Under Windows2000 Advanced Server it returns http error 500 if you have php installed on a path that uses spaces (for example C:\program files\php); solved coping the php5isapi.dll under winnt\system32 (but I think any path without spaces will be good).

Thinks this will help.

bufoni at hotmail dot com
18-Sep-2009 02:49
Oh Man!

I installed by Microsoft Installer, manually, whatever I always received de same error from IIS7.

HTTP Error 404.3 - Not Found
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.

The IIS7 interface is quite diferent and are not all together like IIS6

The 5.3 version have not any of those files: php5stdll, php5isapi.dll. etc.

The installer puts others files in handlers and I decided to use them as substitutes. Nothing done!

After that, I discovered that installer do not install these files within the sites, but in the root default site configuration of IIS7.

So, I copied the root configuration to my site and them it worked (all others procedures were done e.g. copy php.ini to windows folder)

Fernando O.
31-Jul-2009 10:28
I found a way to install it properly, on IIS 7:

Note

Set IIS to allow 32-bits if you are on 64-bits

cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1

Set enviroment variables

PATH to, say, C:\php\

PHPRC to, that same dir

Go to Web Service Extensions: Add a new extension...

Name it for example php, and point it to the php5isapi.dll.

Set status to Allowed.

Right click Web Sites:

On the tab, ISAPI Filters, name it for example php, and point it to the php5isapi.dll

Then go to Home directory tab:

Click Configuration

On Mappings, click add:

Executable would be: php5isapi.dll
Extension to: .php

Click OK, then OK.

Then on the tab Documents click Add:

and add there what you want to load as default, say index.php

Then stop, and start IIS.

This worked for me on a Windows 2003 Server, and WinXP 64.

I hope this saves time for someone.

rich at corephp dot co dot uk
02-Jul-2009 12:06
As of today (2nd July 2009) it appears that the current VC6 Windows archive doesn't include a DLL for Apache 2.2, and the two included ones don't work with 2.2 at all. The VC9 build is of course only for IIS, so no joy there either.

robert dot johnson at icap dot com
19-May-2009 10:38
IIS ISAPI module is not included in the Windows msi installer for version 5.2.9-2.

Either use the zip file and set it up manually, or use the installer for version 5.2.9-1 instead.

dpharshman at dslextreme dot com
17-May-2009 12:52
PHP 5.2.9.2 Install on XP Pro IIS 5.1 - phpinfo( ) results incorrect

Testing Date:  05.15.09

Background:
For several days now I, as a newbie, have been unsure if I had installed PHP correctly, or not.  No matter what I did phpinfo( ) reported "Configuratin File Path" as:  “C:\WINDOWS”.  I was left to wonder what was wrong.

To help resolve the phpinfo() “issue”, I conducted a series of tests using two scripts:

The first is “test-php-ini-loaded.php”; it is stored in c:\inetpub\wwwroot, and has the following code:

    <?php
    $inipath
= php_ini_loaded_file();

    if (
$inipath) {
        echo
'Loaded php.ini: ' . $inipath;
    } else {
        echo
'A php.ini file is not loaded';
    }
   
?>

The second script is simply calls phpinfo( ).  It is named test.php, is stored in “c:\inetpub\wwroot”,  and has the following code:

    <?php phpinfo( ); ?>

My Dev Environment:
1. Windows XP Pro SP3
2. IIS 5.1 / MMC 3.0
3. PHP 5.2.9.2 – phpMyAdmin not yet installed
4. (plus MySQL 5.1, etc.)
5. Install location is on my local E: drive

The Tests:

Test 1:
a. PHPRC environment variable and IniFilePath Registry left in place and active
b. Verified no other copies of php.ini exist on the system other than in my E:\PHP folder
c. Renamed php.ini to hold-php.ini
d. Stopped and started IIS (“net stop iisadmin” and “net start w3svc”)
e. Ran “test-php-ini-loaded.php” to check whether my php.ini is loaded.  It is not.
f. Ran "test.php".  “Loaded Configuration File” was empty, while “Configuration File (php.ini) Path” showed:  C:\WINDOWS.

Test 2:
a. Moved php.ini from E:\PHP to C:\WINDOWS
b. Stopped and started IIS
c. Ran "test-php-ini-loaded.php" to check if my php.ini is loaded.  It is not, which surprised me.
d. Ran "test.php".  My php.ini is apparently not loaded, or found, by phpinfo( ), even though “Configuration File (php.ini) Path” reports it as being in C:\WINDOWS.
e. Note:  Per PHP’s “The configuration file” note, PHP's search order includes:  “Windows directory (C:\windows or C:\winnt) (for Windows), ...”; but it apparently doesn’t or php.ini would have been found and displayed at “Loaded Configuration File”.

Test 3:
a. Left the solo copy of my php.ini in C:\WINDOWS
b. Disabled PHPRC environment variable by renaming it to “Ex-PHPRC and saving the settings (note: for this test  I left the Registry entry for PHP IniFilePath intact)
c. Stopped and started IIS
d. Ran "test-php-ini-loaded.php" to check whether my php.ini is loaded.  Predictably it is not found.
e. Ran the "test.php".  Again, my php.ini file is reported as not found in C:\WINDOWS though “Configuration File (php.ini) Path” reports it as being there.

Test 4:
a. To be thorough and eliminate all possible sources of “mis-direction” I deleted the PHP IniFilePath Registry entry (after backing up the Registry).  The PHPRC environment variable was left disabled. 
b. Stopped and started IIS
c. Ran "test-php-ini-loaded.php" to check whether my php.ini is loaded.  Predictably it is not.
d. Ran "test.php".  Again, no change.  My php.ini file is not found “Configuration File (php.ini) Path” reports it as being there.

Conclusions:
The first conclusion I came to is that, in the default download version of phpinfo( ), “Configuration File (php.ini) Path” is hard-wired to report C:\WINDOWS whether php.ini is there or not.  Further, that C:\WINDOWS is not a default search location (at least not on XP). 

However, given an otherwise “proper” setup, phpinfo() reporting C:\WINDOWS as the value for “Configuration File (php.ini) Path” is merely misleading and is not actually harmful or indicative of a failed installation.

Thanks go to Peter Guy of www.peterguy.com who suggested the testing, and to Daniel Brown of www.php.net for some initial guidance.

P.S.  This note is not meant to take anything away from PHP.  It is a fine tool.  The sole purpose of the testing was to confirm that my installation of PHP was correct.

Mark C in SF
13-Apr-2009 06:19
I hadn't installed PHP in years, used the PHP 5.2.9-2 installer.  Selected FastCGI on IIS, I just didn't work.  On both a w2k3 server and on a Vista laptop.

First, I forget to install from ZIP, as I had before.  I suggest a notice on the download page. The message "Use of the installer isn't the preferred method for installing PHP." is on the "Windows Installer (PHP 5.1.0 and earlier)" page.  Is that no longer true for "Windows Installer (PHP 5.2 and later)"?

Next, I found the recent Microsoft Web Platform Installer (WPI) at http://php.iis.net

It just works.  There are no config settings, it just installed FastCGI on IIS on the W2k3 server and on the Vista laptop.  Took a download+install of the WPI tool, and a few minutes for php install.

I'll likely never take a more careful look at what happened; for a production server I'll install manually. (or use Apache :))

brian dot twardzik at usask dot ca
07-Apr-2009 05:07
Been fighting with this for a while.

Installing PHP on IIS 6.0 using the ISAPI extension.

Note, if you have a web.config file present within the Virtual Directory folder, or otherwise configure the Virtual Directory to run ASP.NET scripts in a specific configuration...

IIS will ignore its ISAPI obligations to render your PHP script and then cite a 401.3 error, access denied based on ACL. If you have Integrated Windows Authentication turned on as a second authentication method, the web browser will prompt you for credentials. If you supply some, either from the local machine or from your domain, the website will suddenly work. This will also result in your website loading when you reference it via Localhost. Only works with Localhost, and does not work with any network-access IP.

Oddly enough, Anonymous impersonation will FAIL under these conditions! Why? I suspect it is because ASP.NET scripts run under the APPLICATION-POOL USERNAME CONTEXT. Once its kicked into that gear, any hope of using Anonymous user impersonation may go out the window.

References:
/*******************/
Impersonation in ASP.NET:

(Look up "Impersonation in ASP.NET (IIS 6.0)" on www.microsoft.com/Technet/ )

Developer.com Article Demonstrating how ASP.NET Runs under ApplicationPools:

http://www.developer.com/net/asp/article.php/2245511

/*******************/

This, to date, is my only theory.

Filemon/Process Mon will not register any kind of failed file access attempts, everything will appear normally. Even the presence of a BUFFER_OVERFLOW message is normal within the context of SYSINTERNALS traces...

But if you download the IIS 6.0 resource kit, pay attention specifically to IISTRACE.

Running IISTRACE and hitting your webserver will reveal that the PHP5ISAPI filter DLL is never called! Only the asp filter DLL.

The moral of your story? Keep web.config files out of your PHP directories!

PHP Lover
18-Sep-2008 07:33
Well, When i installed the php with its all extension i repeteadly get the following error message "The specified CGI application misbehaved by not returning a complete set of HTTP headers".
I followed the following steps and the problem never came again on php 5 and iis6.

1)Made a copy of all php extensions (i.e. ext directory)
2)Using the installer removed it completely. Then manually delete php.ini file.
3)Installed the php again, but this time without any extension(i.e program only) and configured as cgi.
4)edit the php.ini file to enable the extensions and copy required extension files to php directory.

that's it. since then i never found any problem with it. i have installed it dozen of times like this way.

rowoot at gmail dot com
31-Jul-2008 03:13
Here is a tutorial on how to get the latest
apache, php/mysql alongwith phpmyadmin installed
in windows vista/xp.

http://www.visionmasterdesigns.com/category/wp/php/

Regards

J Veitch {a} Computer Muskoka dot - calm
28-Jul-2008 12:58
On IIS7 and Vista I got errors using Appcmd to add the handlers. I also wasn't able to choose FastCGI when adding the handler in the IIS Manager GUI. Removal of CGI from IIS components, a reboot, and re-adding CGI to IIS components allowed selection of FastCGI in the GUI and made it possible to complete the configuration steps.

Here is a URL (note the complete URL is presented here as 2 lines) for another tutorial on the process with steps for both GUI and command line configuration: learn.iis.net/page.aspx/246/
using-fastcgi-to-host-php-applications-on-iis7/

php at vondi dot no-ip dot com
07-Jun-2008 06:44
If you get errors like this:
PHP Notice: Constant XML_ELEMENT_NODE already defined in Unknown on line 0

And many more complaining about XML constants, comment out the line:
extension=php_domxml.dll
in your php.ini. That extension seems to be compiled into PHP when you get those errors or something else is including the functionality before that dll.

chun the man
25-May-2008 01:18
Just to note that if you are following any books about installation, of php and apache 2.2.8, the latest edition of these application gave many people problems while configuring it.

you might have probs getting php to work with mysql or you might get error in myphpadmin missing mbstring, even you followed the instructions carefully.

The new php.ini reside in c:\Windows  not c:\PHP or with the rest of the php installation. But the other files still remain in c:\PHP\ext (php_mbstring.dll etc) libmysql.dll goes in ther system32 folder.

configure your php.ini from the windows folder. :-)

Marco Tibben
08-May-2008 08:59
Installing Apache and PHP on windows Vista?

DO NOT install them in the programs file, but in locations like c:\php and c:\apache

You will end up in all kind of rights problems if you don't..

Succes!

dotpointer
25-Apr-2008 11:36
Beware!

PHP 5.2.5 + Apache 2.2

Putting thread-safe-extensions into a non-thread-safe PHP installation or the opposite results in "Unable to load dynamic library..."-error. Errors looks like the file could not be found, but they're misleading. File is found, but file does not have correct content inside.

To fix this, re-run the msi-installer and install your extensions from there instead.

If you enable ALL extensions to save time, you'll soon find out you failed as many of them will fail to load beacause of missing systems not installed on your system.

badscorp at hotmail dot com
25-Feb-2008 08:22
My experience in running php 4 and php 5 on the same machine with IIS as ISAPI module (tested on XP Pro).

1- Extract the ZIP packages of both php 4 & php 5 to c:\php4 & c:\php5, each in its own folder.

2- Setup the corresponding php.ini files in c:\php4 and c:\php5, by renaming php.ini-dist to php.ini..

3- Add the Web Service Extensions for php4 and php5. For php4 use c:\php4\sapi\php4isapi.dll, php5 use c:\php5\php5isapi.dll..

4- Add the following registry keys:

HKEY_LOCAL_MACHINE\SOFTWARE\PHP\5\IniFilePath -> c:\php5

HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath -> c:\php4

5- Add c:\php4 and c:\php5 to the PATH environment variable, separated by semis.

6- Create a session and an uploadtemp folders in any location, then add them in the session.save_path in bothe php ini files (there are two in php4?), and give IUSR_machinename write access to them.

7- Associate each web site in IIS with the corresponding php version.

8- Reboot..

Use phpinfo() to test it in each site.

Regards,,

Eduardo Bigai at xedco dot net
15-Jan-2008 04:40
If you get this error: "Service Unavailable" after installing PHP to a Windows XP x64 Pro, and you followed all the instructions posted in this page, you may want to try checking the ISAPI Filters in your IIS.

Make sure your a running the 32-bit version of the Microsoft.NET\Framework\v2.0.50727\aspnet_filter.dll.

If you are running the 64-bit version, you will notice that liested item in the ISAPI Filters has a red arrow pointing down. This means that the service failed to load. Delete this item from the list and add a new one. Make sure you use the one located here: %Windows%/Microsoft.NET\Framework\v2.*\aspnet_filter.dll.

Also make sure the permissions to your PHP folder have "NETWORK SERVICE", "IUSR_*", "SYSTEM" included.

I hope this helps you saving some precious time

sediaz at simpleonlinehelp dot com
08-Jan-2008 05:02
For those of you that would like visuals, there's a video tutorial that will help you get PHP5 installed on Windows 2K3 w/ IIS6.

It's pretty straight forward.

The link to the site, if you're interested, is:
http://www.videotutorialzone.com

The title is:
Installing PHP5 on Windows 2003 and IIS6

I hope this helps others as it did me.

Scott

smileclick at hotmail dot com
23-Dec-2007 03:02
Still Can't Run PHP Code?

After installing php-5.2.5-win32-installer.msi on my Windows XP2. with IIS5.1 it still didn't run PHP files.

I eventually found the fix*:

1. Goto Control Panel>System>Advanced>Environmental Variables
2. Add a New System Variable "PHRC" and set its path as "C:\Program Files\PHP"
3. Restart

*source:
http://us2.php.net/manual/en/faq.installation.php
#faq.installation.addtopath

robert dot johnson at icap dot com
13-Dec-2007 03:19
IIS setup: 403 forbidden error. 

We had installed two separate different PHP versions - PHP 5.1.4 followed by 5.2.5.

We configured 5.2.5 php5isapi.dll to be loaded as the .php file type extension.

Despite this, php version 5.1.4 was being loaded.  We renamed 5.1.4's folder and then PHP was not loading at all.

There were no visible references to 5.1.4 in the IIS configuration, but in the file \webConfig.xml, there was a reference to 5.1.4's isapi under IISFilters.

To fix this problem, we added version 5.2.5's php5isapi.dll to the ISAPI Filter category for the web site, in the IIS control panel.

Philip Thompson
28-Nov-2007 07:13
If you use the installer for Windows (PHP >= 5.2.x) and you want the mysql_* functions to be used, you may have to restart your machine after you install.

I was getting the error "Call to undefined function mysql_connect..." However, I knew that my php.ini settings were correct and I was including php_mysql.dll. When I viewed phpinfo(), it was not showing that MySQL was part of the install. My first thought was to restart Apache - this did not change anything. So, then I restarted the machine, viewed phpinfo() again and it was now there.

I've manually installed several times on Windows and not had this problem. This was my first time running the installer. I think it may have something to do with setting registry values or changing environment variables. Nonetheless, hope this helps.

scott dot thomas @t inin d0t com
09-Nov-2007 04:34
Just a note on impossible to figure out 404 errors regarding include statements, NTLM authentication, and images (IIS/PHP):

My php pages with include functions were returning 404 errors and it turned out it was because every include include page included an image in the wrong directory.  As you can see when /knowledge/addin/img/li.gif is not found (404) the index.php is also returned as 404.  What led me down the wrong path was the fact that the domain user was not present in the request for the index.php when an include was present.  Changing my style sheet to load /knowledge/img/li.gif (the correct location of the image) cause the entire page to come back OK (200) and use the proper domain user for NTLM authentication.  If I hadn't happened across this by accident I don't know that I would have ever figured it out.

GET /knowledge/addin/img/li.gif - 80 - 172.16.128.43
404 0 3
GET /knowledge/index.php do=newarticle&type=qa 80 - 172.16.128.43
404 0 0

GET /knowledge/img/li.gif - 80 domain\scott.thomas 172.16.128.43
200 0 0
GET /knowledge/index.php do=newarticle&type=qa 80 domain\scott.thomas 172.16.128.43
200 0 0

infortechpro at yahoo dot com
06-Nov-2007 10:00
Hello,

I had trouble setting up PHP 5 to work IIS 5 (Windows 2000).

I keep getting a HTTP 500 error.

I checked the php5isapi.dll file path, the permissions and all that but the error did not go way.

The way I got it to work was by adding the IUSR_(machine name) and IWAM_(machine name) account to the administrators group and restarting the computer.

I hope this helps someone out there.

Cheers.

snapper
22-Oct-2007 08:34
Regarding the "No input file specified." problem where 404 error pages aren't sent if the requested non-existent file ends in .php, this was helpful to me . . . http://www.phpbuilder.com/board/showthread.php?t=9212

In a nutshell:

In IIS Management Console (v5.1 in my case), select "Default Web Site", right-click and select "Properties", "Home Directory" tab, "Configuration..." under Application Settings, "Mappings" tab, select the line for the .php file extension, select "Edit" and check these two things:

1) ensure that executable C:\PHP\php5isapi.dll filename is not truncated
2) ensure there is a tick in the box next to "Check that file exists".

Click OK, OK, OK.

Cheers.

Uday Kari
30-Sep-2007 01:24
First I got a HTTP 405 error, resolving which I got an HTTP 404 error...read on for how this was fixed...

Environment:  PHP 5.2.4, IIS 6.0 ISAPI, Windows Server 2003. 

Installation:  Simply downloaded the PHP 5.2.4 installer [22,002Kb] - 30 August 2007 and ran it doing next, next until Finish.

To get rid of 405 error, ensure that your php directory allows scripts.  Start->Control Panel->Administrative Tools->Internet Information Services-> (select website, navigate to directory with your php and right-click your directory) -> Properties -> Directory TAB -> Change Execute Permissions from "None" to "Scripts" (to allow PHP).

To get rid of 404 error, ensure that your executable mapping for the .php extension is properly coded.  Start->Control Panel->Administrative Tools->Internet Information Services-> (select web site) ->Properties->Home Directory->Configuration->Mapping and then change the Executable Path for .php files from C:\Program~\PHP\php5is~1.DLL (or whatever crazy path) to "C:\Program Files\PHP\php5isapi.dll"

(IMPORTANT: the quotes from c:\ to end of dll are important since the default install location, Program Files, has a space...in my youth I would yell "Stupid Microsoft"...but now I would more maturely just note that there is an inconsistency with the way that Paths are defined...in definingenvironment variables, for instance, such spaces are OK...).

osoto3 at hotmail dot com
22-Sep-2007 08:35
Another tip that might save hours of aggravation (and cursing):

I was setting the Mappings in the IIS 5.1 Manager by going to
Default Web Site -> Properties -> Home Directory -> Configuration ->Mappings

I noticed that the ".php" extension that previously I added was the only one shown in quotes, which had been added automatically due to the fact that my PHP files are installed in directory "D:\Program Files\PHP", which contains a blank space in its name. All the other entries had no quotes and when I tried to take the quotes out, IIS responded that the path was invalid. I assumed (correctly) that the quotes were causing problems. So I copied php5isapi.dll to C:\windows (which does not have a space in the directory name) and reentered the path without quotes in the Mappings screen, and then ...

Finally, my browser was able to process and show my hello.php file correctly!

Hope this helps someone.

Jack Hardie
08-Sep-2007 09:33
If you are installing PHP on Vista just go to David Wang's blog. http://blogs.msdn.com/david.wang/
archive/2006/06/21/HOWTO-Install-and-Run-PHP-on-IIS7-Part-2.aspx

Magic!

paul_lynch67 at hotmail dot com
06-Sep-2007 07:25
Hi,

I've written a manual installation guide for PHP 5.x on Windows Server 2003 and IIS 6.0 which you can find here :

http://www.iisadmin.co.uk/?p=4

This is the same article which used to be hosted on the IIS Resources web site. I hope some of you find it useful.

Regards,

Paul Lynch [IIS MVP]

Ananda Sim
07-Aug-2007 12:00
I installed php 5.2.3 using the msi package to Windows XP SP2. First time, ISAPI choice defaulted to installing php to c:\program files\php. The IIS Manager > Websites > Home Directory > Extensions used the short filename. Didn't work - message was "module not found". I then removed and installed to c:\php. That worked easily.

fabrizio dot barbarino at uniud dot it
16-Jul-2007 10:23
In order to enable your x64 version of Windows 2003 Server executing the php*.dll through IIS, you can execute the script shown here:

http://technet2.microsoft.com/windowsserver/en/library/
36f8964c-cf86-44cf-94a4-2873ad0d175f1033.mspx?mfr=true

I've tested it with Windows 2003 Server x64 SP2 and PHP 5.2.3 and it works.

Good work,
Fabar

Jeremy Griffith
20-Jun-2007 06:46
If you have installed using the msi file, allowed it to configure IIS6 for you using the default directory, and are receiving a 404 error (specifically 404 2 error in your log file), then you need to modify the "application extension" for .php to include the full quoted path.  The default uses the old 8.3 convention which is not considered the same by IIS, and therefor the web extension isn't allowed.

klugg at tlen dot pl
11-Jun-2007 08:56
If by any chance you tried to install PHP 5 and marry it with IIS (like me), you might get into quite a frustrating situation, where separately IIS works, PHP works, but together they spit at you a "no input file specified" without further information.
The solution: don't set doc_root in php.ini to "c:\inetpub"! Just leave it empty or comment it out.
Don't forget to restart IIS.
Also, the easiest way to restart IIS is through the "internet information services" control - right click on the computer name, select "All tasks", "Restart IIS..." and confirm.
No need to go through the cmd magic spells anymore!

imi at deltanet dot hr
06-Jun-2007 04:19
PHP 5.2.3 under IIS 5.1 (as ISAPI) and Windows XP

If you have trouble trying to get run the combination above using PHP installer please make sure that your executable path for .php file on IIS has been written correctly.

Start->Control Panel->Administrative Tools->Internet Information Services-> (then select your web site) ->Properties->Home Directory->Configuration->Mapping and then change the Executable Path for .php files from C:\PHP\php5is~1.DLL to C:\PHP\php5isapi.dll

jcwebb at dicoe dot com
16-May-2007 08:50
PHPv522 configuration considerations (php.ini) on Win3k(iis6)

cgi.force_redirect = 0
++ You MUST set this (its commented out by default)

two new settings are included...
session.save_path = "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\php\session"
upload_tmp_dir = "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\php\upload"
++ sessions will fail: $_SESSION['something'] unless you deal with permissions on the new location,
or simply comment out the session.save_path and go back to default "c:\windows\temp"

amoo_miki at yahoo dot com
14-May-2007 08:29
Trying to get PHP run under IIS7 (on Vista) you might find that PHP crashes at startup.

The reason seems to be GD2 needs mbstring while the attempt to load GD2 is being made before mbstring is loaded. While it was clear that an attempt to load it was made by GD2, but it never got loaded causing the crash and error.

Simply moving mbstring to the top of the list solved the issue.
Load mbstring as the first extension in your php.ini.

davideatarkehostdotnet
07-May-2007 02:16
i have encountered always the same problem installing php on windows 2003 (it always worked fine with w2k) "php has encountered an access violation at xxxx". tried php5.x and downgrade to php4.x without success. problem was solved only by giving r+w+e permission on php folder to user IIS_WPG

i_robot73 at hotmail dot com
23-Apr-2007 02:30
Running on Win2k3 x64 w/ IIS6.  Followed the BASIC setup (unzip, PHPRC, add extension to IIS) and still no go.

Wasn't until I enabled x86 that it 'popped':

cscript d:\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1

No security issues that needed fixing.  Test .php file came up like a champ!

Sirichai
26-Mar-2007 08:06
Another Tips:

1. I've tried many ways installing PHP on IIS5.1 (WinXP) Many resources on the internet recommended to use a zip package, but the fact is it doesn't work.(geeez) It is a lot easier to go for the MSI installer and be sure to check those IIS functions and other extensions in the installer wizard.

2. If you got an ERROR404 on any Virtual Directory on IIS5/IIS6, but html files are displayed correctly, just edit php.ini and empty doc_root

3. If the sourcecode of php file is printed instead of the compiled one, just change all short tags <? /* Like this. */ ?> to full tags <?php /* Like this. */ ?>

4. If you want to connect to mssql server on IIS platform, you HAVE TO add this in the registry
HKEY_LOCAL_MACHINE\SOFTWARE\M*icrosoft\ MSSQLServer\Client\ConnectTo]DSQUERY=DBNETLIB

  It is amazing that everybody MUST follow these rules above, but I didn't see any of them appeared on php official site nor  top google rankings.

cheers.

christian dot ulbrich at gmx dot de
13-Jan-2007 07:15
I have an IIS 6.0 with PHP 5.2.0 as ISAPI-module. Installation went fine, using one of the numerous guides available, however I couldn't get my PHP to load any extensions!

It took me quite a while, to find the catch, it seems, that PHP 5.2.0 doesn't like the quotation marks " in some of its directory variables.

Thus, changing

extension_dir = "c:\php\ext\"

to

extension_dir = c:\php\ext\

did the trick for me...

john@ellingsworth
13-Nov-2006 01:06
Another cause of the "No input file specified" on systems with multiple hosts is that the doc_root setting in the php.ini file has been set to a specific directory.  When using IIS with multiple hosts in distinct top level directories you should comment the doc_root line out.

jneill at gamedaytv dot com
09-Nov-2006 01:36
Here's how to run dual PHP instances with PHP 5.2 and any previous PHP on Windows 2003:

1. Right-click My Computer, go to Advanced tab, and click on Environment Variables.

Add the two installations and their EXT directories to the Path variable. For example, add:
c:\php;c:\php\ext;c:\TMAS\php;c:\tmas\php\ext;

Then, add the newer PHP version's directory as a variable called PHPRC. For example:
Variable:PHPRC
Value: C:\PHP

Click OK to close the Environment Variables window, and click OK to close System Properties.

2. In registry, under HKEY_LOCAL_MACHINE>SOFTWARE>PHP, add a REG_SZ key called iniFilePath and give it a value
of the directory where the older PHP is installed. For example:
C:\TMAS\PHP

3. In IIS, go to the Web Service Extensions. Add both versions' ISAPI module separately to the extensions
list, and allow both.

4. In IIS, go to each website utilizing the PHP versions. Set an ISAPI filter if needed. On the Home Directory
tab, click Configuration, and add .php, .php3, .phtml, and any other extensions needed (perhaps .html?) to
be filtered through PHP, and specify the ISAPI module version needed for each website.

You can now run two versions of PHP. This is because the order of where to look for the .ini file changed
between previous PHP versions and PHP 5.2, as documented at http://us2.php.net/ini:

---------------------------------------------------
 php.ini is searched in these locations (in order):

    * SAPI module specific location (PHPIniDir directive in Apache 2, -c command line option in CGI and CLI, php_ini parameter in NSAPI, PHP_INI_PATH environment variable in THTTPD)
    * The PHPRC environment variable. Before PHP 5.2.0 this was checked after the registry key mentioned below.
    * HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath (Windows Registry location)
    * Current working directory (for CLI)
    * The web server's directory (for SAPI modules), or directory of PHP (otherwise in Windows)
    * Windows directory (C:\windows or C:\winnt) (for Windows), or --with-config-file-path compile time option
----------------------------------------------------

afitzs at for-finance dot com
08-Nov-2006 07:11
I have found the following procedure to work correctly EVERY time for installing PHP version 5.x.x on Windows 2003 servers. (I have done over 100 of these on Web, Standard & Enterprise)

1. Download the current PHP Zip file to a folder of your choosing.

2. Download the old Installer.exe (I use 5.0.2)

3. Run the installer and accept the defaults in all cases except the IIS server, choose IIS 6.0 or later. The installer will complain that a script map is not registered and ask you if you want to register it. SAY YES!!!

4. Run the installer a *second* time, using the same settings as above. This time instead of the complaint that a script is not registered you should see a black dos box open and then close. This is your clue that the install was successful.

5. Copy your PHP .zip file to c:\php and extract and overwrite all files from the regular installer.

6. Edit c:\windows\php.ini to enable any extensions you may need and to set the extension directory to c:/php/ext

All should be good to go. Test by running an info() from the web server.

I have used this install on over 100 installs of 2003/IIS web servers. Generally they have been virgin installs, but a few have had existing sites on them. Using the above method I am able to install PHP in under 2 min. Of course, these are windows systems thus your mileage may vary.

Note: I just tried to use the new .msi installer without success. Resorted to the above procedure and now have 5.2.0 running on the new server.

Note2: PHP powers that be, please make a copy of the old installer available again somewhere easily found by people. I would be screwed if I had not kept an archive copy of the 5.0 installer.

webmaster at nachelfamily dot com
08-Nov-2006 01:13
I made the mistake of setting a 'wildcard application map' for PHP on a Windows 2003 / IIS 6.0 / PHP ISAPI installation. 

This resulted in "No input file specified" errors whenever I tried to load the default page in my site's directories.  I don't know why this broke things, but it did.

If anyone has the same problem, this may be the cause.

yacahuma
05-Oct-2006 07:44
IIS6 AND PHP5 on w2k3
1.download php and unzip to c:\php
   - also create c:\php\sessions
2.add c:\php to you path
   -right click mycomputer,properties,advance,env variables
2.On IIS Manager add web service extension
   -name: php isapi
   -req files: c:\php\php5isapi.dll
3.Now let iis know what to do with .php
  -On iis Manager,right click Web Sites, properties, home directory tab, configuration button, add button
     executable: c:\php\php5isapi.dll
     extension: .php
     limit to: GET,POST,HEAD
4. rename php.ini-recommended to php.ini
  you can copy php.ini to c:windows or modify the registry to look for php.ini in c:\php
   to use the registry create a php.reg file with the following inside. after this just double click. do not put the lines.
-------------------------------------------------
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\PHP]
"IniFilePath"="C:\\php"
-------------------------------------------------

5. modify php.ini with
short_open_tag = On
extension_dir = "c:\php\ext"
cgi.force_redirect = 0

6. the web sites are going to be using the default pool. this runs under network service. go to c:\php and give the network service  read& execute, list folder content,read
  -go to c:\php\sessions and add write and modify access network service

winterspan - AT - g m a i l . /C/O/M
20-May-2006 04:57
READ HERE If installing PHP 5.x on Windows Server 2003 / IIS 6.x ...
It was extremely frustrating getting this to work, so hopefully my struggle will allow others to do this the *easy* way.
BEFORE installing PHP 5 from a web tutorial (a good one found here: http://www.peterguy.com/php/install_IIS6.html)
You need to READ THESE TIPS:

 #Necessary Permissions For WinServer 2003 / IIS6.0#

These are the permission settings I found to work well with good security:
NTFS permissions (right-click file or folder, select preferences, go to security tab)

1) PHP Install folder -> You need to give NT account: 'Network Service' read/execute permissions on the 'php' install folder (e.g., C:\\PHP). If you have a TMP or SESSION folder within the main PHP folder, you need to give account 'Network Service' read/execute AND write access on those folders.  *(You DO NOT need to give the anonymous internet user account: 'IUSR_[name]' ANY permissions on the PHP INSTALL files themselves. )*

2) You DO need to give account: 'IUSR_name' Read/execute
permissions on the actual WWW root folder and web .php files (if you want to apply to all sites) or each websites WWW root and .php files if running multiple sites.

3) Within the IIS 6.0 console itself, in the website's preferences (right click on ind. site or 'websites' node to apply to all sites -> select preferences) on the
'Directory Security' tab -> click edit, and if you wish to allow anonymous access to your site, check the anonymous access box and be sure to enter account: 'IUSR_name'.

4) *MOST IMPORTANT*
As mentioned by a few others, install php and configure the php.ini WITH NO EXTENSIONS AT FIRST. The reason being if one of the extensions fail, the error dialog will pop up OUTSIDE of a terminal services window (remote desktop). So you will NOT BE ABLE to click on the error, and the websites php file you are trying to load in your browser will hang indefinately (after having this happen for 12 hours I almost went insane trying to figure out the problem) LOL.

Then when you have successfully loaded a test php page in the browser, go back to the php.ini file and add extensions in one at a time.

If YOU have any tips I haven't included, email me. Again,
I am not a professional, still a student in learning. :)

Now that you have read that, go back to the link I placed near the top, and follow his tutorial for general installation/setup.

Nestor Custodio
04-May-2006 03:40
If the path to your PHP directory has spaces (e.g. "C:\\Program Files\\PHP") and IIS gives a 500+ error or responds with "The specified module could not be found." when you try to run a PHP script, try changing the ISAPI DLL's path in IIS (in the "Home Directory" tab, under "Configuration...") to the 8.3-equivalent path.

That is, use C:\\PROGRA~1\\PHP\\php5isapi.dll instead of "C:\\Program Files\\PHP\\php5isapi.dll".

Cam McVey
20-Apr-2006 10:48
If you are using Application Pool Isolation and you're trying to get PHP to run as CGI and you're getting 403 errors, try looking at this article (watch the word wrap):
http://www.servertastic.com/articles/2005/11/
unable-to-run-perl-or-php-in-application-pool-isolation/

SmugWimp at smugwimp dot com
20-Apr-2006 09:29
If you make changes to your PHP.ini file, consider the following.

(I'm running IIS5 on W2K server. I don't know about 2K3)

PHP will not "take" the changes until the webserver is restarted, and that doesn't mean through the MMC.  Usually folks just reboot. But you can also use the following commands, for a much faster "turnaround".  At a command line prompt, type:

iisreset /stop

and that will stop the webserver service.  Then type:

net start w3svc

and that will start the webserver service again.  MUCH faster than a reboot, and you can check your changes faster as a result with the old:

<?php>
phpinfo();
?>

in your page somewhere.

I wish I could remember where I read this tip; it isn't anything I came up with...

ratkinson at tbs-ltd dot co dot uk
04-Apr-2006 12:28
When installing onto the Windows IIS platform, ensure you add the PHPRC Server Variable to point to your PHP.INI file.

Also, add '.INI' to the FILEEXT Server Variable. Failure to add these could stop the PHP engine being able to find your PHP.INI file, and none of your modifications will be read.

Rob.

niatech
01-Mar-2006 04:36
Thought someone would save some time and headaches by using this post.

Our tech department is migrating to Windows 2003 Server and they have some complex security implementations between our Web Servers and our Application (COM) servers.

If you have this type of scenario and are receiving the "Warning (null)(): Unable to lookup.... Access is denied." error, it is because the "Identity" in the Web Server's application pool does not have sufficient permissions to connect to the Application (COM) Server.

To fix this:

- create a new Application Pool
- right click the new pool and select "properties"
- click on the "Identity" tab
- change the permissions from "Network Service" to a user on the Web Server who has access to call the Application (COM) server.
- right click the application pool
- click "start"
- right click your web site
- click on the "Home Directory" tab
- change the application pool to the new application pool you've just created.
- restart IIS

Hopefully this will save someone some time and headaches.

mach
28-Feb-2006 02:15
I've installed Apache + PHP on a Windows machine of which I'm not an administrator.

I found out it was necessary to change the permissions of the httpd.conf file on C:\Program Files\Apache Group\Apache\conf in order to have everything working. Since I'm also using cygwin this was simply done with: >chmod 755 httpd.conf.

lukasz at szostak dot biz
15-Jan-2006 03:50
You can have multiple versions of PHP running on the same Apache server. I have seen many different solutions pointing at achieving this, but most of them required installing additional instances of Apache, redirecting ports/hosts, etc., which was not satisfying for me.
Finally, I have come up with the simplest solution I've seen so far, limited to reconfiguring Apache's httpd.conf.

My goal is to have PHP5 as the default scripting language for .php files in my DocumentRoot (which is in my case d:/htdocs), and PHP4 for specified DocumentRoot subdirectories.

Here it is (Apache's httpd.conf contents):

---------------------------
# replace with your PHP4 directory
ScriptAlias /php4/ "c:/usr/php4/"
# replace with your PHP5 directory
ScriptAlias /php5/ "c:/usr/php5/"

AddType application/x-httpd-php .php
Action application/x-httpd-php "/php5/php-cgi.exe"

# populate this for every directory with PHP4 code
<Directory "d:/htdocs/some_subdir">
    Action application/x-httpd-php "/php4/php.exe"
    # directory where your PHP4 php.ini file is located at
    SetEnv PHPRC "c:/usr/php4"
</Directory>

# remember to put this section below the above
<Directory "d:/htdocs">
    # directory where your PHP5 php.ini file is located at
    SetEnv PHPRC "c:/usr/php5"
</Directory>
---------------------------

This solution is not limited to having only two parallel versions of PHP. You can play with httpd.conf contents to have as many PHP versions configured as you want.
You can also use multiple php.ini configuration files for the same PHP version (but for different DocumentRoot subfolders), which might be useful in some cases.

Remember to put your php.ini files in directories specified in lines "SetEnv PHPRC...", and make sure that there's no php.ini files in other directories (such as c:\windows in Windows).

And finally, as you can see, I run PHP in CGI mode. This has its advantages and limitations. If you have to run PHP as Apache module, then... sorry - you have to use other solution (the best advice as always is: Google it!).

Hope this helps someone.

phil at pelanne dot com
05-Jan-2006 05:22
For those of you trying to install PHP 4 and PHP 5 concurrently on a windows 2003 box, there is just one rule you need to adhere to in order to make it work: 

- Don't have either of them in c:\php\.
- Don't have a php.ini in your system32 directory.

Put PHP 4 into a directory called c:\php4\.  Put its php.ini in there, and make sure all the paths reflect the c:\php4 directory.

Likewise, put PHP 5 into a directory called c:\php5\.  Put its php.ini in there, and make sure all the paths reflect the c:\php5 directory.

Add them as allowed script mappings in your iis extensions area, and have fun!

cormierma_at_csdcso.on.ca
21-Dec-2005 09:34
Note to windows server 2003 users

If you install php5 ISAPI on windows server 2003 / IIS and keep getting a 404 when you try to view a php script don`t just activate "all unknown ISAPI extensions" but also activate "All Unknown CGI Extensions".

Cevher Bozkur
13-Oct-2005 01:37
I've installed php 5.0.5 with the ISAPI module, as the isapi dll file (php5isapi.dll) resides in the php root directory, I didn't have trouble in my installation (In php4 this dll file is in sapi directory and it should be moved to php root directory).

I changed some of my settings in php.ini file and restart IIS Web site,but my changes weren't applied.

Then I go to Control Panel>Administrative Tools>Services and restart the IIS Admin Service.

Everything worked like a charm...

william keith
28-Sep-2005 10:51
Dirt Simple Install Guide For PHP5/W2K Servers

For those of us out there who still have 2K servers, this is a great 3 min step by step to get you up and running.

http://www.onlamp.com/pub/a/php/2000/12/14/php_admin.html

Thanks to it's author, Darrell Brogdon!

thedeadraptor2000 at yahoo dot com
30-Aug-2005 03:02
Note regarding PHP4 Installation on IIS5 + Win2K

Tip: Don't install PHP4 on Directories with spaces in between.

I've had problems Installing PHP 4.0.0 on IIS5, Win2k's default web server, spanish version (I live in Colombia). I've had HTTP 500 Errors and I followed all instructions step by step, but nothing seemed to work.

I solved the problem eventually, and I think it had something to do with the fact that I have installed PHP4 manually and placed it in the directory "C:\Archivos de programa\php-4.4.0-Win32" ('Archivos de programa' stands for 'Program Files'), a directory with spaces in between.

When I added the application mappings for "C:\Archivos de programa\php-4.4.0-Win32/sapi/php4isapi.php", An error would ocurr and a message along with it: "Escriba una ruta de acceso valida", as in "Write a valid access rute", as in "I can't find the file".

I thought i had it when I encapsulated it with Doublequotes ("), but that didn't work either.

As a final long shot, I copied the php4isapi.dll to the windows/system32 directory and 'WALA!' It worked.

I'm not sure, but i suspect that it had to do with spaces in between directory names, so avoid those, or copy the isapi module to another directory.

Hope this helps someone!

wappa at hotmail dotandthekangaroo com
05-Aug-2005 03:16
Don't forget if you are getting ACL exceptions to reading the test php page you have created you MUST share the PHP directory or the resources PHP uses to "everyone" but remember use restricted access for security.

jp at iticonsulting dot nl
23-Jul-2005 04:42
If you get 404 page not found on Windows/IIS5, have a look at C:\SYSTEM32\INETSRV\URLSCAN

There is a .ini file there that prevents some files from being served by IIS, even if they exist, instead IIS will give a 404. The urlscan logfile (same place) should give you some insight into what parameter is preventing a page from loading, if any.

Feroz Zahid
08-Jun-2005 08:41
In order to run php scripts with php.exe CGI instead of php4isapi.dll under IIS, following steps can be followed.

i) Add a web service extension for PHP using IIS manager. Choose a web service extension name like 'PHP' and add your php.exe path in the 'file location' while adding the required file e.g. 'C:\php\php.exe' in the Add extension dialog box. Don't forget to 'Allow' the extension file.

ii) Open php.ini file located at %systemroot%. Set the following variables to the shown values.

cgi.force_redirect = 0
cgi.redirect_status_env = ENV_VAR_NAME

iii) In your websites, add Application Mapping for '.php' and set the executable path to your php.exe file path.

You can test whether PHP is running or not and other PHP settings using the following simple PHP script.

<?php>
phpinfo();
?>

Feroz Zahid
ferozzahid [_at_] usa [_dot_] [_com_]

donald at netriver dot net
04-May-2005 08:21
On the Windows 2003 & IIS6 platform, you can run different websites on different versions & copies of PHP. This is useful in at least two cases:

  1. You want one website on your box to have register_globals on, but since you're running IIS, you cannot specify that in an .htaccess file. And you definately don't want register_globals on for the rest of the websites.
  2. You want to run different versions of PHP for different websites, or even just different extensions. Say you wanted one site to use 4.0.5 and a different site to use 4.1.11.

Its simple, just:
  1. Move your php.ini file from your c:\windows\ directory directly to your php directory (by default that would be c:\php\)
  2. Make sure you don't have a php.ini file in any other location that would supercede the c:\php\php.ini file. Using phpinfo(); is useful here.
  3. Have your alternate version of php (either a different version or a different php.ini) have its own install directory, like c:\php4RG\ or c:\php405\.
  4. In the Home Directory Configuration for your website, specify the .php extension to use a different script, pointing it at the alternate directory.

doyouunderstand at gmail dot com
04-Mar-2005 12:31
For those having trouble installing PHP 5+ ISAPI for IIS 6 (on Windows 2003 server), who have tried everything on this site and all over the net, with no success (like I did) - try the following before throwing your server out of a 3rd story window.

http://www.benmardesign.com/IIS_PHP_MYSQL_setup/php_setup.html

It was the only thing that worked out of all the many solutions I tried.

Probably some other solutions would've worked as well, but in my frusterated state of mind, this explanation was the clearest. 

My problem was that in addition to adding the the Web service extension, I was not adding the ISAPI extensions for the websites in IIS Manager manaully.  ALSO, remember to reboot after the changes on the site listed above.  It's the only thing he forgot to mention, and depending on your setup, you may need to reboot to register the dll moves and changes made.  (IIS restart will not re-register dlls).

Steve N
02-Feb-2005 04:33
Just a note following on from Luis D regarding adding the pgp4ts.dll as a Web Server Extension.

I just used the latest php-4.3.10-installer.exe from php.net and had the problems where .php files could not be found.

In order to get them to work I added and allowed the php.exe as a Web Service Extension and not the php4tx.dll.

Cheers,

Steve

claudio_jvt at hotmail dot com
14-Jan-2005 12:38
One very helpfull note to Win2003 iis6 users:
If you'd like to use isapi in the web service extensions and you're in a development server (or even if your php.ini config file changes frequently), here's what you can do:

Php.ini runtime changes:
Create a new application pool in iis:
iis->select server->application pools->new application pool
                 Use default settings;
      go to the application pool you've created, properties->
    check the "Recycle worker process" option, and give it a small value (10 is nice :) ).

Now go to your site (or virtual directory site)-> properties->
change the application pool to the newly configured appPool.

At this moment, is good to make a iss restart (note this is the only resart needed).

Your site is now semi-runtime changed :)
You can try it with the usal php info() test. Change something in the php.ini and check the number of requests it takes to use the new configuration.

The downside of this approach (wich is still better than to use php-cgi.exe): the process is recycled, so all the configuration in php.ini is read every N requests - with php-cgi.exe, this would happen for every request, so.. is a good solution.

Again, be carefull when using this in a production environment, since the load can increase (not sure how much, but it will certainly increase).

And keep in the new appPool JUST the php sites that require runtime changes in php.ini !

------
You've helped me, so I help you ;)
Tks

chris at move dash media dot com
10-Jan-2005 12:39
Note to windows users, if you are trying to install php5 ISAPI on windows server 2003 / IIS and getting a 404 when you try to view a simple php script, even though everything else seems to be right...  click into "web service extensions" from IIS and either add a new web service extension, or click onto "all unknown ISAPI extensions" and click allow.

ntadmin at aplus dot net
27-Aug-2004 06:53
When configuring application pools with configurable
accounts instead of NETWORK SERVICE or LOCAL SYSTEM
remember to add the user to the correct security contexts found here:

Note: Watch for wordwrap
http://www.microsoft.com/resources/documentation/
WindowsServ/2003/standard/proddocs/en-us/Default.asp?
url=/resources/documentation/WindowsServ/2003/standard/
proddocs/en-us/sec_acc_wpenable.asp

Otherwise you will recieve 403 errors.

Sean Boulter
15-Apr-2004 09:00
This fixes the "The directory name is invalid" error.

In IIS 5.1 on Windows XP Pro, Go into the Internet Information Services, and into the properties of the virtual directory where the problem occurs.  On The 'Virtual Directory' tab, click on the 'Configuration...' button.  Select the '.php' extension, and press 'Edit'.  On the bottom, Check the 'Check that file exists' checkbox.

Luis D
27-Mar-2004 12:49
This is just to clarify on a posting on this page that states the nescesity of allowing all unknown cgi Extensions in Windows 2003 IIS 6. Although this will work and it should be consider as a quick option for an itranet solution with no web access at all.

This poses a very serious security problem and its not the best course of action, in my opinion.  The proper way of making this work will be to actually enable the extension that you want to execute.  After verifying that the .php extension is present, simply go to "Web Service extensions" in the IIS Manager and click on "Add a new web service extension";

Once the "new web service extension" opens:

1- Add the "extension name" field, please enter "PHP" (or what ever you wanna call it) Other more conservative admins will say call it what it is and always input ".php".  Its up to you!
2-Click on the "add" button and browse to the php4ts.dll file on your c:\PHP (default)  and then click open --> OK and set the checkmark under "set extension status to allowed" click OK and thats it!!!

If you missed the checkmark moment cause you are just so impatient, like me, then simply select the extension on the web service extensions windows and click ALLOW.

This is a very simple process and it will work everytime.

I hope this helps, as I have found several things in this forums that are incredibly helpfull!!

PS: For the non programmer, it is a good practice to install mysql and a free php forum like bb2 to test how well your php IIS and mysql is working.

ferchland at computer-kontor dot de
06-Feb-2004 04:51
If need a php4apache.dll compiled with EAPI _and_ you run Apache with mod_ssl, use the Apache from
http://hunter.campbus.com/

This is already a binary for win32, but the *.lib and headers are included.

ungdi at hotmail dot com
21-Jan-2004 09:36
Under a Windows 2003 and IIS 6.x installation of PHP, it is interesting to note that by default in most cases, the "DefaultAppPool" for the "Default Web Site" is running under the security context of "Network Service" which maybe too restrictive. This results in a 403: Forbidden error every time you try to access a PHP page.

You have several options to remedy the problem:
an obvious one is to make it run as the "Local System", but that may be too much power for some administrators' tastes.

The other option is at the IIS Manager,
go to the computer's "Application Pools" folder,
and go to the properties dialog box of the "DefaultAppPool",
and then to the "Identity" tab, and select the "Configurable" identity of "IWAM_[COMPUTER_NAME]" as the security context. This will make the application pool run the way it did in the previous versions.

This solved the repeated problems of the 403 errors. However, do not forget to give permission to "IUSR_[COMPUTER_NAME]" and "IWAM_[COMPUTER_NAME]" appropriate directory permissions for your web directories as stated above.

spf at users dot sf dot net
19-Aug-2002 03:55
To allow acWEB.sf.net win32-webserver and Eserv 2.98 (www.eserv.ru) web-server run PHP 4.2.2 without problems with FORCE_REDIRECT you should set "cgi.force_redirect = Off" in php.ini in windows directory.

adam dot swick at pantellos dot com
15-Mar-2002 05:36
IIS 5: If you change the application mappings for PHP (for example, from CGI to ISAPI module), reboot after the change is made.  The PHP Application Mapping change may cause a conflict if ISAPI applications are cached.

mike at schild dot com
01-Aug-2000 05:44
It's a hard way to get work php on win98/PWS... but with this comment-page I found it out how it works:<br>
- error 403: give read/write rights to the directory. You can do this by clicking the right mouse key on the directory in the explorer.<br>
- html file in a dos box: 1) clean the "doc_root" line in the php.ini file.   2) start personal web-manager / go to 'advanced' / make for your web-default-directory a virtual directory with all possible rights.<br>
On my system it works now!


  • PHP - Mac - Mac Installation Guide



  • To install:

    1. For Apache 1.3, download:
      http://www2.entropy.ch/download/entropy-php-5.2.4-1.tar.gz

    2. For Apache 2, download:
      wget
      http://www2.entropy.ch/download/entropy-php-5.2.4-1-apache2.tar.gz



    3. Unpack the compressed .tar.gz file, but DO NOT USE StuffIt Expander.
      Instead, use Apple's BOMArchiveHelper or the command line.

    4. Double-click the installer package and follow the directions of the
      installer application.



    That's all! PHP should now be up and running. You can test it by dropping
    a file named test.php into your
    Sites folder in your home directory.
    Into that file, write this line: <?php phpinfo() ?>.

    Now open up 127.0.0.1/~your_username/test.php in your web
    browser. You should see a status table with information about the PHP module.



  • PHP - Linux - Linux Installation Guide



  • There are several ways to install PHP for the Unix platform, either with a compile
    and configure process, or through various pre-packaged methods. This documentation
    is mainly focused around
    the process of compiling and configuring PHP. Many Unix like systems
    have some sort of package installation system. This can assist in
    setting up a standard configuration, but if you need to have a
    different set of features (such as a secure server, or a different
    database driver), you may need to build PHP and/or your web server.
    If you are unfamiliar with building and compiling your own software,
    it is worth checking to see whether somebody has already built a
    packaged version of PHP with the features you need.


    Prerequisite knowledge and software for compiling:


    • Basic Unix skills (being able to operate "make" and a C
      compiler)



    • An ANSI C compiler




    • flex: Version 2.5.4



    • bison: Version 1.28 (preferred), 1.35, or 1.75




    • A web server



    • Any module specific components (such as GD,
      PDF libs, etc.)




    The initial PHP setup and configuration process is controlled by the
    use of the command line options of the configure
    script. You could get a list of all available options along with short
    explanations running ./configure --help.
    Our manual documents the different options separately. You will
    find the core options in the appendix,
    while the different extension specific options are descibed on the
    reference pages.


    When PHP is configured, you are ready to build the module and/or
    executables. The command make should
    take care of this. If it fails and you can't figure out why, see
    the Problems section.


































































    add a note add a note
    User Contributed Notes


    Installation on Unix systems

    Neil Davis

    08-Feb-2008 03:51


    On Red Hat EL5.1 you need to install the libtool-ltdl-devel package (or the workaround below) to compile php.



    symbolic link libltdl.so to libltdl.so.3.1.4 missing and the compile will fail.



    Noting this because it wasn't necessary in Red Hat EL4.1 and caused confusion. I verified this on the box I'm migrating from. Since I built the box, and compiled php on it, I know I didn't need to do this before.



    You can get around needing to install this devel.

    Workaround:

    # cd /usr/lib

    # ln -s libltdl.so.3.1.4 libltdl.so




    The devel rpm isn't necessary, just the link. I'll leave it at that. This is an rpm packaging convention change with ES5.



    -Neil


    packard_bell_nec at hotmail dot com


    27-Oct-2007 11:06

    If you install PHP as an Apache module, you can consider the following. Instead of adding:





    application/x-httpd-php    php


    application/x-httpd-php-source    phps






    into Apache mime.types, you can add:





    AddType application/x-httpd-php    .php


    AddType application/x-httpd-php-source    .phps





    into Apache httpd.conf, OR you can add:





    AddHandler application/x-httpd-php    .php


    AddHandler application/x-httpd-php-source    .phps





    into Apache httpd.conf. The last one is the preferred way of configuration, but it does not work in previous Apache versions.


    phpnet at puellae dot com

    17-Oct-2007 05:19


    Further down in the links it talks about using the fPIC option in the compiler to fix the SElinux error.  I messed around with it and adding --with-pic to the configure will also allow the module to load.  I have not done more testing with it but apache at least starts.  If you have already compiled you will need to do a make clean before recompiling.



    phpnet at puellae dot com

    17-Oct-2007 04:16

    If you get an apache failing to start message with SElinux enabled.

    The error in var/log/messages is:

    Oct 17 10:41:49 nwn kernel: audit(1192635709 begin_of_the_skype_highlighting              1192635709      

    end_of_the_skype_highlighting.825:37936): avc:  denied  { execmod } for  pid=23189 comm="httpd" name="libphp5.so" dev=hda3 ino=4980740 scontext=user_u:system_r:unconfined_t:s0 tcontext=user_u:object_r:usr_t:s0 tclass=file




    See the following page:

    http://danwalsh.livejournal.com/6117.html?thread=23525



    Basically do a chcon -t textrel_shlib_t libphp5.so

    It does not sound like it is too dangerous.



    aryeh dot friedman at gmail dot com

    13-Sep-2007 11:05

    For all multi-core processors (not just Sun as noted above) you need to add --enable-shared-core to the apache config



    Alex at GrimMusic dot com

    13-Nov-2006 08:49

    I am new to linux/apache/php (coming from server 2003/IIS/Asp.Net), so i was stumped as to why php/apache could only use static content. Also, it couldn't access some documents that you created somewhere else, and then dragged into the HTML directory.






    After some research, i found the problem was the SELinux context of the files. It took me forever to find the Proper command to use to change that, as all the examples on the net were out dated using old commands:


    # chcon "user_u:object_r:httpd_sys_content_t" /var/www/html -Rc





    This will change the SELinux context of all the documents under the /var/www/html directory (which is the web directory under Fedora), to allow the httpd process to access them, and the '-Rc' flag will make the changes Recursive, and will output it's progress for each file that it sucessfully changes.



    squeegee

    01-Oct-2006 04:24

    It wasn't until I also added LIBS="-lirc" to the beginning of the configure line that it would configure without errors. It also compiled fine after that. So the start of my configure line looked like this:





    LDFLAGS="-lirc" LIBS="-lirc" EXTRA_LIBS="-lirc" ./configure



    Arjan van Bentem

    12-Jul-2006 07:29

    When using Red Hat Fedora, beware of Security Enhanced Linux, SELinux.




    Quoted from Red Hat: "The security goal is to make sure that Apache HTTP is only reading the static Web content, and not doing anything else such as writing to the content, connecting to database sockets, reading user home directories, etc."



    These limitations include, among many other things, using mkdir to create directories, using fopen to access files, using fopen or get_headers to read URLs, or using exec to run external applications that happen to use sockets (or maybe access some files, but which will run fine when executed from the command line as Unix user apache or httpd -- such as HylaFAX "faxstat" as invoked from nweb2fax recvq.php and sendq.php).



    See /var/log/messages for any denials due to the SELinux policy. To disable it:



    - System, Administration, Security Level and Firewall

    - open the SELinux tab

    - click the Transition tree

    - check Disable SELinux protection for Apache HTTP


    - execute /etc/init.d/httpd restart



    See also http://fedora.redhat.com/docs/selinux-faq/ and http://php.net/results.php?q=selinux&p=wholesite



    dpresley4 at yahoo dot com

    06-Nov-2005 11:42

    Hi,



    PROBLEM:  ./configure PHP --with-oci8




    fails with unresolved references such as __rpc_thread_destroy@GLIBC_2_2_3_...



    ONE SOLUTOIN



    FOR SOLVING PHP ./configure RESULTING IN  __rcp_thread_destroy@GLIBC_2_2_3_... AND

    UNRESOLVED REFERENCES WITH ORACLE OCI8



    KEYWORDS: PHP OCI OCI8 NET8 ./configure __rpc_thred_destroy UNRESOLVED REFERENCES




    For building php-4.4.1 or later with oci8, make sure your LD_LIBARRY_PATH has at a minimum the following directories in its path for Oracle8i 8.1.5 or later, Oracle9i 9.0.2 or later, and Oracle9i Release 2: 9.2.0.4 or later, do the following:



    Note:  We are not using the Oracle Instant Client here.  This assumes you have an actual Oracle Installation.



    1. Set ORACLE_HOME



    Example using Oracle 9i Relase 2 -- 9.2.0.5:



    ORACLE_HOME=/opt/app/oracle/product/9iR2




    2. Set LD_LIBRARY_PATH with:



    LD_LIBRARY_PATH=$ORACLE_HOME/lib: \

        $ORACLE_HOME/rdbms/lib:\

        $LD_LIBRARY_PATH



    3. On Unix / Linux, don't forget to export these environment variables:



    export ORACLE_HOME LD_LIBRARY_PATH




    4. Now, build PHP with the following:



    ./configure --with-apxs2=<path to Apache 2.0/bin/apxs> --with-oci8=$ORACLE_HOME --enable-sigchild



    It should now build correctly. The key with Oracle is to ensure that you pick up the libclntX.so (client librariess) where X is the Oracle version associated with the version your using for instance, in the above example, libclnt9.so



    Also note that if your using Oracle 9iAS Release 2 v9.0.2, Oracle 10g iAS Release 1 v9.0.4.1, the above steps will work because ORACLE_HOME will containe all of the libraries necessary.  Simply point ORACLE_HOME to the top level directory of these installations and set LD_LIBRARY_PATH as described above.




    Hope this helps.


    phptard at gmail dot com

    23-Mar-2005 12:17


    after a long night of wrestling with mysql4.0 under linux compiled with the intel compiler, i've gotten php5.0.3 to compile with mysql libraries for this flavor of mysql:



    1: download the mysql for linux/intel compiler and install

    2: download the rpm for the intel compiler libraries and install

    3: configure php with LDFLAGS="-lirc -lgcc_s" and EXTRA_LIBS="-lirc -lgcc_s"



    Example:



    LDFLAGS="-lirc -lgcc_s" LD_LIBRARY_PATH="-L/usr/lib64" LD_PATH="-L/usr/lib64" LDPATH="-L/usr/lib64" EXTRA_LIBS="-lirc -lgcc_s" ./configure --with-apxs2=/usr/local/apache/bin/apxs --with-ssl=/usr/local/ssl --without-sqlite --with-zlib-dir=/usr --with-mysql=/usr/local/mysql




    of course this is on a xeon system that has half of its modules in the /usr/lib64 directory, so on a normal system, without the other kruft, it would look something more like this:



    LDFLAGS="-lirc -lgcc_s" EXTRA_LIBS="-lirc -lgcc_s" ./configure --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql



    Hopefully this will save someone the 6 hour headache it caused me..



    alexander justadot henry at acm dot org

    22-Dec-2004 08:48

    The system at my workplace has a need for apache/php with all static compilation.  In order to save time adminning our systems, I decided to make my own RPM of php/apache with mod_ssl support.  I had always installed by hand with the instructions on this page, but when buiding the RPM way, came upon the following error when apache was compiling:



    ===> src/modules/php4


    make[4]: *** No rule to make target `all'. Stop.



    Ordinarily this is because one did not do a 'make install' in php before the second apache configure, or somehow the make install failed.  But the way rpm's work, the make install must be in the %install portion of the spec file, after all makes are completed.



    make install-sapi



    This line will copy relevant files to the directory specified in --with-apache



    thansen at terra dot com dot br

    31-Dec-2003 04:36

    The configure directives --with-apxs2 and --with-apxs2filter are not compatible one with other, even though the configure script will not complain about that. Each one affect the way Apache will call the php parser: If you choose the first one, you must use the traditional include:



    AddType application/x-httpd-php php




    at httpd.conf, to call the parser. If you use the --with-apxs2filter, the include will be:



    <Files *.php>

            SetOutputFilter PHP

            SetInputFilter  PHP


    </Files>



    , and php will be called as a filter to .php files.



    If you use both together, you will get compilation errors (duplicate symbols while linking libphp4).



    aaronmorris at mindspring dot com

    05-Dec-2003 08:47

    If you have the libphp4.a instead of libphp4.so on AIX, you can extract the .so file from the .a file by running "ar -x libphp4.a".



    doug at NOSPAM dot techie dot net

    04-Feb-2003 01:16

    Users compiling under some versions of Solaris/SunOS may encounter the following error.


       symbol ap_block_alarms: referenced symbol not found





    To address this problem, add the following additional flag to the Apache build configure line:


       --enable-rule=SHARED_CORE





    So, adding this to the original instructions, you'd configure your Apache build like so:


       ./configure --prefix=/www --enable-module=so --enable-rule=SHARED_CORE





    Doug



    dimaberastau at hotmail dot com

    10-Jun-2001 04:33


    when installing with mysql support (--with-mysql=<path/to/your/mysql>) via Apache APXS you'll probably get something like 'can't load libmysqlclient.so' when you try to start up apache. There are 2 solutions to this problem. First, (as documented in INSTALL file of the php4 distribution) you can modify /etc/ld.so.conf to contain the directory name where libmysqlclient.so is (so if your mysql is installed in /usr/local, you want to add something like /usr/local/lib/mysql into /etc/ld.so.conf), else (and particularly if you haven't got the super-user on the system) you can modify (or create if it isn't defined already) LD_LIBRARY_PATH shell variable to reflect the changes you would have otherwise made to /etc/ld.so.conf (again if mysql is /usr/local LD_LIBRARY_PATH=/usr/local/lib/mysql). Either one of these methods will get the problem sorted. Just remember to run ldconfig (so that /etc/ld.so.cache is updated) if you chose to modify /etc/ld.so.conf


    marshalm at ebrd dot com


    17-May-2001 05:43

    HP-UX 11.X PA-RISC installation with oracle (oci8). You need to install the HP-UX patch PHSS_22514 patch (updated libdld.sl), otherwise you will get errors with dlopen() and dlclose() not found during the apache integration stage.




    Comments (0)

    Post a Comment

    Copyright © 2009 virtualinfocom All rights reserved. Theme by Games. | animation Ani2Pix.