Reputation: 14456
I would like to real-hand experienced answer on this. Which one is faster? Writing a Shell Script or PHP script? This script be will setup in cron.
Here is the brief idea of what I am trying to accomplish.
We get a lot of PGP encrypted files from clients. We download them to our local server, decrypt them and move them to different location for further processing.
There could be around 20-25 files a day to do and the number goes up gradually.
We have written both PHP script and Shell script to do this, for testing purposes. But we are not sure which is going to faster and advantageous.
Has anyone tried? Any inputs?
Thanks much!
Upvotes: 1
Views: 1614
Reputation: 8808
As indicated in the comments, you ought to just benchmark.
The overhead associated with the script will certainly be insignificant compared to the time spent in the decryption phase. (Cryptography is a notoriously computationally expensive process, especially dual-key crypto.)
Also, 20-25 requests, even 1000 requests, is nothing on a modern machine, unless we are talking about decrypting gigantic files (in which case, again, the crypto step will swamp any optimizations in the wrapper script). Asking this question and benchmarking are probably more time consuming that any overhead you will encounter.
(As an aside, I really hope that you are doing the decryption on a back-end machine not directly facing the public. Guard your key!)
Upvotes: 3
Reputation: 863
Both use an interpreter to execute your tasks. Depending on which OS you are using, their engines could have been both written in C++.
I would use PHP. Because it has more modules you can addon.
Say do your PGP encryption then you want to update a mySQL DB, Send an email, post to facebook, send a tweet out that your task is complete.
Edit - PHP doesn't require awebserv. I'm referring to the command line execution of php and shell script. PHP Command line help - http://php.net/manual/en/features.commandline.php
Upvotes: 1