26 ms·
PHP has been removed in macOS Monterey
- qalmakka 5y agoI don't even understand why they included PHP in macOS to begin with. Perl? Python? I can understand, they are used by millions of projects and tools. But PHP? I've never seen a single CLI tool written in PHP, except the Phoronix Test Suite.
- TazeTSchnitzel 5y agoWell, don't forget macOS also used to include Apache.
- my123 5y agoIt still does. % httpd -v Server version: Apache/2.4.46 (Unix) Server built: May 22 2021 02:05:58 on macOS 12 beta.
- mekster 5y agoOn MacOS (when it was still capitalized), "I can program for the web from day 1 on Mac, cool!" probably made sense 20 years ago. I mean, it was far better than on Windows where you need to install some bundled package from a third party to just get hello-world running.
- mtnGoat 5y agoi use PHP CLI tools all the time, they exist. composer as an example.
- TazeTSchnitzel 5y agoTragically this means the photo of my elePHPant plush will no longer be installed on all new Macs, nor be prevented from being uninstalled by System Integrity Protection. (I'm not joking. PHP contains some very small PNG logos displayed in phpinfo(), one of which is an Easter egg that only appears on certain dates.) EDIT: Ah, the Easter egg logo was changed with PHP 8. Well, some other elePHPant gets to be sad instead. :p
- WalterGR 5y agoXcode 11 Release Notes (https://developer.apple.com/documentation/xcode-release-notes/xcode-11-release-notes https://developer.apple.com/documentation/xcode-release-note...) "Scripting language runtimes such as Python, Ruby, and Perl are included in macOS for compatibility with legacy software. In future versions of macOS, scripting language runtimes won’t be available by default, and may require you to install an additional package. If your software depends on scripting languages, it’s recommended that you bundle the runtime within the app. (49764202)" Found via https://mjtsai.com/blog/2019/06/04/scripting-languages-to-be-removed/ https://mjtsai.com/blog/2019/06/04/scripting-languages-to-be...
- darrenf 5y agoRegarding Perl, rather than removing it Apple actually upgraded it – from 5.28 to 5.30 – in Big Sur 11.3. I wasn't the only one briefly surprised and bitten by it: • https://github.com/Homebrew/brew/issues/10127#issuecomment-828121139 https://github.com/Homebrew/brew/issues/10127#issuecomment-8... • https://github.com/Homebrew/brew/issues/11275 https://github.com/Homebrew/brew/issues/11275
- kqr 5y agoI doubt they'll be able to get rid of Perl any time soon. However, how come things break when Perl is upgraded? From what I've heard, Perl should be extremely backwards compatible. What am I missing?
- darrenf 5y agoFor me, I had been too lazy to use Homebrew or Perlbrew since I don't develop locally per se, but I wanted `Perl::LanguageServer` for use with VS Code – which I'd installed via `local::lib` into `~/perl5/`. Post-upgrade either various modules weren't found (because they were installed in a versioned path), or they didn't compile because the XS components had been compiled against the prior version of Perl.
- mst 5y ago
- tacker2000 5y agoShould be fine since the MacOS preloaded versions are not what you want anyway, most of the time. In PHP you really need to know what version you are working with, otherwise weird stuff happens.
- jonwinstanley 5y agoTotally agree, almost everyone using PHP for their work will have installed their own or be using docker or homebrew
- andix 5y agoPHP was included with macOS? Wasn't that a huge security risk? Normally you try to keep a system as small as possible, especially regarding scripting languages, so an attacker has as little tools as possible available.
- detaro 5y agoI doubt any attacker is going to think "oh no, no PHP here, going to have to use Python!". If your security relies on not having an interpreter installed, something is badly wrong.
- astrange 5y agoScript execution is blocked by default unless you turn off Gatekeeper.
- gregoriol 5y agoIt was often a not up-to-date version and not updatable without a macOS update, but it wasn't used much, or even at all: I don't know any system script that would use it, and any web developer would use another setup anyway. So since it's not used (in a webserver for example), it's not as much more a risk than shell scripts I guess.
- slver 5y agoSecurity risk no. But it's a maintenance mess to have bunch of runtimes sitting around for no great reason.
- cooper45 5y agoThanks for sharing.I found a lot of interesting information here. A really good post, very thankful and hopeful that you will write many more posts like this one. https://www.tellthebell.app/ https://www.tellthebell.app/
- eric4smith 5y agoYes back in the day whenever I used php it never had all the modules I wanted. Not a big miss. Brew install php
- user3939382 5y agoI guess this is a more niche version of tabs vs spaces, vi vs emacs, etc, but I’m surprised that HN (maybe the dev community in general?) mentions and seems to favor homebrew so much over Macports. I’ve always used the latter, seldom had any problem with it, and found the community great when I did. I prefer it because it installs everything related to it in its own directory totally separate from the default OS, in one place. I find that more organized. There’s been times where there was no homebrew equivalent for a macports package. Also I remember hearing (if I’m not mistaken) that macports was used more internally at Apple(?) In any case I’m surprised it’s not more 50/50. It seems more like 95% of macos package manager mentions are homebrew.
- saagarjha 5y agoMacPorts got a lot of contributions from Apple people over the years, but I would be surprised if it was more popular even inside Apple these days.
- lucideer 5y ago> I’m surprised that HN (maybe the dev community in general?) mentions and seems to favor homebrew so much over Macports. I'm surprised that you're surprised. I use Macports but almost everything I encounter gives Homebrew install instructions up front (Macports is rarely mentioned, even if there is a port available). Additionally, I find that while the docs for advanced Homebrew use are poor, they do at least have the basic everyday usage well-documented up-front. Macports approach of providing long, detailed & comprehensive contributor-oriented API docs and almost nothing simple & accessible for daily users makes it really intimidating for new users trialling it.
- lenkite 5y agoWon't homebrew be need to be re-written in a compiled language now and embed a ruby interpreter after Apple removes scripting languages (except Perl) ?
- j16sdiz 5y agoThis is the prompt I got running php in macOS11: $ 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) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.24, Copyright (c) 1998-2018 Zend Technologies
- dstick 5y agoPHP is not recommended... wait, what? I can somehow understand the lowercase version / command, as in - we're phasing it out. Get it somewhere else. But giving the thumbs down to one of the most popular web dev languages out there is - I'm at a loss for words really.
- detaro 5y agoIt's just a generic "this is deprecated and will be removed, don't rely on it" message, not a comment on the language...
- mdp2020 5y agoBut it is in such case a strong confirmation about how people are losing conscience of language (not a good thing to sacrifice, in terms of priority - it is very related to thought pollution), and awareness in general, and awareness, attention and quality as values. A progress towards "shallow as a new normal".
- dstick 5y agoI reference that in my post: lowercase “php” would refer to the command. Uppercase “PHP” to the language.
- habibur 5y agoLooks like the same is said for Python, Ruby, Perl and all other scripting languages on MacOS too. Apparently Apple prefers compiled binary for everything. Am not complaining. The included Apache/MySQL servers were too old and I had to install those anew. But that always collided with the stock installed one. It's good that Apple getting rid of those. Install what you need afresh.
- swiley 5y agoI wonder if they'll remove wish. I always thought it was really cool that you could just sit down at any mac and hack out a quick app prototype in vim/wish without installing anything.
- euph0ria 5y agoI love PHP but this makes good sense. Better to install it afterwards and get the package/version you want. Reduce footprint of OS.
- kijin 5y agoYep, macOS is not an all-batteries-included Linux distribution. It doesn't need to ship with any programming language runtime that isn't strictly necessary for the OS itself to work. Windows doesn't come with PHP, Python, or Ruby preinstalled, either.
- cm2187 5y agoIn fact windows made a big effort to remove all the unnecessary components (IIS, etc) to reduce the average attack surface, and offer them as additional features instead.
- glenneroo 5y agoThankfully Candy Crush made the cut! /s
- deleted 5y ago[deleted]
- piaste 5y agoYep. And for that matter, why does a Linux distribution need them, either? In the age of CD-ROMs shipped with magazines, sure including a 'blessed' version of most programming languages made sense. Saved the average Linux geek from needing to hunt down a separate (physical!) package for PHP or whatever. Now, the same reasoning applies to Linux as to MacOS. Unless the OS itself relies on them (Perl?), including some random version of various PLs makes as much sense as including a bunch of shareware games.
- kijin 5y agoMost Linux distros don't come preinstalled with PHP, Ruby, or node, either. You have to install it using the package manager, and you can use the exact same package manager to pull down different versions from different repos. Honestly I wouldn't mind if some distros ditched the "blessed" version altogether for non-system languages. I can't remember the last time I used the default PHP in CentOS, it's always grossly outdated. But distros like Debian have a policy of packaging any open-source program they can get their hands on and keeping them up to date, at least when it comes to security fixes. It's their choice if they want to provide that service to their users, and many users like it.
- agys 5y agoI used it as a quick html server as an alternative to the Python “simple” ones, which always had some issues for me. Useful when coding small demos: php -S localhost:8000
- iriche 5y agopython -m SimpleHTTPServer 8080
- nindalf 5y agoThat’s Python 2. In Python 3 it’s python -m http.server 8000
- speedgoose 5y agoOn MacOS, it seems that python 2 is still the default so the right command is : python3 -m http.server 8000
- astrange 5y agoIt's strange that this comment chain is trying to teach agys about how to use SimpleHTTPServer when their comment says they tried it and it didn't work for them.
- agys 5y agoThanks :) Both Python (v2 and v3) servers work more or less but they have an issue: the first page load takes about 30 seconds on my machine, usually. I never figured out why exactly and that’s why I started using the PHP server.
- deleted 5y ago[deleted]
- lukifer 5y agoBig list of http static server one-liners: https://gist.github.com/willurd/5720255 https://gist.github.com/willurd/5720255
- dlsa 5y agoWow! Today I discovered PHP was lurking in MacOS the whole time. What was it used for? CUPS? something else?
- zerof1l 5y agoThat's not a big deal. I imagine that the average OS user doesn't need Apache and PHP. People who do web development use Docker, because for any serious development you'd want your environment to match live one. And there's still an option to use brew or MacPorts to easily install all those programs.
- diveanon 5y ago"People who do web development use Docker" A patently false generalization. There are many reasons to avoid using Docker, besides the fact that it is a dumpster fire managed by a failing company. The new M1 macbooks couldn't even run Docker, which was enough to get the last holdouts of my dev team to switch to just properly managing their local environments. Docker can be useful, but more often than not it is a crutch used to make up for the fact that many web developers don't really know how to properly manage their machines.
- deleted 5y ago[deleted]
- coder543 5y ago> The new M1 macbooks couldn't even run Docker Docker has worked on M1 Macs since... mid-December of last year. Less than a month after they were released? Why was anyone on your "dev team" using M1 Macs within weeks of launch? At that point, even installing things with Homebrew required compiling everything from scratch. Not a very great use of developer time. > more often than not it is a crutch used to make up for the fact that many web developers don't really know how to properly manage their machines. This is like saying that an electric starter is a crutch, and Real Drivers relish the opportunity to spend 20 minutes using a crank starter to "properly" start their car's engine every time they need to go somewhere. No thanks. Like using a crank starter, managing a bespoke local environment is not some incredible skillset, even though you seem to be giving yourself a nice pat on the back for it. It's simply a questionable use of developer time, and doubly so if all of your production environments aren't identical.
- 5y ago
- joelbluminator 5y agoDid it correctly identify PHP as a virus?
- jsemrau 5y agoI used PHP for many years and products. But currently I hold the opinion that Python-Flask is more powerful for server-side operations.
- vehemenz 5y agoHow easy is it to transition to Python/Flask from PHP for someone with limited experience in Python?
- jsemrau 5y agoI found that the learning curve is pretty much same. I struggled the most with setting up the wsgi file. But online documentation is really good because many people are using it.
- oknoorap 5y agoIt's not a big deal at all. We can use docker.
- deleted 5y ago[deleted]
- oknoorap 5y agowhy I'm downvoted. I'm not php hater :\
- snshn 5y agoIt was there this whole time?! Thank dog it's gone.
- joshenders 5y agoCan we remove all of the BSD subsystem and replace it with busybox please? Way less surface area for vulnerabilities and it’s more likely to be up-to-date if there’s only one binary which needs updating.
- my123 5y agobusybox is not an option because of the GPLv3. http://landley.net/toybox/about.html http://landley.net/toybox/about.html might be one.
- swiley 5y agoMan what a drag, it's a real bummer a multi billion dollar cooperation can't just rip off open source projects.
- dagmx 5y agoThey do contribute quite a bit to OSS. GPL has a lot of other considerations when mixed with proprietary code however which makes it a very unpragmatic choice for commercial software companies who may be bound by multiple licenses.
- joshenders 5y agoAh, yep. You win. licensing is definitely the reason. Guess it’s time to re-implement busybox in Rust with a non-viral license!
- my123 5y ago(sorry, I misremembered. busybox is actually under the GPLv2)
- kUdtiHaEX 5y agoI think that this is fine because if you need it you can easily install it with brew.
- marlynm 5y agoNo one should use system PHP anyway on macOS, It is an old and insecure version. I would recommend installing PHP via brew https://github.com/shivammathur/homebrew-php https://github.com/shivammathur/homebrew-php
- saagarjha 5y agoWhat does this version have over https://github.com/Homebrew/homebrew-core/blob/master/Formula/php.rb https://github.com/Homebrew/homebrew-core/blob/master/Formul...?
- marlynm 5y agoExactly same as core tap for currently supported PHP versions i.e. 7.3 to 8.0. Builds with security patches backported for PHP 5.6 to 7.2.
- JackPoach 5y agoThis is big. No, this is HUGE.
- saagarjha 5y agoI always liked that macOS gave you a version of these scripting runtimes. Not a great one, not the latest one, but one. Being able to run a quick Python script without installing things on someone else's computer was always convenient. It'll be sad to see these all go.
- D13Fd 5y agoI use Python scripts every day, dozens of times a day, on Mac OS. I’d still prefer not to have Python integrated. Having multiple random versions floating around on the system (v2 plus a random v3 if you have Xcode installed) has been way more of a headache than it’s be worth. I would much rather just have Mac OS come without Python and set up pyenv myself.
- robotron 5y agoAs someone who works with PHP on Mac OS, the installed version was nothing more than annoyance you have to deal with if you're using the actual runtime. Otherwise, used Docker and ignored it.
- saagarjha 5y agoSee, this is kind of the opposite situation, because you can bother to install a good Python that suits your needs. I’d just like a Python for the times I am at my mom’s computer and need to write a quick script, and I don’t want to install anything just for that. For conflicts: I wish Apple let you uninstall the “system” versions. But I still would like to keep them.
- robotron 5y agoGood. The installed version just gets in the way if you're a PHP developer.
- donatj 5y agoHear 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.
- imNotTheProb 5y agoI wonder why Apple/Tesla/Jeep users apologize for Apple/Tesla/Jeep, where Google/MS/Ford get hated on for new features.
- JoeCianflone 5y agoAs a full stack developer who works on tons of PHP and Laravel projects…I don’t care. It’s the 3rd thing I install on every new machine: Firefox, Homebrew, then latest version of PHP. This will have an effect on developers who create tools that rely on PHP but I’m not sure how big of a market that I’m really is so ok.
- trey-jones 5y agoI consider this a decent workaround: alias php='docker run --rm -ti php:pick-your-version' I write a fair amount of PHP on Linux and I haven't had php actually installed for years.
- obayesshelton 5y agoMost professional engineers are using some sort of virtualisation (docker or vagrant) with the language inside it. I never use the OSX standard version of PHP or Python
- hu3 5y ago> Most professional engineers are using some sort of virtualisation source?
- la_fayette 5y agoI am teaching a web-development course with PHP at university. Since PHP was preinstalled on MacOS in a ancient version, it was extremly hard for freshmen to get their mac prepared for the exercices. Windows users had a very simple start, basically just downloading and extracting a zip file from php.net... This seems to be good news for me, however most students have older macs so this will propably take some time to take effect...
- dagmx 5y agoWhy couldn't they just install a newer version of PHP though?
- larkost 5y agoOn MacOS most of the files that makeup the system are now write protected (not just the file permissions, but something called "System Integrity Protection" or SIP). So you can't overwrite them. You can add a new install, but then you have to know how to change your $PATH to view that location first. That is just one more thing you have to know. Apple did start to have a binary in the default location that was really a chooser that would respect per-user settings and re-direct you (exec) to the "right" install, but they seemed to have backed off on that.
- dagmx 5y agoBut that's normal. On any OS you shouldn't be replacing OS files and instead you should be prepending to PATH.
- ben174 5y agoWhy are universities still teaching PHP? Is this a “programming” class or a specifically a PHP class that they offer for people who want to learn that particular language?
- floatingatoll 5y agoWhy do you believe that PHP isn’t worth learning? Please don’t frame your personal opinions as assumption-laden questions. If you think PHP isn’t worth it, then say that directly and openly. Framing your belief as a loaded question is not conducive to good discussion.
- overgard 5y agoThis makes it sound like it's personal against PHP, but really apple removing these baked in languages is a great thing. I've run into so many problems with the builtin python install, especially with SIP. Not so much fixing my machine (I always use a venv), but other peoples. This is just fixing a bad mistake.
- lhball 5y agoEchoing others here, I honestly prefer this than dealing with outdated defaults built into the OS. More often than not they just get in the way. The real bummer is for newcomers. It's going to make getting started much more of a headache since they first need to learn how to setup a local environment.
- steve_adams_86 5y agoI’m a little surprised to see the resistance against this. I remember wishing it wasn’t bundled with the OS a decade ago. I used the languages, but never the version that came with the OS.
- jmull 5y agoYou pretty much don’t want third-party apis/tools/apps bundled with an OS. It may seem convenient at first, but: - updates are subject to the release schedule and priorities of the OS — which are unlikely to match yours are all your apps. - when you end up going your own way anyway, you have to fight the OS over how to manage tools that it’s also trying to manage. Whether it’s PHP, Vulkan, or whatever, you do not want it strictly tied to the OS.
- tibbydudeza 5y agoApple dropped Samba and wrote their own SMB client due to their fear of GPL v3. Do they still use CUPS for printing ???.
- sitharus 5y agoGiven that Apple have owned CUPS for close to 15 years, yes they still use CUPS. The author left Apple in 2019 and now maintains a fork.
- riffic 5y agoif you need it, you can install it. this, to me, is a non-issue. I certainly don't need my desktop system to ship a php binary when the language itself is a fast moving target these days. You know what I'd rather Apple do? Ship proper control group and namespace support within XNU so it can be containerized. People have been asking for this for a while: https://unix.stackexchange.com/questions/113471/cgroups-analogue-in-darwin https://unix.stackexchange.com/questions/113471/cgroups-anal...
- astrange 5y agoAre you sure this is not already provided by launchd?
- pknerd 5y agoDidn't know about it. I either used Laravel or MAMP.
- gizdan 5y agoI never really understood why Apple included php, ruby, and python (and others?) on Macs. Mac was never advertised as a "batteries included dev environment" nor were any core applications relying on those languages (minus python, at least from what I understood). So why include it instead of asking the developer or engineers to bundle/install it? I know Linux often relies on python and perl scripts, so it makes sense to include them in the base system. But there's no reason to include them in the base system if they're not used.
- dmz73 5y agoIt sounds like they continue to boil the frog slowly. If you look back 10 years and compare the Mac OS then and now, would you have accepted the change in one version? Probably not. This will continue until Mac OS and iOS are unified and to develop for this new OS you need a hardware dev kit. MS will probably try the same but will not succeed since they don't control the hardware.
- astrange 5y agoThe only thing that's happened over the last 10 years is Apple execs saying they're not going to do that, not doing it, and then people saying they're going to do it next year and not apologizing when it still is not true.
- sergiomattei 5y agoThat’s excellent news. The included scripting languages in macOS have always been a nuisance to deal with. I agree that they keep something like python2 around for scripting, but that’s about it. Having to get around the included languages is a bitch every time I’m trying to set up a development environment.