How do I fix macOS Mojave httpd syntax error in a localhost setup? System details:


OS Host: Mac OS Mojave
PHP: 7.1.23


I am trying to set up my local server on a new Mac. I have been following the following instructions on https://discussions.apple.com/docs/DOC-13841. 

After enabling PHP, perl and personal websites, I check  the configuration with apachectl configtest and the terminal returns the following:

httpd: Syntax error on line 511 of /private/etc/apache2/httpd.conf: Syntax error on line 16 of /private/etc/apache2/extra/httpd-userdir.conf: No matches for the wildcard '*.conf' in '/private/etc/apache2/users', failing (use IncludeOptional if required)

However, I am expecting syntax OK. What should I do to fix this?
It sounds like you do actually not have any configuration files in the /private/etc/apache2/users/ directory, and thus you cannot include them - therefore the configuration check fails.

If you have users on your system with shared a shared Sites folder, you would usually have configuration files in this directory named username.conf with the following contents:

&lt;Directory "/Users/username/Sites/"&gt;
    Options Indexes MultiViews
    Require all granted
&lt;/Directory&gt;


(Note: You'll need to replace "username" in the filename and the contents with the actual name of the user)