[php] unzippen lukt in shell niet in php

Pagina: 1
Acties:
  • 39 views sinds 30-01-2008

  • hobbeldebobbel
  • Registratie: Februari 2001
  • Laatst online: 15-02-2023
het is echt heel raar maar ik zit op een linux mandrake server en als ik daarin in de shell hetvolgende intyp:
unzip /var/www/archipics_upload/ZIP/1_1.zip -d /var/www/archipics_upload/users/

dan pakt hij daad werkelijk 1_1.zip uit naar de users directory...
als ik daarentegen deze command aanroep vanuit system() in php:
PHP:
1
2
3
4
5
6
7
if(!empty($_GET['bestand'])){
    $filename = "/var/www/archipics_upload/ZIP/1_1.zip";
    $command = "unzip /var/www/archipics_upload/ZIP/1_1.zip -d /var/www/archipics_upload/users/";
    $exec = system($command);
    
    echo $exec;
};

dan krijg ik slechts
code:
1
Archive: /var/www/archipics_upload/ZIP/1_1.zip Archive: /var/www/archipics_upload/ZIP/1_1.zip

te zien.... zit dit toevallig in elkaar met rechten? zoja welke rechten moet ik dan aanpassen?

hier zou een slimme opmerking kunnen staan
maar die staat er niet


  • NMe
  • Registratie: Februari 2004
  • Laatst online: 15-04 22:07

NMe

Quia Ego Sic Dico.

Je had ook de moeite kunnen nemen om de documentatie van exec te lezen:
Return Values

The last line from the result of the command. If you need to execute a command and have all the data from the command passed directly back without any interference, use the passthru() function.
string exec ( string command [, array &output [, int &return_var]] )

output
If the output argument is present, then the specified array will be filled with every line of output from the command.
Volgende keer iets beter kijken dus. ;)

Mocht het zippen nog steeds niet werken, dan krijg je nu in elk geval de complete uitvoer te zien. Ik gok dat de user apache geen schrijfrechten heeft op de map waar je in werkt.

'E's fighting in there!' he stuttered, grabbing the captain's arm.
'All by himself?' said the captain.
'No, with everyone!' shouted Nobby, hopping from one foot to the other.


Dit topic is gesloten.