0

php is not working on macOS Mojave. apache server is working. when go to the localhost It shows file at Sites folder. But php info file not working. Followings are the terminal results.

  • when I add command php -v in mac terminal it gives
PHP 7.1.19 (cli) (built: Aug 17 2018 20:10:18) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
  • for command brew services start php result
Formula `php` is not installed.
  • command php --ini result
Configuration File (php.ini) Path: /etc
Loaded Configuration File:         /etc/php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)
  • command brew info php@7.1
php@7.1: stable 7.1.32 (bottled) [keg-only]
General-purpose scripting language
https://www.php.net/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/php@7.1.rb
==> Dependencies
Build: httpd ✘, pkg-config ✔
Required: apr ✔, apr-util ✔, aspell ✔, autoconf ✔, curl-openssl ✘, freetds ✘, freetype ✔, gettext ✔, glib ✘, gmp ✔, icu4c ✔, jpeg ✔, libpng ✔, libpq ✘, libtool ✔, libzip ✘, mcrypt ✘, openldap ✘, openssl ✔, sqlite ✔, tidy-html5 ✔, unixodbc ✔, webp ✘
==> Caveats

  • command brew install php@7.1
Updating Homebrew...
==> Installing dependencies for php@7.1: openldap, rtmpdump, curl-openssl, freetds, glib, libpq, libzip, mhash, mcrypt and webp
==> Installing php@7.1 dependency: openldap
==> Downloading https://homebrew.bintray.com/bottles/openldap-2.4.48.mojave.bott
Already downloaded: /Users/sanjeewa/Library/Caches/Homebrew/downloads/f7d657726afd2b8987c40c4279ba57e1583a23f8597a67ac31ea80af412d1540--openldap-2.4.48.mojave.bottle.tar.gz
==> Pouring openldap-2.4.48.mojave.bottle.tar.gz
cp: utimes: /usr/local/Cellar/openldap/.: Operation not permitted
cp: chmod: /usr/local/Cellar/openldap/.: Operation not permitted
Error: Failure while executing; `cp -pR /var/folders/yt/qltcrdg15773x8rq58dwn_540000gq/T/d20190831-35745-169vyg8/openldap/. /usr/local/Cellar/openldap` exited with 1. Here's the output:
cp: utimes: /usr/local/Cellar/openldap/.: Operation not permitted
cp: chmod: /usr/local/Cellar/openldap/.: Operation not permitted

Warning: Bottle installation failed: building from source.
==> Downloading https://www.openldap.org/software/download/OpenLDAP/openldap-rel
Already downloaded: /Users/sanjeewa/Library/Caches/Homebrew/downloads/7fa3f33c42cafa340a19fafe1fc8f57f4d4f66310a55f6987c6ce5fe0d8a43c7--openldap-2.4.48.tgz
==> ./configure --prefix=/usr/local/Cellar/openldap/2.4.48 --sysconfdir=/usr/loc
==> make install
Error: An exception occurred within a child process:
  Errno::EPERM: Operation not permitted @ chmod_internal - /usr/local/etc/openldap/slapd.ldif
  • following steps also done
==> Caveats
To enable PHP in Apache add the following to httpd.conf and restart Apache:
    LoadModule php7_module /usr/local/opt/php@7.1/lib/httpd/modules/libphp7.so

    <FilesMatch \.php$>
        SetHandler application/x-httpd-php
    </FilesMatch>

Finally, check DirectoryIndex includes index.php
    DirectoryIndex index.php index.html

The php.ini and php-fpm.ini file can be found in:
    /usr/local/etc/php/7.1/

php@7.1 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.


To have launchd start php@7.1 now and restart at login:
  brew services start php@7.1
Or, if you don't want/need a background service you can just run:
  php-fpm
  • command php-fpm result
[31-Aug-2019 12:27:11] ERROR: failed to open configuration file '/private/etc/php-fpm.conf': No such file or directory (2)
[31-Aug-2019 12:27:11] ERROR: failed to load configuration file '/private/etc/php-fpm.conf'
[31-Aug-2019 12:27:11] ERROR: FPM initialization failed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.