php on MacOS HighSierra Server not working (for me)

Discuss server installationa nd configuration issues here

Moderators: egami, macek, gesf

Post Reply
ghoti
New php-forum User
New php-forum User
Posts: 1
Joined: Tue Aug 07, 2018 5:05 am

Tue Aug 07, 2018 5:41 am

Environment:
  • MacBook Air
  • OSX 10.13.6 (HighSierra)
  • [OSX] Server 5.6.1
  • PHP 7.1.16
  • Safari 11.1.2
  • Chrome 67.0.3396.99
Background:
  • A year or so ago, I was playing around with developing a site that utilized some PHP directives, and it was working.
  • I stopped working on it for a (long) while, and since then have certainly upgraded the OS X Server software, and probably the OS as well.
  • I decided to play with it again, but now the PHP directives do not seem to be working and I have not been able to figure out why and (more importantly) how to fix it.
  • The PHP code I used in the original HTML code was of the form:
    • <?php include "html/xxx.html"?>
  • When I wasn't seeing the content I expected (from the to-be included files), I added the following at the very top of the <body> section:
    • <?php echo "Hello"; ?>
  • Nothing (from the PHP standpoint) is showing up, and it was clear from looking at the "network" section of the page inspection console that the files to-be included were not being fetched - but there didn't seem to be any errors indicating that/why PHP wasn't working.
Miscellaneous Details:
  • Modified /private/etc/apache2/httpd.conf:
    • Uncommented the line: LoadModule php7_module libexec/apache2/libphp7.so
    • Changed DocumentRoot specification to match ~/Sites path
    • Modified the <Directory "xxx"> reference just below to also match the ~/Sites path
    • (References: Include /private/etc/apache2/other/*.conf)
    • Uncommented: LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so
    • Uncommented: Include /private/etc/apache2/extra/httpd-vhosts.conf
  • /private/etc/apache2/other/php7.conf contains the following:

    Code: Select all

        <IfModule php7_module>
          AddType application/x-httpd-php .php
          AddType application/x-httpd-php-source .phps
    
          <IfModule dir_module>
          DirectoryIndex index.html index.php
          </IfModule>
        </IfModule>
    
  • The referenced library is:
    • -rwxr-xr-x 1 root wheel 13429248 Jul 4 09:02 /usr/libexec/apache2/libphp7.so
  • Modified /Library/Server/Web/Config/apache2/httpd_server_app.conf:
    • Changed DocumentRoot specification to match ~/Sites path
  • Modified /private/etc/apache2/extra/httpd-vhosts.conf:
    • Replaced second example directive with one specific for my test site
  • In the Server UI, it shows "Enable PHP" as being checked, and the following command shows the (further) following output:
    • # apachectl -M | grep -in php
      30: php7_module (shared)
      #

    Thoughts?

    Ideas?

    Other steps I should take to try to debug / fix this?



    --fish

Post Reply