DukeS Posted November 15, 2006 Posted November 15, 2006 Is it possible to use SmartPill PHP to zip and unzip files? Does anyone have example? Thanks in advance
Newbies colinf Posted November 15, 2006 Newbies Posted November 15, 2006 Yes, it is possible to do this. Instructions for Windows are as follows: You will need to install the PECL zip dll. You can get it at: http://pecl4win.php.net/ext.php/php_zip.dll I chose the php-5.1.2 version as that is closest to the PHP version used in SmartPill. Copy the DLL file you download into your FileMaker folder (where the .exe is). Then update the php.ini file that you installed into ExtensionsPHP Support when instaling SmartPill. You need to remove the ";" from the start of the line: ;extension=php_zip.dll Now restart FileMaker and you can use the ZipArchive class. There are examples at: http://uk.php.net/manual/en/ref.zip.php and Example 1 worked fine for me without change to create a zip file. I am at work at the minute and so these instructions are for Windows but if you need Mac OS X specific instructions let me know and I will do it later from home. Cheers, Colin
DukeS Posted November 15, 2006 Author Posted November 15, 2006 Many thanks Colin! It works great on Windows and now I need it for MacOsX too. I have searched the web, downloaded lot of stuff, compiled, installed but I can't figure out how this should work for MacOsX. 1) Do I have to compile php from source to get new php.ini? (I did but it didn't worked) 2) Where is the extension for zip? There is one in php-5.2.0/ext directory after compiling but I don't know where to put it. If it isn't too complicated can you help me out?
Newbies colinf Posted November 16, 2006 Newbies Posted November 16, 2006 I gave it a go but I'm afraid I can't get it to work either on Mac OS X. I compiled the zip.so extension and added it to the php.ini file but when I try to use it then FileMaker crashes which is not good! Maybe if someone from Scodigo reads these posts they can say whether loading extensions is supported on Mac OS X yet and whether there is some specific approach needed to get it to work. Alternatively, you could consider using the PHP exec() command to run the command line zip command. Cheers, Colin
DukeS Posted November 17, 2006 Author Posted November 17, 2006 It has crashed also when I tried to use it...
Micah Woods Posted November 20, 2006 Posted November 20, 2006 SmartPill does support the Zlib functions so you can read and write gzip (.gz) files. For example: // Compression example, check your desktop for a file named test.gz // Note: You must change $folder var to be the path to your desktop $folder = "/Users/micah.woods/Desktop/"; $string = 'Help me, I've shrunk!'; $gz = gzopen($folder . 'test.gz','w9'); gzwrite($gz, $string); gzclose($gz); Our latest beta release will be posted soon and it includes PHP 5.2 which now includes a ZIP extension. I'll do some investigating to see if we can get this compiled in. In regards to loading extensions, I have had success doing this but haven't done extensive testing. We have now compiled in the MySQL extension but prior to that I was able to load this extension (both using the dl() function and by altering the php.ini file). Does your crash occur when FileMaker starts up? Can you call other PHP functions and not have it crash or does it simply crash as soon as any PHP function is called? Feel free to contact me if I help: [email protected]
DukeS Posted November 20, 2006 Author Posted November 20, 2006 In my case FM crashed when I called zip function ( I was using examples from php.net ). If I can help with testing just let me know... Thanks
Micah Woods Posted December 5, 2006 Posted December 5, 2006 We've managed to compile the zip functions into our latest build of SmartPill. Email me at [email protected] if you'd like copy.
Recommended Posts
This topic is 6833 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now