...more recent posts
PHP is getting SSH. That is an ability I have wanted for some time. This would finally let me write the file uploading scripts I want (at least for people running unix which is a lot of us here.) Using form field uploading from the client browser is fine for getting images onto the server. But for bigger things like music and video I've been having people use FTP. Those few extra steps are kind of a drag though. FTP is easy enough, but it's so inelegant. Way too close to the metal for what an end user should have to deal with.
Unfortunately getting this running is a bit over my head at the moment. Hopefully I will be able to find some documentation I can understand. Or maybe this is something that could just show up as a built in function in the next release of PHP? That would be the best for me.
Computers are strange in that you can do really powerful things with them, but you have to know exactly what to say in order to get the desired result. Or maybe that's not so strange.
Anyway, like most servers, mine has PHP installed as an apache module. That means I can't invoke PHP, or a PHP script, from the command line (to the best of my knowledge.)
But like most problems, it's just a matter of finding the right way to ask:
lynx -dump http://www.digitalmediatree.com/somephpscript.php
does exactly what I want, although through a mechanism I would have never thought to use. Lynx is a text based web browser that can be used from the command line. The -dump argument just suppresses all output from lynx. And the URL given is the page for lynx to open. Of course that page is a PHP scirpt, so the result is that somephpscript.php gets run from the command line. Genius.
This means I can now invoke PHP scripts using procmail. Very nice. Before this I was calling Perl scripts that would then use HTTP::Request::Common and LWP::UserAgent to make a request to the PHP script.
That was a lot of work that is now unnecessary since I discovered the little lynx trick.