seventheyejosh Posted September 14, 2009 Share Posted September 14, 2009 I remember hearing about this a while back, and was wondering if there was any practical use for it? I stumbled across it today when reading about Unix stuff. You can do cool tricks like : echo `ls -l`; but, is there anything practical anyone uses it for? At least on a production basis? Quote Link to comment https://forums.phpfreaks.com/topic/174257-unix-commands-in-php/ Share on other sites More sharing options...
Daniel0 Posted September 14, 2009 Share Posted September 14, 2009 That question makes as much sense as "is there any practical use for a while loop?" It just depends on your imagination. By the way, it's not "Unix commands", but any command on the host operating system. As an example, the filesize() function is broken for files that are larger than 2 GiB (because all integers in PHP are signed 32-bit integers*). You can use some hacks to get accurate results for > 2 GiB sizes using commands on the underlying operating system. That's just one example. As I said, it's really up to your own imagination. * In an n-bit integer you can address 2n different integers. If the unit is bytes and you are using 32 bits you can address 232 B = 4,294,967,296 B = 4 GiB. However, because we in this case have a signed integer, half of the addressable numbers are negative, so that leave us with 2 GiB. Quote Link to comment https://forums.phpfreaks.com/topic/174257-unix-commands-in-php/#findComment-918593 Share on other sites More sharing options...
zq29 Posted September 15, 2009 Share Posted September 15, 2009 but, is there anything practical anyone uses it for? At least on a production basis? I can't remember the last time I used a *nix specific command in a PHP script, but I use the exec() function for interacting with ImageMagick fairly regularly. Quote Link to comment https://forums.phpfreaks.com/topic/174257-unix-commands-in-php/#findComment-918768 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.