Unpack my files please.
August 14, 2007 9:08 PM Subscribe
Need to find a php script.
So i have a plugin for wordpress called pluginstaller. What it does is you can input a url of a zip file and it grabs it and unpacks it.
What i want to do is make a php file is that i can put in a zip or tar.gz file and it will grab it and unpack it to wherever i say on my server. this doesn't seem to hard but i cant seem to figure it out. php4 and 5 available
So i have a plugin for wordpress called pluginstaller. What it does is you can input a url of a zip file and it grabs it and unpacks it.
What i want to do is make a php file is that i can put in a zip or tar.gz file and it will grab it and unpack it to wherever i say on my server. this doesn't seem to hard but i cant seem to figure it out. php4 and 5 available
Response by poster: i know php is well documented but i dont yet have the skill to take documents and turn them in coded awesomeness. maybe someday though
posted by DJWeezy at 9:20 PM on August 14, 2007
posted by DJWeezy at 9:20 PM on August 14, 2007
DJWeezy: Good documents mean you don't need skill to go from documentation to a working product (with tons of trial and error). That's how you learn.
posted by phrontist at 11:11 PM on August 14, 2007
posted by phrontist at 11:11 PM on August 14, 2007
You have multiple problems here.
One, your question is essentially unanswerable without simply doing the whole thing for you. I suppose that might be a possibility except:
Two, this is a combination of undoable and a very bad idea. If your server is at all well configured that script is going to run with permissions that won't allow it to write files just anywhere on the server. If it isn't well configured this is just a bad plan and invites malicious behavior.
That said, if you have existing code that will accept a URL and unpack the file then you need to write PHP code that will take a file and upload it to a URL accessible location. There's wordpress plugins to allow this and no shorage of sample code. Google for 'upload file php'.
Once that's done you need to use that plugin which is likely easiest done with the curl functions.
As far as the file associations that's done in the config files by setting a handler.
# Cause the PHP interpreter to handle files with a .php extension.
AddHandler php5-script .php
You can try putting this in your htaccess file but you may not be able to override the settings, depending on how your machine is configured. I've never tried to add extension handlers there, check the Apache documentation.
You might need to write a rewrite rule in your htaccess to turn requests for *.php into *.php5
posted by phearlez at 8:32 AM on August 15, 2007
One, your question is essentially unanswerable without simply doing the whole thing for you. I suppose that might be a possibility except:
Two, this is a combination of undoable and a very bad idea. If your server is at all well configured that script is going to run with permissions that won't allow it to write files just anywhere on the server. If it isn't well configured this is just a bad plan and invites malicious behavior.
That said, if you have existing code that will accept a URL and unpack the file then you need to write PHP code that will take a file and upload it to a URL accessible location. There's wordpress plugins to allow this and no shorage of sample code. Google for 'upload file php'.
Once that's done you need to use that plugin which is likely easiest done with the curl functions.
As far as the file associations that's done in the config files by setting a handler.
# Cause the PHP interpreter to handle files with a .php extension.
AddHandler php5-script .php
You can try putting this in your htaccess file but you may not be able to override the settings, depending on how your machine is configured. I've never tried to add extension handlers there, check the Apache documentation.
You might need to write a rewrite rule in your htaccess to turn requests for *.php into *.php5
posted by phearlez at 8:32 AM on August 15, 2007
This thread is closed to new comments.
my server make php5 file be named as such how can i change that? so it has the extension php
posted by DJWeezy at 9:10 PM on August 14, 2007