ImageMagick läuft, über shell ausführbar, aber...

Apache, Lighttpd, nginx, Cherokee
Anonymous
 

ImageMagick läuft, über shell ausführbar, aber...

Post by Anonymous »

Hallo,

ich habe ImageMagick installiert. Das Läuft auch soweit. Wenn ich mich als Root oder als web1 per shell einlogge, kann ich damit arbeiten

Code: Select all

convert -scale 100x100 'image.gif' 'image2.gif'
Aus image.gif wird ein image2.gif in anderer Scalierung.

Wenn ich jedoch ein PHP-Script schreibe

Code: Select all

system("convert -scale 100x100 'image.gif' 'image2.gif'", $result);
und dies in das verzeichnis kopiere, geht es nicht. Als $result bekomme ich "126". Was habe ich falsch gemacht...
jtb
Posts: 599
Joined: 2002-08-18 16:41
Location: Darmstadt
Contact:
 

Re: ImageMagick läuft, über shell ausführbar, aber...

Post by jtb »

schon mal mit absoluten Pfaden versucht?
Ansonsten nimm nicht System(), sondern passthru(), so dass du die Ausgabe siehst..
Anonymous
 

Re: ImageMagick läuft, über shell ausführbar, aber...

Post by Anonymous »

Bekomme auch bei passthru ein "126", absoluter Pfad habe ich schon probiert..
jtb
Posts: 599
Joined: 2002-08-18 16:41
Location: Darmstadt
Contact:
 

Re: ImageMagick läuft, über shell ausführbar, aber...

Post by jtb »

setze mal error_reporting auf E_ALL

und guck, ob nicht eventl. open_basedir oder Safemode in die Quere kommt - manchmal melden die sich nicht, verhindern aber trotzdem die Ausführung..
Anonymous
 

Re: ImageMagick läuft, über shell ausführbar, aber...

Post by Anonymous »

Ah, safemod ist on, habe ich aber in der php.ini ausgestellt.
jtb
Posts: 599
Joined: 2002-08-18 16:41
Location: Darmstadt
Contact:
 

Re: ImageMagick läuft, über shell ausführbar, aber...

Post by jtb »

siehe
safe_mode_exec_dir string
Wenn Sie PHP im sicheren Modus betreiben, werden die Funktion system() und andere Funktionen, die Systemprogramme ausführen, nicht gestartet, wenn Sie sich nicht in diesem Verzeichnis befinden.
dann kann der safe_mode auch an bleiben..

Einfach ein extra-Dir anlegen und dorthin Links auf alle benötigen Programme legen (aber bitte nicht bash oder so, dann kannst du es gleich vergessen)..
Anonymous
 

Re: ImageMagick läuft, über shell ausführbar, aber...

Post by Anonymous »

also, ich habe jetzt testweise safemode off, geht aber immer noch nicht...
jtb
Posts: 599
Joined: 2002-08-18 16:41
Location: Darmstadt
Contact:
 

Re: ImageMagick läuft, über shell ausführbar, aber...

Post by jtb »

open_basedir ?
Anonymous
 

Re: ImageMagick läuft, über shell ausführbar, aber...

Post by Anonymous »

steht auf

Code: Select all

/home/www/web1/
also das hauptverzeichnis des users
jtb
Posts: 599
Joined: 2002-08-18 16:41
Location: Darmstadt
Contact:
 

Re: ImageMagick läuft, über shell ausführbar, aber...

Post by jtb »

dann scheint das dran Schuld zu sein..

siehe http://www.php.net/manual/en/features.safe-mode.php
open_basedir string
Limit the files that can be opened by PHP to the specified directory-tree, including the file itself. This directive is NOT affected by whether Safe Mode is turned On or Off.

When a script tries to open a file with, for example, fopen or gzopen, the location of the file is checked. When the file is outside the specified directory-tree, PHP will refuse to open it. All symbolic links are resolved, so it's not possible to avoid this restriction with a symlink.
Anonymous
 

Re: ImageMagick läuft, über shell ausführbar, aber...

Post by Anonymous »

wie kann ich dass den ausschalten?
Anonymous
 

Re: ImageMagick läuft, über shell ausführbar, aber...

Post by Anonymous »

okay, hab´s mal für user web1 ausgeschaltet, aber keine veränderung. Ausserdem: ich arbeite mit dem Script doch unterhalb von /home/www/web1/
jtb
Posts: 599
Joined: 2002-08-18 16:41
Location: Darmstadt
Contact:
 

Re: ImageMagick läuft, über shell ausführbar, aber...

Post by jtb »

aber convert selbst liegt nicht dort..
ansonsten wäre ja open_basedir ineffektiv..
Anonymous
 

Re: ImageMagick läuft, über shell ausführbar, aber...

Post by Anonymous »

hm, wie löse ich denn das Problem?
jtb
Posts: 599
Joined: 2002-08-18 16:41
Location: Darmstadt
Contact:
 

Re: ImageMagick läuft, über shell ausführbar, aber...

Post by jtb »

vielleicht hilft dir folgendes weiter:
http://www.rootforum.de/forum/viewtopic ... 9185#69185
Anonymous
 

Re: ImageMagick läuft, über shell ausführbar, aber...

Post by Anonymous »

finde da nichts zu meinem Problem open_base_dir
jtb
Posts: 599
Joined: 2002-08-18 16:41
Location: Darmstadt
Contact:
 

Re: ImageMagick läuft, über shell ausführbar, aber...

Post by jtb »

ich habe ja nur überlegt, dass die PEAR-Klasse nützlich wäre..
Anonymous
 

Re: ImageMagick läuft, über shell ausführbar, aber...

Post by Anonymous »

kann ich das nicht einfach ausschalten?
jtb
Posts: 599
Joined: 2002-08-18 16:41
Location: Darmstadt
Contact:
 

Re: ImageMagick läuft, über shell ausführbar, aber...

Post by jtb »

doch, aber damit würdest du wieder ein bißchen Sicherheit vergeben..

Ansonsten guck in deine PHP.ini oder in die Config deines VHosts..
Anonymous
 

Re: ImageMagick läuft, über shell ausführbar, aber...

Post by Anonymous »

habs jetzt auf / gestellt, aber problem ist nach wie vor vorhanden
jtb
Posts: 599
Joined: 2002-08-18 16:41
Location: Darmstadt
Contact:
 

Re: ImageMagick läuft, über shell ausführbar, aber...

Post by jtb »

seit PHP v4.3.1 muss du es auf open_basedir none setzen..
/ funktioniert nicht mehr..
Anonymous
 

Re: ImageMagick läuft, über shell ausführbar, aber...

Post by Anonymous »

ist aber 4.2.2
Anonymous
 

Re: ImageMagick läuft, über shell ausführbar, aber...

Post by Anonymous »

habe
Apache/1.3.26 (Linux/SuSE 8) mod_ssl/2.8.10 OpenSSL/0.9.6g PHP/4.2.2

vielelicht ist es einfacher, ein update auf PHP 4.3 zu fahren. gibts da eine einfache installation?
mark
Posts: 295
Joined: 2003-04-15 16:48
Location: Oldenburg
Contact:
 

Re: ImageMagick läuft, über shell ausführbar, aber...

Post by mark »

Hi,

kopiere die binaries, die du von ImageMagick brauchst einfach in das safe_exec_dir ...

Das habe ich auf meinem Server auch gemacht und das funktioniert.

Code: Select all

/usr/local/httpd/htdocs/kunden/empty # dir
total 124
dr--r--r-x    2 root     root         4096 Feb 25 16:17 .
drwxr-xr-x   17 root     root         4096 Mar 26 12:56 ..
-rwxr-xr-x    1 root     root        20252 Feb 25 16:17 animate
-rwxr-xr-x    1 root     root        34159 Feb 25 14:18 convert
-rwxr-xr-x    1 root     root        30928 Feb 25 14:00 mogrify
-rwxr-xr-x    1 root     root        24644 Feb 25 16:17 montage
Und achte auf die Verzeichnisrechte ... In meinem Fall 445, damit der Webserver darin lesen kann.

Gruß
Mark
lineman
Posts: 59
Joined: 2002-06-06 17:31
Location: Mülheim an der Ruhr
 

hmm

Post by lineman »

guckst du hier, falls du suse 8.1 hast... vielleicht hilft dir das ja...

http://www.o4w.de/typo3faq/index.php?si ... =001&id=27
Post Reply