Re: unzip openDocument in safe mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jochem Maas wrote:
Bernhard Zwischenbrugger wrote:
I try to unzip openDocument files with pclzip.
At my laptop this is no big problem, but the target server has "safe
mode" switched on (no way to change that).

The problem with safe mode and unzipping openDocument ist, that a
openDocument zip file contains directories. It is not possible to write
to directory owned by webserver uid (because of safe mode)

are there no world writable directories available anywhere for you to use?

My Project:
I try to extract the "content.xml" from openDocument, change it and
store it back to the openDocument (zip) file.

Question:
Is it possible to extract a single file from a zip file?
Is it possible to replace a single file in a zip file?

it kind of depends on your particular setup (server version, access to
PECL, etc):

there is this (will require some reading to determine if you can
use it in your case):

	http://php.net/zip

and then there is the possibility of using exec() in conjunction with
the cmdline zip utility, e.g.:

	$args = escapeshellarg($theRequiredArgsToZipCmd);
	exec("zip -options $args");

Just a reference.. safe-mode disables exec so that's not going to work.

Actually no it doesn't, it requires extra config set up for the safe-mode-exec-directory, see http://www.php.net/manual/en/features.safe-mode.php#ini.safe-mode-exec-dir


You could take a look at the pear package: http://pear.php.net/package/File_Archive

or

http://pear.php.net/package/Archive_Zip (currently not being maintained, so probably go with #1).

How you use them or if they can do what you want (extracting a single item), I have no idea, I just know they exist :)

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux