4 ms·
Why?
by carlmr 9y ago
Why?
- deckarep 9y agoMy thought exactly, but it's always nice to see people push the status quo on what an "acceptable" use of a language should be.
- slipstream- 9y agoI've written small command line scripts in PHP before (without any helper libraries). Using PHP for such things is nice when interfacing with web services (JSON parsing, SimpleXML, etc). Perhaps Peachpie, when it reaches production quality, will also help with that, as then calling .NET (and maybe, through that, WinRT) APIs from PHP code will be made easier.
- deleted 9y ago[deleted]
- grouchoboy 9y agoFor the same reason a lot of people says that the use node as backend. Because they must use javascript in the frontend they use it in the backend. If one is using php as a language for a project and that project has related commands and with php your are capable of doing, why not?
- b101010 9y agophp-cli scripts normally don't have an execution time limit (or a memory limit?), which makes them ideal for upgrades/database maintenance/cron jobs/etc while being able to reuse code from the application itself one example: https://docs.moodle.org/22/en/Administration_via_command_line https://docs.moodle.org/22/en/Administration_via_command_lin...
- korzun 9y ago> php-cli scripts normally don't have an execution time limit (or a memory limit?), which makes them ideal for upgrades/database maintenance/cron jobs/etc while being able to reuse code from the application itself ? PHP enforces memory limits out of the box by default. What languages have execution limits on CLI?
- octalmage 9y agoThey're probably referring to web hosts. Many hosts have timeouts for the web, but not the cli. So for long running tasks you write cli scripts. In the WordPress world this is easily done using WPCli and eval-file.
- veeti 9y agoWhy stop there? Forget Electron, build your next desktop application using PHP-GTK! http://gtk.php.net/index.php http://gtk.php.net/index.php
- jsjohnst 9y agoI've written a handful of apps using PHP-gtk (all written more than ten years ago). I'm sure it's improved since then, but I'd still say it's not worth the effort.
- qualitytime 9y ago[COW ICON]
- korzun 9y agoWhat value are you adding here? There are plenty of companies that rely on PHP that also have to work with CLI. I believe they are better informed when it comes to making decisions between handling CLI via an entirely different language and sticking to PHP.