ImageMagick, thumbnails, 502 and permissions

400 views
Skip to first unread message

PPlan

unread,
Sep 13, 2010, 10:47:24 AM9/13/10
to ResourceSpace
Hi, I've just installed ResourceSpace onto our server and in the
installation check imagemagick, ffmpeg, ghostscript and exiftool are
all coming up as 'OK' (I had to change some permissions before it
started finding the files though).
I can upload files fine (though the java uploader doesn't seem to want
to work in Firefox), but after the file has uploaded and it is
generating the thumbnail it spends a few seconds trying to do that and
then an error message comes up just saying '502'.

I'm using IIS7 on Windows Server 2008, which also has plesk installed
on it and I've tried entering this into cmd (as is suggested in this
thread http://groups.google.com/group/resourcespace/browse_thread/thread/320602af5e80d307/e88b60bd879833ea
):

cacls c:\windows\system32\cmd.exe /E /G IUSR_MYPC:F

But I get an access denied error. This line is trying to set the
permissions for cmd.exe, right? I also tried setting the permissions
in explorer, but the options were greyed out which could be some kind
of precaution by our hosting company to stop their customers breaking
their servers.

The thread above seems to cover this problem, but they seem to fix the
problem with that cmd line, which isn't doing anything for me. Any
suggestions for how I could get this to work any other way?

Thanks

Tech Patriot

unread,
Sep 13, 2010, 5:38:18 PM9/13/10
to ResourceSpace
You should not need to run the "cacls" command on a Windows Server
2008 (IIS 7.0) or newer operating system (including Windows 7 and
Server 2008 R2). You only need to do that with Server 2003 (IIS 6.0)
and older, so I wouldn't worry about that part.

A 502 error means there's a protocol communication error between two
different processes or programs. I'm wondering what two systems
aren't talking. PHP and ghostscript or imagemagick? I'll have to
think about this more. Maybe someone else has a thought too.

Thanks,
John

On Sep 13, 9:47 am, PPlan <webdesign.photop...@gmail.com> wrote:
> Hi, I've just installed ResourceSpace onto our server and in the
> installation check imagemagick, ffmpeg, ghostscript and exiftool are
> all coming up as 'OK' (I had to change some permissions before it
> started finding the files though).
> I can upload files fine (though the java uploader doesn't seem to want
> to work in Firefox), but after the file has uploaded and it is
> generating the thumbnail it spends a few seconds trying to do that and
> then an error message comes up just saying '502'.
>
> I'm using IIS7 on Windows Server 2008, which also has plesk installed
> on it and I've tried entering this into cmd (as is suggested in this
> threadhttp://groups.google.com/group/resourcespace/browse_thread/thread/320...

PPlan

unread,
Sep 14, 2010, 4:44:54 AM9/14/10
to ResourceSpace
Hi John, thanks for the reply. I tried commenting out the lines in
config.php for ghostscript and imagemagick one at a time and I still
get exactly the same error.
So far I've mostly been uploading .jpg files.
I installed following the windows server 2008 r2 64bit installation
guide on the wiki and the only errors I have in my installation check
are:

PHP.INI value for 'memory_limit' - WARNING: should be 200M or greater
- I've set the value for this in the php.ini, but it doesn't recognise
that I've set it even though it recognises the changes I've made to
the other values. The guide said to change the php.ini in the 'php'
folder on the server, but it only notices the changes when I make them
to the php.ini file in the 'windows' folder.

EXIF extension installed FAIL
- It says exiftool is installed fine, but isn't finding this, though I
don't think the guide mentions EXIF and I don't have a line in the
config.php with a path to where this would be.

PPlan

unread,
Sep 14, 2010, 5:27:06 AM9/14/10
to ResourceSpace
Just a quick update.. something I didn't notice whilst I was testing
before:
With imagemagick disabled - I get the 502 error, but it generates a
thumbnail and the file can be downloaded at two different sizes
With ghostscript disabled - I get the 502 error, it doesn't generate a
thumbnail and it can only be downloaded at the original size
With both imagemagick and ghostscript disabled - I get the 502 error,
but it generates a thumbnail and the file can be downloaded at two
different sizes

Maybe this could give some kind of clue as to what's going on?

Thanks

Tech Patriot

unread,
Sep 14, 2010, 2:57:55 PM9/14/10
to ResourceSpace
Are you using IIS 7.0 with 2008 or IIS 7.5 with 2008 R2? Are either
of these systems with some sort of hosting service or do you have
direct control over these machines. It sounds like you working on 2
different systems now.

The guide for Windows Server 2008 R2 talks about EXIF in section 19.
Here's a direct link to that section:

http://wiki.resourcespace.org/index.php/Installing_on_Windows_Server_2008_R2_64-bit#Install_EXIFTOOL

A key point there is you need to make sure to rename "exiftool(-
k).exe" to "exiftool.exe".

Also, make sure to use forward slashes "/", not backward slashes "\"
when specifying file paths in the config.php or general setup screen
when first installing RS.

Your config.php should have the following lines, but you can manually
add anything that is missing:

# Paths
$imagemagick_path = 'c:/imagemagick';
$ghostscript_path = 'c:/gs/gs8.71/bin';
$ffmpeg_path = 'c:/ffmpeg/bin';
$exiftool_path = 'c:/exiftool';

Also, you may want to make sure this is set too:

$config_windows = true;

I checked my install of RS on my 2008 R2 server. I do not have a
PHP.ini file in the c:\windows folder. Delete the one you have. Make
sure your PATH environment variable has ";c:\php\" somewhere in the
entry.

If you can double-check these things that would be great.

Thanks,
John

PPlan

unread,
Sep 15, 2010, 5:30:44 AM9/15/10
to ResourceSpace
Hi John, thanks again for your reply. Sorry I wasn't specific enough
when saying what the system is. I've double-checked now and it's IIS
7.5 running on Windows Server 2008 R2 Datacenter. It's hosted by a
hosting company and I'm accessing it from a mac running Remote Desktop
Connection.

I followed the steps to install exiftool including renaming the .exe
file when I was originally installing resourcespace. The installation
check says 'OK' for exiftool, but 'FAIL' for EXIF extension installed.

All the paths in config.php are using forward slashes, the paths you
mentioned are all present and $config_windows was already set to true.

I renamed the php.ini file in my windows folder and it now seems to be
picking up the one in my PHP folder, but it is still giving me the
error saying memory_limit needs to be 200M or greater event though it
is set to 2000M. I know that it is picking this file up because when I
change the values for post_max_size and upload_max_filesize it
recognises these changes in the installation check.

Something I noticed today (which I'm fairly certain wasn't there
before) was that there is also this error in my installation check:
GD version Not installed. FAIL
I noticed this before I renamed the php.ini file in the windows
folder. I've checked that php_gd2.dll is in the php/ext folder and
it's set in php.ini

Also something that I think I probably should have mentioned sooner is
that as PHP was already installed on the server before I started
installing resourcespace, I didn't install it into c:/php, but left it
where it was in c:/Program Files (x86)/PHP, but as I made sure the
path in FastCGI pointed to the right place (this step in the guide
http://wiki.resourcespace.org/index.php/Installing_on_Windows_Server_2008_R2_64-bit#Verify_IIS_settings_with_PHP_FastCGI
) and the installation check is picking up the PHP version (it says
4.4.7) I didn't think it would matter, but maybe it does?
Would it be worth installing php again in c:/php? Would this cause any
problems with what's already on the server?
I tried adding this line to the config.php that I found in
config.default.php - $php_path="C:/Program Files (x86)/PHP"; but this
didn't make a difference either.
***update - I just tried installing php to c:/php, but made all the
php pages on our site give bad gateway errors and stop working. It
wouldn't let me change the path in FastCGI to the new location, so I
uninstalled it and put it back where it was. I installed php from
here: http://windows.php.net/download, which says version 5.3.3 but
the installation check still says I've got version 4.4.7


I'm not entirely sure what you mean by PATH environment variable or
how I would set this. I searched for it on the wiki, but the only
pages that mention it are pages that are referring to different
operating systems (XP and server 2003)

Thanks



On Sep 14, 7:57 pm, Tech Patriot <j...@techpatriot.com> wrote:
> Are you using IIS 7.0 with 2008 or IIS 7.5 with 2008 R2?  Are either
> of these systems with some sort of hosting service or do you have
> direct control over these machines.  It sounds like you working on 2
> different systems now.
>
> The guide for Windows Server 2008 R2 talks about EXIF in section 19.
> Here's a direct link to that section:
>
> http://wiki.resourcespace.org/index.php/Installing_on_Windows_Server_...

Tech Patriot

unread,
Sep 15, 2010, 9:49:26 AM9/15/10
to ResourceSpace
Good morning.

I wonder if the host provider is forcing limitations on anything to do
with PHP or other system processes. I'm assuming the host is
providing a virtualized install of 2008 R2 and it's using shared
resources. Do you know how much memory your server is being
allocated? For the memory_limit perhaps try using 200M to start and
see if the change takes affect. The host provider may allow only a
certain amount of memory towards PHP processes. It sounds like the
other changes you make are being read and take affect.

For the PATH environment variable - it is usually not necessary to
configure or even check this when using the .MSI installer version of
PHP. The PHP installation automatically adds this. On XP and Server
2003 we're using the manual installation method for PHP, so it's
necessary to have to add to the PATH statement ourselves. You can
still do this on Server 2008 and newer. For your machine, just check
this:

1. Click the Start button -> Control Panel -> System

2. Click "Advanced system settings" in the upper left.

3. Click the Environment Variables button.

4. In the System Variables section, scroll down and double-click the
Path variable entry.

5. At the end of the Variable Value, type ";c:\php;c:\php\ext"
without the quotes. Click OK three times.

Also, you may not have to specify "c:\php\ext", but sometimes it's for
good measure. Now, this is for if you reinstall PHP to c:\php. With
your current setup your PATH should show ";C:/Program Files (x86)/PHP"

I should probably update the guides and clarify that the installs are
based on local system access, not hosted services. I think some of
the host providers futz with your abilities and place limitations on
what you can do (and for good reason too). However, we should be able
to get this running. Once we do maybe we'll have some notes we can
add to the Wiki for hosted Windows installations.

I'm perturbed why PHP 4.4.7 still shows up after you've installed
5.3.3. Can you uninstall PHP and do a reboot? Maybe the old PHP
process was still running in memory or the old install folders were
not completely removed?

Thanks,
John
> path in FastCGI pointed to the right place (this step in the guidehttp://wiki.resourcespace.org/index.php/Installing_on_Windows_Server_...

PPlan

unread,
Sep 15, 2010, 10:56:28 AM9/15/10
to ResourceSpace
Hi John, our hosting has 999.6MB of memory, I tried changing the value
to amounts less than this like 200, 400 etc, but it still doesn't pick
it up. In the installation check the table cell where it would have
the value is just blank.
I checked the PATH environment variable and it already had C:/Program
Filed (x86)/PHP in there, but I also added it in again with /ext on
the end.
I tried reinstalling PHP to c:/php, but in the fastCGI settings it
won't let me change the path in the existing record or delete the
record and it also won't let me add a new one with the new location,
so it looks like I'll have to keep it where it is.
I also tried uninstalling PHP, restarting and then installing again,
but now none of the php work (they all return a 502 Bad Gateway
error), fortunately the majority of the site is in ASP so it's not
completely down. I think this may be one of the reasons hosting
providers place restrictions on what you can do!

I'm going to try and get PHP working again now, hopefully when it's
back up I'll be able to see if it detects the version change.

Thanks
> ...
>
> read more »

PPlan

unread,
Sep 16, 2010, 12:40:51 PM9/16/10
to ResourceSpace
Whilst trying to fix PHP, I came across the PHP errors log and found
these errors coming up a lot in it:
[15-Sep-2010 15:35:19] PHP Warning: Unknown(): Unable to load dynamic
library 'C:\Program Files (x86)\PHP\ext\php_exif.dll' - The specified
module could not be found.
in Unknown on line 0
[15-Sep-2010 15:37:04] PHP Warning: Unknown(): (null): Unable to
initialize module
Module compiled with module API=20060613, debug=0, thread-safety=0
PHP compiled with module API=20020429, debug=0, thread-safety=1
These options need to match
in Unknown on line 0
[15-Sep-2010 15:37:04] PHP Warning: Unknown(): Unable to load dynamic
library 'C:\Program Files (x86)\PHP\ext\php_ldap.dll' - The specified
module could not be found.
in Unknown on line 0

After doing a bit of searching I think I found out that the "these
options need to match" errors come up when there's conflicts with
versions of PHP.
Don't know why it's saying that php_ldap.dll could not be found,
because it was definitely there. Think php_exif.dll was also there,
but can't check now because I've been removing and reinstalling PHP a
fair few times since yesterday trying to get it to work again.
There might have been conflicts caused by plesk as I've found four
different php.exe files scattered throughout my plesk folders.

Currently unable to do any tests with resourcespace until I get PHP up
and running again.. currently all .php pages are just returning 404
errors, not exactly a problem that's relevant here, but if anyone's
got any suggestions they'd be much appreciated!

Thanks
> ...
>
> read more »

Tech Patriot

unread,
Sep 17, 2010, 10:08:14 AM9/17/10
to ResourceSpace
I was trying out the Plesk demo to see what they're doing with PHP.
It seems you have no control over telling Plesk NOT to futz with the
PHP installation and anything you do inside of Remote Desktop is sort
of pointless. The Plesk interface only gave me the option to choose
one version or another of PHP, not to uninstall it so that I could
install my own instance of PHP via Remote Desktop.

Can you "reset" your virtual server to a sort of factory refresh?
Sorry this is such a pain.

Thanks,
John
> ...
>
> read more »

PPlan

unread,
Sep 29, 2010, 9:39:49 AM9/29/10
to ResourceSpace
Hi John, sorry for the delayed reply, but it took quite a while to get
php up and running again. It turns out that the version of php being
used is plesk's version, which is stored in C:/Program Files (x86)/
Parallels/Plesk/Additional/PleskPHP5 and it just wouldn't run anything
with the version of php I had install in c:/php. I think this is why
even after installing 5.3.3 it was still saying 4.4.7

Whilst trying to get php working again, our hosts installed php
version 5.2.12 and now the installation check is picking up this
version and it is recognising changes that I make to memory_limit in
php.ini

Another thing I noticed was that when I was installing ResourceSpace,
I managed to miss out the 'misc software installs' step and so hadn't
installed java, flash player or MS Visual C++ 2008 Redistributable
Package, but they are now all installed (both 32 and 64-bit versions
where necessary)

I am still getting 502 errors when I upload files (the error always
comes up just before the upload and thumbnail generation is complete),
but I think I might have worked out what it is - it looks like the
version of php I had with plesk before and the newer version I have
installed now were both thread safe versions because in the error in
my last post it says thread safety for the modules it's trying to use
is 0 and thread safety for php is 1.

I'm going to have a go at putting a non-thread safe version of php
over the version in my plesk folder (and hopefully won't break php
again) and see how that goes. Resetting the server isn't really an
option as we've got quite a few sites on there and various databases,
so it would be a massive amount of work.

Thanks
> ...
>
> read more »

PPlan

unread,
Sep 29, 2010, 11:34:08 AM9/29/10
to ResourceSpace
Another update - I was getting an error in the installation check
saying that exif extension wasn't installed (think it's mentioned
somewhere above). I found out that php_exif.dll needs to be loaded
after php_mbstring.dll in the php.ini (it was listed before it because
that was how it was in the file when it was installed), so I moved the
lines of code round and it's now saying that it is installed properly,
so now my installation check has no errors at all..... but I'm still
getting 502 errors with every file I upload!

I've also now installed a non thread safe version of php by using the
binary files and overwriting the ones in the plesk directory (this was
how our host recommended doing it), but still getting the 502 error
come up. There's not been any more errors in the error log since I
installed this version, but it might just not have updated yet.
> ...
>
> read more »

PPlan

unread,
Sep 30, 2010, 12:06:58 PM9/30/10
to ResourceSpace
And another update if anyone's still reading..
If I comment out the paths in config.php for imagemagick, ghostscript,
ffmpeg and exiftool then I can upload files without getting a 502
error, but if I upload anything bigger than around 6mb then I get a
500 error.
Memory_limit, post_max_size and upload_max_filesize are all set
correctly and I've tried different amounts for memory_limit because
the server just has 1GB of RAM.

I read in another post here to check the task list to see if
convert.exe comes up when I upload a file as this indicates whether or
not imagemagick runs. After uploading a few files and watching the
task manager, convert.exe does not come up. php-cgi.exe *32 does come
up and sometimes so does cmd.exe and/or cmd.exe *32, so it looks like
imagemagick (and probably all the other modules) isn't running.
> ...
>
> read more »
Reply all
Reply to author
Forward
0 new messages