Jump to content

Apache 2.4 showing blank PHP 7 installed using Homebrew


Recommended Posts

I'm having issues getting PHP 7.4.6 work with Apache 2.4 on Macos Catalina. I tried some solutions but none of them worked, still getting a blank page when running PHP code via Apache. Both Apache and PHP were installed using Homebrew.

Running brew info:

rocky@rockysMacBookPro ~ % brew info php@7.4
    php: stable 7.4.6 (bottled), HEAD
    General-purpose scripting language
    https://www.php.net/
    /usr/local/Cellar/php/7.4.6 (520 files, 76.1MB) *
      Poured from bottle on 2020-05-15 at 02:41:44
    From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/php.rb
    ==> Dependencies
    Build: httpd ✘, pkg-config ✘
    Required: apr ✔, apr-util ✔, argon2 ✔, aspell ✔, autoconf ✔, curl-openssl ✔, freetds ✔, freetype ✔, gettext ✔, glib ✔, gmp ✔, icu4c ✔, jpeg ✔, libffi ✔, libpng ✔, libpq ✔, libsodium ✔, libzip ✔, oniguruma ✔, openldap ✔, openssl@1.1 ✔, sqlite ✔, tidy-html5 ✔, unixodbc ✔, webp ✔
    ==> Options
    --HEAD
        Install HEAD version
    ==> Caveats
    To enable PHP in Apache add the following to httpd.conf and restart Apache:
        LoadModule php7_module /usr/local/opt/php/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.4/
    
    To have launchd start php now and restart at login:
      brew services start php
    Or, if you don't want/need a background service you can just run:
      php-fpm
    ==> Analytics
    install: 53,658 (30 days), 140,934 (90 days), 499,288 (365 days)
    install-on-request: 50,277 (30 days), 131,496 (90 days), 461,925 (365 days)
    build-error: 0 (30 days)

Httpd.conf:

    LoadModule php7_module /usr/local/opt/php/lib/httpd/modules/libphp7.so
    <FilesMatch \.php$>
        SetHandler application/x-httpd-php
    </FilesMatch>

.bash_profile:

export PATH=/usr/local/Cellar/php/7.4.6/bin:$PATH

Renamed php-fpm.conf.default:

sudo cp /private/etc/php-fpm.conf.default /private/etc/php-fpm.conf

Running php-fpm:

rocky@rockysMacBookPro ~ % php-fpm                                                            
    [21-May-2020 13:36:05] WARNING: Nothing matches the include pattern '/private/etc/php-fpm.d/*.conf' from /private/etc/php-fpm.conf at line 143.
    [21-May-2020 13:36:05] ERROR: failed to open error_log (/usr/var/log/php-fpm.log): No such file or directory (2)
    [21-May-2020 13:36:05] ERROR: failed to post process the configuration
    [21-May-2020 13:36:05] ERROR: FPM initialization failed

Line 143 in php-fpm:

include=/private/etc/php-fpm.d/*.conf

Running php-fpm -i

'--sysconfdir=/private/etc'


Now I'm out of ideas and any help is appreciated. Thank You

Link to comment
Share on other sites

rocky@rockysMacBookPro ~ % php-fpm                                                            
    [21-May-2020 13:36:05] WARNING: Nothing matches the include pattern '/private/etc/php-fpm.d/*.conf' from /private/etc/php-fpm.conf at line 143.
    [21-May-2020 13:36:05] ERROR: failed to open error_log (/usr/var/log/php-fpm.log): No such file or directory (2)
    [21-May-2020 13:36:05] ERROR: failed to post process the configuration
    [21-May-2020 13:36:05] ERROR: FPM initialization failed

Have you looked into that?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.