IIS interaction with GD, ImageMagick, and php libraries

This post has been placed on Xoops and Peak.ne.jp/xoops but no response, so further to a message from Brash I'm slapping it in here too.

This problem relates to my Intranet site at work, not my personnal site. I have used MyAlbum on the site for a while, and it's got about 50 or so pictures on it and it has always worked great. I then updated to Xoops 2.0.9.2, and since then I get errors as described below. Read on and it will all make sense.

I have tried some steps:

Firslty, the problem :

<br />
PHP Fatal error: Call to undefined function: imagecreatefromjpeg() in d:\cms.fct\modules\myalbum\include\functions.php on line 292<br />

and the URL link goes to :

<br />
http://fct.local/modules/myalbum/submit.php?caller=<br />

Secondly, my setup

<br />
Windows Server 2003<br />
php 4.3.6 (I think, although it could be 4.3.1)<br />
MySQL 4.0.20<br />
IIS 6<br />
Xoops 2.0.9.2<br />
MyAlbum 2.83<br />
NewBB2<br />

Thirdly, the countermeasures taken to resolve this frustrating problem (other than those described above) :

1) Installed ImageMagick, restrated the web publishing service, and rebooted the server. ImageMagick not detected still by Xoops modules, namely MyAlbum and NewBB2 (I still don't know what path to specify for ImageMagick on a Windows Server?).

2) Having been told to read this post at psychostats.com by Predator (in relation to NewBB) I checked that I had the php_gd2.dll library in my php\extensions folder, which I have. Also, updated this file by downloading the full windows binary from php.net because apparently the standard windows installer does not include it.

3) Edited my php.ini file as follows :

a) Checked the extension_dir path did equaled c:\php\extensions. It did.

b) Removed the ; prior to extension=php_gd2.dll
and re-started the web publishing service again.

No joy. In fact, my Intranet site was then innaccessible and users just got 'Page Cannot Be Displayed' errors after a long wait. Every attempted access resulted in an error message being displayed on the server saying 'Unable to load extension php_gd2.dll' or something similar.

So I turned the php.ini file back to how it was and re-started the web publishing service again. Now I can access the site again (thank the lord) but my orginal problem still persists - MyAlbum still cannot receive new graphics, ImageMagick is not detected by either MyAlbum or NewBB2 (although this may be because I don't know what path to specify in the setup for a windows server).

My questions then are these :

1) Could it be an IIS issue?
2) Do I need to tell IIS to use the library as well as php?
3) If so, how?

4) If it isn't an IIS issue, what else could it be?
5) What path do I specify in the preferences of MyAlbum to get it to use ImageMagick (loads of entries about Apache and Linux paths but none for windows)

Is there anything else that may be causing the problem?

Thanks, as always

Ted

Average rating
(0 votes)
Brashquido's picture

Location: Melbourne, Australia

Joined: Sep 2003

Send PM

Brashquido said:

I'm assuming c:\php\extensions is the actual path to your PHP extensions directory? Have you granted the IUSR_ account NTFS read permissions to it as well?

tedsmith's picture

Joined: Dec 2004

Send PM

tedsmith said:

If I recall correctly the access permission is set for the c:\php folder which I assume applies to the subfolders as well? And yes, c:\php\extensions is correct.

Brashquido's picture

Location: Melbourne, Australia

Joined: Sep 2003

Send PM

Brashquido said:

Can you create a new file (call it phpinfo.php or something) and copy the following code to it;

<br />
<div class="codeblock"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br /></span><span style="color: #FF8000">// Show all information, defaults to INFO_ALL<br /><br /><br /><br /></span><span style="color: #0000BB">phpinfo</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?></span></span></code></div><br />

Place the file in your website root folder, and then access it through your Internet browser. Is the GD library listed as loaded?

You might aslo want to enable error logging in your php.ini file as well.

tedsmith's picture

Joined: Dec 2004

Send PM

tedsmith said:

No it isn't listed at all so I assume it would only be listed if enabled? I did a search for 'GD' and 'library' and 'GD Library' was not listed.

This could be because I put the ';' back in front of the GD extension in the php.ini file though I would have thought? As per posting 1, because my users were then unable to access the site at all I had to change it back to how it was.

I wonder why it worked before though? It was only since upgrading to Xoops 2.0.9.2 that the errors started.

Brashquido's picture

Location: Melbourne, Australia

Joined: Sep 2003

Send PM

Brashquido said:

I've just double check my IIS 5.1 test machine, and I have done the same as you. Set the extensions directory and uncommented the gd2 dll file in php.ini. I have 3 Xoops 2.0.9.2 sites running without a problem off this machine.

My recommendation would be to try again, but this time make sure you turn on logging in php.ini. Are you running PHP in ISAPI mode, or CGI?

tedsmith's picture

Joined: Dec 2004

Send PM

tedsmith said:

Hi

Been offline for a while due to moving house, and even now only on dial-up until my Broadband is sorted out.

I'm on leave from work at the moment so can't yet try what you've suggested.

If I recall, it's set as cgi because when I was setting up my Intranet, initially I did have it set up using ISAPI but something didn't work (I can't remember what) so I changed it to cgi upon recommnedation and everyhting has been working fine until this problem came up. What is the significance of this setting just out of interest?

Brashquido's picture

Location: Melbourne, Australia

Joined: Sep 2003

Send PM

Brashquido said:

Straight CGI isn't very efficient or as secure as ISAPI with IIS. The main disadvantages are that CGI requires you to open up NTFS permissions a bit in order to run making it less secure, and CGI is less efficient as the CGI EXE is being executed and terminated for each requests it gets making it slow and memory intensive. ISAPI on the other hand is loaded into memory once, and as it operates as a regular DLL file does not require changes to NTFS permissions.

tedsmith's picture

Joined: Dec 2004

Send PM

tedsmith said:

OK - I'm back to this very annoying issue.

1) I'm using CGI and not ISAPI. Every time I tell IIS to use ISAPI I get white pages, despite permissions for IIS and IUSR being allocated to the php folder and sub-folders. I don't know why - I follow the instructions (as stated in the Sitepoint book) to the letter, but no joy with Xoops.

2) How do I tell IIS to use ImageMagick? It's installed in the C:\Program Files folder of the server. My Xoops site is on the D:\ drive. I know IM has installed OK because I ran the test after I installed it, but none of the Xoops modules can detect that it's there. With auto detect it never detects it, and if I tell it to use IM it tells me the paths are inavlid. I've tried using / and \ , UNC paths and everything. Still no detection. I've read about NetBPM but I can't seem to find an exe installer - it seems to be one of these worrying 'build' packages.

One thing I have discovered is that MyAlbum allows gif files, just not jpegs. We can submit gifs no problem, but whenever it's a jpeg, the problem occurs. So I am guessing that the GD library is not coping with the jpegs for some reason. Weird thing is that we have 48 jpegs that were uploaded using MyAlbum before the upgrade from Xoops 2.0.7 to 2.0.9.2 (now 2.0.9.3).

I'm getting really frustrated with it now. I wish I was never asked to set the bloody Intranet site up in the first place! Being a webmaster is one thing but being a web host is quite another! If I can't resolve this soon I'm gonna a) look like a right plonker and b) have to get rid of the graphics side of things all together - I can't have malfunctioniong parts.

Ooh, one last thing. PHP version... currently we are using 4.3.7 but I notice 4.3.10 came out in Dec 04 and recently 4.3.11. Would I benefit from upgrading? I'm worried that by doing so I'll mess something up! Is it a serious issue? Is there any obvious advantages to upgrading for someone running Xoops on an internal Intranet?

Brashquido's picture

Location: Melbourne, Australia

Joined: Sep 2003

Send PM

Brashquido said:

Quote:

tedsmith wrote:

1) I'm using CGI and not ISAPI. Every time I tell IIS to use ISAPI I get white pages, despite permissions for IIS and IUSR being allocated to the php folder and sub-folders. I don't know why - I follow the instructions (as stated in the Sitepoint book) to the letter, but no joy with Xoops.

We could very easily get bogged down in this. Have you read the PHP installation guide over at www.iis-resources.com ? Easiier still is to just use John Lim's PHP Easy Windows Installer. Do this first and we'll take it from there.