Install NetPBM for IIS

Further to the article I wrote last week on how to install ImageMagick for IIS, I thought I'd continue along the same track this week and create a guide to install NetPBM for IIS. Like ImageMagik, the NetPBM package is a suite of executables which allow the manipulation of image files and is used by a variety of photo gallery style web applications (especially PHP based applications). In this guide we'll show you how to install NetPBM on Windows so that you are able to use it with IIS and your web applications.

Configuring NetPBM for IIS is very similar to the method used to configure ImageMagick and basically comes down to setting permissions. A note of warning though is that to do this you must make the NetPBM binaries executable by IIS, which is loosening your permissions and could potentially be a security issue.

1. Download and extract
Obviously the first step is to get your hands on a copy of NetPBM for Windows. Goto the download page at the NetPBM site. This version of NetPBM also includes the Jhead utility which is used to preserve EXIF data when manipulating your images. Once you have downloaded NetPBM, extract the program using your favourite compression tool. I would suggest you place it in a directory structure which has no spaces in the path.

2. Setting directory permissions
Once installed the next step is to set the permissions. To do this we'll use the cacls command line utility that comes with Windows as I've done before in my article on troubleshooting the Warning: exec() [function.exec]: Unable to fork PHP error. In this example I have installed NetPBM in the root of my C drive in a directory called "NetPBM". Lets first take a look at the default permissions attached to this directory by simply opening a command window and typing in cacls [directory path] and you should get similar results to below.

C:\>cacls NetPBM
C:\IM BUILTIN\Administrators:(OI)(CI)F
      NT AUTHORITY\SYSTEM:(OI)(CI)F
      LAPTOP\Brashquido:F
      CREATOR OWNER:(OI)(CI)(IO)F
      BUILTIN\Users:(OI)(CI)R
      BUILTIN\Users:(CI)(special access:)
                        FILE_APPEND_DATA

      BUILTIN\Users:(CI)(special access:)
                        FILE_WRITE_DATA

The next step is to replace the permissions with only the very minimum you need to be able to use NetPBM with IIS. Do do this you will need to assign the read & execute permissions to the IIS anonymous user account (assuming you are using the default IIS user account for IIS). To do this type in the following command and substitute the "iusr_laptop" user for your own IIS user account (always in the form of IUSR_COMPUTERNAME).

C:\>cacls NetPBM /C /G iusr_laptop:R
Are you sure (Y/N)?y
processed dir: C:\IM

Select yes when prompted and all the permission on your NetPBM directory will be replaced with the one you specified. Once this is complete type in the first command again to see the current permissions and you should see something similar to below.

C:\>cacls NetPBM
C:\IM LAPTOP\IUSR_LAPTOP:(OI)(CI)R

You can now see that all the previous permissions are gone and have been replaced with the permissions you specified in your previous cacls command. Keep in mind that you will need to ensure that the data directory of your photo gallery application will need to have the modify permission set for the IWAM_COMPUTERNAME account (IIS 5 & 5.1) or the NETWORK SERVICE account (IIS 6) in addition to your IUSR_COMPUTERNAME account so they are actually able to write data.

3. Setting cmd.exe permissions
One final thing you find you may need to do is also give access to IIS to execute the Windows command line interpreter which I have already covered in my article Warning: exec() [function.exec]: Unable to fork. Once again a word of warning with this as it does require giving IIS access to execute your command line interpreter which is a security risk (by default your IIS user account is explicitly denied access to cmd.exe).

Hopefully this guide has helped with getting NetPBM available to your IIS environment. As always any feedback or questions, please feel free to leave a comment here or post in the forums.


Average rating
(0 votes)
|
Submitted by Dominic Ryan on Mon, 2008-02-11 05:00.

Post new comment

  • Use <!--pagebreak--> to create page breaks.
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use BBCode tags in the text, URLs will automatically be converted to links.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Copy the characters (respecting upper/lower case) from the image.