Getting PHP on the command line
I don’t know very much about PHP. In fact it is probably more accurate to say that I don’t know anything about programming in PHP and yet, earlier today, I found myself in need of being able to type in simple PHP scripts and run them on the command line. A quick google search later and I find that I need to issue the following command in Ubuntu
apt-get install php5-cli
Now I can write little scripts like this one (which I called md5.php) and run them on the command line
#!/usr/bin/php -q <?php $arg=$_SERVER["argv"][1]; echo md5($arg),"\n"; ?>
./md5.php hello
5d41402abc4b2a76b9719d911017c592
I mention it because I might forget about it and looking up on here is quicker for me than googling it.
Leave a comment
| Trackback