Where is php installed mac?

Replies

PHP has been removed in macOS Monterey.

This is a giant step backwards. One of the nice things about macOS is the built in apache including PHP. Please reconsider this.

MAMP [//www.mamp.info/en/mac/] is also an option.

No one should use system PHP anyway on macOS, It is an old and insecure version. I would recommend installing PHP via brew  //github.com/shivammathur/homebrew-php

Can I add my tuppence-worth as another request for PHP to return to macOS 12. My first thought was that it was a licensing issue, but PHP uses a BSD-style license, so I can't understand the rationale for removing it.

Via MacPorts [ //www.macports.org/ ]:

port install php

It seems that it would be easier for one person at apple to upgrade php, rather then millions of users having to do so. Laziness.

The situation is similar for Perl. You can install perl separately via homebrew or macports, or via plenv [//github.com/tokuhirom/plenv] or perlbrew [perlbrew.pl]. This is preferred anyway since in the last few OSX releases, Apple has edited some of the internal Perl toolchain modules [such as ExtUtils::MakeMaker] in a broken way without talking to the developer team [or even responding to repeated pleas to fix their broken changes].

100% the right move. Dockerize your app and move on.

docker pull php:alpine

O.k., they removed php... some call it a good thing, some call it a bad thing. But; why remove PHP, but keep apache?

Buna hiç gerek yoktu. İşi zora sokmak demek bu. Php eski ve kullanılmayan bir dil değil.. Web tabanlı en gelişmiş dillerden biri durumunda ve güncellenmeye devam ediliyor. Apple desteğini çekerek iyi yapmadı. Umarım konu hakkında gerekli iyileştirmeleri yaparlar ve php desteği geri gelir.

It would be good if Apple allows custom installation that makes php executable into /usr/bin. Right now, the situation is breaking some tools, such as phpcs in PHPStorm. I tried to solve it by installing PHP with Homebrew, and it doesn't solve the problem.

What upsets me about the move to big sur and then monterey is that the upgrade program should check that i have apache, php and mysql and if it finds that there it should stop and say: hey man, this upgrade is going to create problems for you ... do you want to think about it before you proceed?

So what I'm going top do now is upload the [daily] backedup MySQL database to a hosting service that will also support PHP. Then I'll find the time to work out how to migrate my admin systems to Monterey - and then buy a new Macbook Pro - after I know how to migrate to that environment.

PHP is not insecure if you use a supported version: //www.php.net/supported-versions.php

Apple is not the only company to stop bundling it and give the responsibility to the end user. Claris also used to ship PHP with FileMaker Server and removed that. So Claris had to provide instructions to get your own php set up for custom web publishing in the Claris Engineering blog: //support.claris.com/s/answerview?anum=000035470&language=en_US

These instructions were helpful, as were Tim Perfitt's instructions at Two Canoes for installing PHP on Monterey as he did for his MDS project: //twocanoes.com/knowledge-base/installing-php-7-on-macos-12-monterey/

Of course, in Monterey you have to code-sign the PHP you install. But it is not so hard if you follow the method from Rich Trouton at "Der Flounder": //derflounder.wordpress.com/2019/04/10/notarizing-automator-applications/

Using all this, I have had great success installing my own PHP on both my macOS FileMaker Server for custom PHP web publishing and my macOS Web Server [for a web site, munki server and munkireport server and various remote proxies. [both Macs on Monterey].

I presented on this topic along with my methodology including a "recipe" at the MacDevOps YVR conference 2022: //www.youtube.com/watch?v=XzxxLHojXhk&t=1s

In short, PHP on the Mac still lives - but its up to the end user to maintain it.

On OSX/MacOS do the following in a Terminal window:

Run php --ini at the prompt by typing it and pressing enter

Reports something like: Configuration File [php.ini] Path: /etc Loaded Configuration File: [none] Scan for additional .ini files in: /Library/Server/Web/Config/php Additional .ini files parsed: [none]

...this is because in /etc there is a file called /etc/php.ini.default as an example and to show it is not in use. You need to copy that file to the name php expects so that you can edit it, like this:

Type:

$  sudo cp /etc/php.ini.default /etc/php.ini       [and enter your password]

...then you will see if you run php --ini again that it now sees your new file:

Typing this: php --ini at the prompt should report this:

Configuration File [php.ini] Path: /etc
Loaded Configuration File:         /etc/php.ini
Scan for additional .ini files in: /Library/Server/Web/Config/php
Additional .ini files parsed:      [none]

...now edit /etc/php.ini - you want to make sure the following lines [NOT the same line starting with a semi-colon ';'] are exactly as follows: log_errors = On [this will turn the logging engine on]

Then, in this section:

; Log errors to specified file. PHP's default behavior is to leave this value
; empty.
; //php.net/error-log
; Example:
;error_log = php_errors.log
; Log errors to syslog [Event Log on Windows].
;error_log = syslog

If you want to log to the syslog [or Windows Event Log on Windows] then ;error_log = syslog should become error_log = syslog

However, if as you say, you want to log to a file, you uncomment by removing the leading semi colon to make ;error_log = php_errors.log become error_log = php_errors.log or using a full path to place it where you want.

Good luck

Is PHP installed on Mac?

PHP is bundled with macOS since macOS X [10.0. 0] prior to macOS Monterey [12.0. 0]. Compiling is similar to the Unix installation guide.

Where is PHP INI on Mac Catalina?

ini File at MacOS Catalina. For my MacOS Catalina, the location of php. ini is located at /etc/. As you can see there is no php.

How do I open a PHP file on Mac?

Open the Finder and go to /Library/WebServer/Documents/localhost . All files that are in there are processed by the local webserver [Apache and PHP, if you want to know that]. Place your file in there and open your webserver and call //localhost/YourFile.php and it will call the file YourFile.

How do I install a specific version of PHP on Mac?

Check the package naming on your macOS terminal correctly..
You'll need to install Homebrew to be able to access PHP 8.1 and other packages. ... .
In the macOS terminal, execute brew update to update Brew..
Use the command brew install shivammathur/php/php@8.1 for installing PHP 8.1..

Chủ Đề