10 ms·
Hear me out, everyone here is talking about web developers and people who write the language. That’s the least import demographic and most unaffected segment of
by donatj 5y ago
Hear me out, everyone here is talking about web developers and people who write the language. That’s the least import demographic and most unaffected segment of the user base.
Dropping PHP is irritating because PHP is actually a really good shell scripting language and it’s universal availability on macOS made distributing simple CLI tools for Mac written in PHP as a simple script or a bundled PHAR easy as pie.
I have a decent number of macOS specific tools I distribute as PHP, many 10+ years old, and I can guarantee almost none of my users have any idea what PHP is let alone how to install it.
- ashtonkem 5y agoCounter argument: removing languages from OSX is good, because built in languages are the source of a lot of friction in development. The installed version necessarily lags behind what most developers want, and having a tool chain completely separate from whatever manager you’ve installed really sucks. For end users, the interpreter can be bundled with the application, that is much more stable for everyone.
- rovr138 5y agoPython developers I know get their interpreter installed. This is vs people in college I know that are dabbling in Python or people starting with it on a professional setting. I currently have over 5 different python versions installed to be able to test against them. The different software I work gets deployed to different environments and I have all those versions installed locally to test. For end users, it doesn't matter as long as it works. The less moving pieces, the better. A bundled interpreter in the OS gives a stable platform to develop against. The interpreter can be bundled with the application, of course. But now you have n different interpreters with their own php.ini files and their own set of things to change. Upgrading the application means overwriting those files and causing more pain when they have to figure out why something stopped working.
- SavantIdiot 5y ago> I currently have over 5 different python versions installed to be able to test against them That's absurd. Five versions of the same language. Each with their own package folders. That's at least 15 GB. This is a luxury and consequence of infinite compute resources.
- dagmx 5y agoIt's a reality of pragmatism when different projects target different versions of the interpreter and there's no guarantee that different versions are not breaking some behaviour.
- shadowgovt 5y ago... and if you're talking MacOS laptop and desktop ecosystem, it's a luxury you have and should take advantage of.
- rovr138 5y ago> That's absurd. How come? It's pretty practical. I'm a developer. I deploy to multiple targets so I have them all. I test against them. Simple enough. To talk to the point of the link here, what I distribute to MacOS I only have to worry about 1 interpreter because it's the one embedded on the OS (and at work, I can guarantee the version). The problem for me is Linux and whatever is bundled on the version of the distro that's currently running. > This is a luxury and consequence of infinite compute resources. It's a consequence of what I deploy to. If I only had 1 target and could guarantee it, I'd only need one.
- SavantIdiot 5y agoNewer programmers have accepted this as "normal". It only started becoming this much ridiculous cumulative upkeep in the past decade or so. It's lazy. Lazy on behalf of the Python maintainers. And you keep accepting it instead of pushing back. You could have only one version, but you've been brainwashed to think having 5 versions of python on your machine is normal. I'm not dissing version releases, just the adoption and deprecation. I wrote DirectX drivers for years, and going from DX3 to 5 to 7 meant backwards compatibility, and it was a PITA, but releases came out every two years and were deprecated shortly after so we didn't have vast quantities of exponential regressions. OpenGL was rock solid by comparison. The former was trial-and-error by MSoft, the latter was well thought out by consortium.
- Wowfunhappy 5y ago> A bundled interpreter in the OS gives a stable platform to develop. But it wouldn't be stable. Or it would be, but it would be hopelessly out of date. Apple can either keep the bundled interpreters on the same version forever, or they can update it with the OS. Do the former, and it becomes hopelessly out of date. Do the latter, and software updates randomly break stuff. Either the language developers need to actually keep their languages stable, or everyone else just needs to get used to keeping multiple versions around.
- rovr138 5y ago>Or it would be, but it would be hopelessly out of date I think you need to define "out of date". Out of date for me means not receiving security updates and stale. I think you mean not the latest version and stable for me is better in a production environment. Google example, look at Debian stable.
- Wowfunhappy 5y ago> I think you need to define "out of date". Well, look at this way—the latest consumer version of macOS still comes with Python 2.
- rovr138 5y agoSo... $ /usr/bin/python WARNING: Python 2.7 is not recommended. This version is included in macOS for compatibility with legacy software. Future versions of macOS will not include Python 2.7. Instead, it is recommended that you transition to using 'python3' from within Terminal. Python 2.7.16 (default, Dec 21 2020, 23:00:36) [GCC Apple LLVM 12.0.0 (clang-1200.0.30.4) [+internal-os, ptrauth-isa=sign+stri on darwin Type "help", "copyright", "credits" or "license" for more information. >>> exit() but wait, also, $ /usr/bin/python3 Python 3.8.2 (default, Apr 8 2021, 23:19:18) [Clang 12.0.5 (clang-1205.0.22.9)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> exit() I think we should take the lines, > This version is included in macOS for compatibility with legacy software. > Future versions of macOS will not include Python 2.7. > Instead, it is recommended that you transition to using 'python3' from within Terminal. For exactly what it says. It's included for compatibility with legacy software and should be transitioned from it to another version... the other version that's bundled with it.
- bborud 5y ago> For end users, it doesn't matter as long as it works.The less moving pieces, the better. A bundled interpreter in the OS gives a stable platform to develop against. I can understand what you wish for. But what you wish for is very far from what we’ve had so far. Time to accept reality.
- vbezhenar 5y agoFor end users the OS can be bundled with the application, that is much more stable for everyone.
- sidlls 5y agoSarcasm doesn't make a poor point better.
- 0x4a42 5y agoIs it really sarcasm? I have often seen workstations pre-installed with an OS and some specific software sold as « bundle ». ie in medical domain, cnc, video…
- suprfsat 5y agoElectron is wildly successful, it's not a poor point at all.
- sidlls 5y agoIn the HN bubble, sure.
- suprfsat 5y agoI bet I can find several users of Slack or Visual Studio Code who haven't even heard of HN.
- rovr138 5y agoDon't forget Spotify, WhatsApp desktop client, Skype, discord,
- rovr138 5y agoI think that's one place where it's divided and contended. People here are pretty vocal and critical of electron.
- racl101 5y agoYeah, I've used PHP for a decade and have always never used what comes with MacOS. Always installed a newer version.
- rovr138 5y ago/usr/bin/php --version WARNING: PHP is not recommended PHP is included in macOS for compatibility with legacy software. Future versions of macOS will not include PHP. PHP 7.3.24-(to be removed in future macOS) (cli) (built: Dec 21 2020 21:33:25) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.24, Copyright (c) 1998-2018 Zend Technologies so, 7.4 or 8? I'm still using 7.x due to limitations.
- racl101 5y ago7.3. Played with version 8 on a Docker instance. Will wait.
- ubermonkey 5y agoThat's 100% my take on this. If Apple leaves it in the build, then Apple ends up having to support it to some degree. As long as it's trivial to install after purchase, the removal of this sort of thing is in no way concerning to me. When I've written things natively on my Mac, I've almost ALWAYS had to go get an updated version of perl / python / ruby / whatever to get current.
- smoldesu 5y agoEspecially considering that open-source projects provide this service for free. It blows my mind that Apple, The World's Most Valuable And Affluent Company, refuses to invest in a couple package maintainers for their "world class" operating system. If Apple ships it, they have an obligation to keep it up to date, especially since utilities like this pose serious security risks when left untouched.
- mkr-hn 5y agoWindows solves this for python by offering to install it from the app store the first time you use the command, and then keeps it updated.
- smoldesu 5y agoBetter solution: Apple stops treating MacOS like a toy and gives it a proper package manager. I'm tired of hearing people float workarounds for a problem that can be solved by just holding Apple accountable for once.
- znpy 5y ago> problem that can be solved by just holding Apple accountable for once good luck with that
- sigjuice 5y agoApple will do a package manager, once they work out how to bolt on an "app store" on it.
- vorpalhex 5y ago'brew' works really well, no need for them to reinvent the wheel.
- gizdan 5y agoReally well is an overstatement. You shouldn't have to wait several hours to do a brew upgrade.
- 5y ago
- alerighi 5y agoOr... Apple upgrades the scripting languages regularly? I mean, they make updates that that gigabytes without changing anything, and then it's a problem to update PHP that is a couple of Mb? I don't think so...
- gizdan 5y agoSure, so what about those who are one or more versions behind?
- vendiddy 5y agoI also remember having a lot of installation headaches when starting out as a developer because the preinstalled version conflicted with the version I was trying to install. This seems like a net positive change to me and I hope they can keep dropping these built in languages.
- rovr138 5y agoWas this an issue with things preinstalled and trying to install your own or with trying to use your own after installing your own? Wondering if it was really an issue with 2 interpreters or more of an issue with how the system works. More specifically PATH variables, shebangs and prioritizing your custom one over the system one.
- deleted 5y ago[deleted]
- smm11 5y agoApple sells a couple hundred thousand computers that simply have to run a browser and show Facebook, for every one that has to have current PHP installed. If you're developing anything and don't know how to configure your tools, I'm not sure what to say.
- donatj 5y agoDo you understand the setup and configuration of every language of every tool you use? That seems impractical. I use scripts written in Ruby reasonably often without _any_ understanding of how the Ruby ecosystem works. I just want to run the tool, and the tool happens to be written in Ruby.
- ironmagma 5y agoPHP consists of an environment that can change the behavior of the program catastrophically just based on one configuration value (e.g. magic quotes). No one should be writing shell scripts using this language, especially if running on an uncontrolled machine.
- jw1224 5y agoMagic quotes were removed from PHP entirely back in v5.4… and we’re now on v8. It’s just as valid a language for shell scripts as any other.
- ironmagma 5y agoAs indicated by “e.g.”, that was given as an example. There are countless other parameters that change the behavior of the language. If you’re deploying code that has to run on someone else’s computer without supervision, it shouldn’t be a shell script at all, this is why we have compiled languages.
- donatj 5y ago> There are countless other parameters that change the behavior of the language. I call bologna. If you stick to built-in methods and avoid extensions, really the most breaking thing someone is going to do is turn off `allow_url_fopen` off, and you can either work around that or just complain to the user that you need it and `exit(1)`. > If you’re deploying code that has to run on someone else’s computer without supervision, it shouldn’t be a shell script at all, this is why we have compiled languages. This is the most frustrating comment in this thread, imho. The _ideal_ is all code being distributed as readable source. Binaries are at best a sad compromise in the name of performance. Why would you _desire_ the code you run to be an impenitible black box? I'd far rather run a script I can see what I'm actually doing to my machine instead of a binary.
- ironmagma 5y ago> the most breaking thing someone is going to do is turn `allow_url_fopen` off See [1]. "If PHP was compiled with --disable-url-fopen-wrapper, it won’t work." ... "But it will be printed if scream.enabled is set in php.ini." ... "exactly where it goes depends on display_errors, again in php.ini." There's so much variability in what an arbitrary PHP interpreter might or might not have support for, especially from 10 years ago. > I'd far rather run a script I can see what I'm actually doing to my machine instead of a binary. Then why not ship the source, along with an interpreter binary to run it in isolation? This is one of Lua's main use cases. > Binaries are at best a sad compromise in the name of performance. I disagree with this at a fundamental level because of the fact that binaries are what can be used by a computer. Anything that runs, is ultimately a binary, even if parts of that binary are generated dynamically. By adding a dependency of the environment (system PHP), it adds a layer of magic and unknowns. [1] https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/ https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/
- cutler 5y agoPHP as a scripting language has to be the least relevant reason for retaining it. How is PHP remotely comparable to Python, Perl or Ruby for scripting. Not saying you can't do it but there are better options.
- aasasd 5y ago> How is PHP remotely comparable to Python Faster. > Perl More readable and writeable, and probably more popular in the past fifteen years. > Ruby Again faster.
- gizdan 5y agoI never thought those reasons would ever be valid until PHP 7.
- aasasd 5y agoPHP long had decent performance, since version 4 iirc when it borrowed the bytecode approach from Perl and afterwards afaik was pretty much on par with it. Remember that even with FastCGI the vastly prevailing model of execution for PHP is to start the script just from the bytecode cache every time and destroy everything when it ends. Long-living async apps like with ReactPHP never became any kind of popular, and still PHP is likely the most popular serverside environment on the web (if only because of Wordpress). Perl and PHP are both likely way better for personal productivity scripting than Python or Ruby, in terms of not waiting for them to get going already. Personally I would like it very much if Lua became as popular, though the absence of proper `null` is bothersome for data exchange.
- cutler 5y agoIf you're going to compare Perl with Ruby make it Perl + Moose then redo your benchmarks. Otherwise it's an apples to oranges comparison as Ruby has built-in OOP. Ruby was built on top of the best bits of Perl and with its blocks and metaprogramming it is arguably the most advanced scripting language. Python fails to match Perl and Ruby due to its half-assed lambdas.
- xyst 5y agoConvert to go, distribute binaries instead :)
- red_hare 5y agoI totally believe you that PHP is a great general purpose scripting language to deploy mac CLI tools with, but this definitely feels like a https://xkcd.com/1172/ https://xkcd.com/1172/ moment.
- phplovesong 5y agoThere is zero arguments for having PHP bundled as default with the OS. It always ends up being an old PHP version, crippled with bugs, and now apple has one more thing to worry about in the update release cycle. If someone really wants to still keep on using PHP its just a brew install away.
- srigi 5y agoSuggesting "just" brew install php as in original post is silly to me. You have to install homebrew first, which is a non-trivial task requiring root access.
- phplovesong 5y agoIt should be trivial to anyone needing it, and by extension anyone needing tools you usually install with homebrew. Unless this is the case you should not need PHP in the first place.
- IshKebab 5y agoPHP is a pretty insane language though. I've started using Deno / Typescript for my scripting purposes and it is just a way way better experience than anything else I've used (and I have been searching for ages). Pretty much every other option falls down in some way: * Dart, Rust, Node etc. don't let you use just a single file like Python does. * Python is very slow and it's type annotation system is better than nothing but is still the worst I have used. * Everything except maybe Go requires you to list dependencies in a separate file, which rules out single-file scripts. Deno is easily worth the installation effort, especially since it's so easy to install. You'd be really mad to stick with PHP.
- darthrupert 5y agoOh come on. PHP is not a good scripting language. I get it, it sucks that PHP has been getting badmouthed every time it's mentioned but let's not overcorrect.