Warning: Unable to fork

napalm

Joined: 2002-09-04
Posts: 2
Posted: Wed, 2002-09-04 06:22

Processing status...
- Adding iconshirtoff.jpg
Warning: Unable to fork [cmd.exe /c c:Inetpubwwwrootpictureutilnetpbmjpegtopnm --quiet c:Inetpubwwwrootmodulesgalleryalbumsalbum01iconshirtoff.jpg | c:Inetpubwwwrootpictureutilnetpbmpnmfile --quiet --allimages] in c:inetpubwwwrootmodulesgalleryplatformfs_win32.php on line 161

Error: Invalid image: iconshirtoff.jpg!
Need help? Look in the Gallery FAQ

The following is the function the appears to cause the probelm with line 161 being return exec("cmd.exe /c $cmd", $results, $status); Is there a trick to allow this to run in my configuration? Following is code:

----------------------

function fs_exec($cmd, &$results, &$status, $debugfile) {

// We can't redirect stderr with Windows. Hope that we won't need to.
return exec("cmd.exe /c $cmd", $results, $status);

----------------

Hi, I am running
WinXP
IIS 5.1
PHP 4.2.2

Is there something simple I am missing in order to allow the fork Command?

Thanks

 
N2O4U

Joined: 2002-09-03
Posts: 1
Posted: Wed, 2002-09-04 07:26

i am having same problem - identical setup. pls help! thanks

 
MSboy
MSboy's picture

Joined: 2002-09-06
Posts: 6
Posted: Fri, 2002-09-06 18:26

Same issue here, gallery is running fine except for the upload portion.
Been through all the FAQs and searched the forums but none of those suggestions made any difference.

-----------
Windows NT 5.0 build 2195
PHP Version 4.2.2
netPBM v10.6 win32 - libjpeg 6b
Gallery v1.3.1
-----------

When uploading an image I get:

Processing status...
- Adding Sample.jpg
Executing:

c:netpbmbinjpegtopnm C:InetpubWWWrootgalleryalbumsalbum02Sample.jpg | c:netpbmbinpnmfile --allimages

Warning: Unable to fork [cmd.exe /c c:netpbmbinjpegtopnm C:InetpubWWWrootgalleryalbumsalbum02Sample.jpg | c:netpbmbinpnmfile --allimages] in C:InetpubWWWrootgalleryplatformfs_win32.php on line 161

Results:
none

Error messages:

Status: -1 (expected 0)
Error: Invalid image: Sample.jpg!
Need help? Look in the Gallery FAQ
============================

From the command line I type:
C:> C:netpbmbinjpegtopnm.exe c:InetpubSample.jpg | c:netpbmbinpnmfile --allimages

It returns:
C:netpbmbinjpegtopnm.exe: WRITING PPM FILE
stdin: Image 0: PPM raw, 283 by 212 maxval 255
C:>

Any help on this would be appreciated, or else a suggestion of a similar gallery program written for Windows

Thanks

 
vallimar

Joined: 2002-08-15
Posts: 487
Posted: Sat, 2002-09-07 04:51

I did a quick scan of the php site for this error and found this

Quote:
For Windows Users:

Keep in mind that a lot of UNABLE TO FORK Errors are the result of insufficient permissions.

CMD.EXE, TEMP Directory (or whatever you specified in php.ini), and all the directories that you use to upload o manipulate your files need to have Write privileges… usually user USER.

This will be useful for all the people who use GD Libraries or other programs that manipulate graphic images.

Not sure if it will help any. This is actually a php error. I also saw mention
that backslashes may need to be escaped under win2k or some such. I don't
have any experience running php or webservers under windows so this is
about the best I can do for you guys. Hopefully something with more knowledge
will pipe up soon. You can also try asking on the php mailing lists for help as it
is a php error.

 
mhaldima

Joined: 2002-09-08
Posts: 11
Posted: Sun, 2002-09-08 01:39

Well - that's actually the problem.

You NEED to give the Internet Guest User (IUSR_<yourpcname>) "read &amp; execute" permission on every file you want to execute through the PHP exec() command. As soon as you'll do it for CMD.EXE, Gallery will work fine.

PS:
This has nothing to do with Gallery but is a general (and somehow obvious, although it took me hours to figure out where these "unable to fork" messages came from...) necessity in PHP.

 
napalm

Joined: 2002-09-04
Posts: 2
Posted: Mon, 2002-09-09 09:16

mhaldima,

Thanks for the heads up but how are Does on assign those rights???

I am using XP IIS, I am unsure how I give the read &amp; execute access.

Thanks

 
MSboy
MSboy's picture

Joined: 2002-09-06
Posts: 6
Posted: Mon, 2002-09-09 17:54

Well, that's what it was alright. I might have to rethink using "gallery", not sure I want to open up my server that way...
Thanks for the help though, didn't even think of looking at the PHP site. Like I said everything else in gallery was working fine!

Again I really apperciate the help! You Rock :grin:

napalm, setting security settings is both easy, and VERY important. If you're seriously running an IIS webserver on the net without knowing the basic about NTFS security, you might want to make frequent backups. You'll need them eventually!

From Windows explorer right click on the file or folder you want to modify (in this case c:winntsystem32cmd.exe). Select properties. Click on the security tab. That gets you to where you need to be. Acctually knowing what you're doing from there is another thing. :smile: IIS creates a user account based on your computer name. So if your server is named "fooserver" then you should have a user account called IUSR_FOOSERVER. In this case I gave that user read and excute permission and that fixed it. Be careful using "deny" especially in this case.
Hope this helps you
I for one am not in favor of giving anonymous surfers access to my server's command line. :eek:

 
mhaldima

Joined: 2002-09-08
Posts: 11
Posted: Mon, 2002-09-09 20:07

Cool you guys got Gallery to work too!

I just wanted to ad a comment to MSboy's security concerns:
You're definitely right, no one likes to give permissions for cmd.exe to unprotected users like the IUSR. But still, as no one will actually SHARE the directory containing CMD.EXE, there's no direct security problem arising from this. What IS important, is that you make sure that your PHP scripts can not be tricked to execute whatever program or code - including cmd.exe - through exec(). This is not particularly difficult though: by not sending any variables (that could be manipulated) to exec() or - if this is absolutely necessary - by at least setting register_globals = off, you sould normally be safe...

Have fun!

 
dutch2005

Joined: 2005-09-26
Posts: 6
Posted: Wed, 2005-09-28 18:14

hmmm

i'm using windows 2003
IIS6.0
gave CMD.exe the read & execute permissions in Iusr_win2003
gave the whole dir of c:\IM

also for Iusr_win2003 the read & execute thingies, and now i dont get the fork error no more.. (wich is good :D)...

yet now i still get the....

"Unable to create a zip file from this binary"

i guess security settings for the file aint set correcty then>??

as you can see this is conserning the zip module...

"zip.exe" is located in "e:\cygwin\bin\zip.exe"

any way to get this working??

i'm using gallery2 btw...

ok i think i got the "problem"

all i found in my dir was..

zip.exe
unzip.exe
unzipsfx.ex

yet no zipc.exe...

could any1 send me a download link were i could download it?

thnx