Had the same problem. I deleted one of my project's folder and it became broken.
In this case the site's configs should be removed from httpd-vhosts.conf and httpd.conf.
Try ping 127.0.0.1
apachectl configtest can help you to detect the problem.
LockFile is one of the directives of Apache ≤ 2.2. This was replaced by Mutex in Apache 2.4, which is the version of Apache installed with OS X 10.11, El Capitan.
Edit the file /etc/apache2/extra/httpd-mpm.conf to remove this part:
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
OS X provides launchctl to control which daemons are started at boot time.
To stop and disable Apache:
Type the following command (type your login password when sudo requests it):
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
A few words on launchctl's -w option
The -w option is the silver bullet for ...
I have an alias specified in OSX server pointing to a user directory.
I spent a long while chmodding and messing with _www user, adding executable permissions recursively, uninstalling macports and all sorts of stuff trying to get this to work. No idea why it wasn't working.
Eventually, I just checked the "shared folder" checkbox in the Finder for that ...
Here is how you can re-enable the web page with the command line using Terminal.
First copy this and paste it into Terminal. You may have to press enter after pasting to run it. It will ask for your password because it is adding a file to your system directory.
USER_DIR=$(basename $(echo ~))
sudo bash -c "cat > /etc/apache2/users/$USER_DIR.conf" <&...
Removing system macOS binaries is not a good idea, they will be reinstalled during a next system upgrade and they could be needed by some system scripts.
To enable the homebrew php from the command line, read the output of brew info php70:
If you wish to swap the PHP you use on the command line, you should add the following to ~/.bashrc, ~/.zshrc, ~/....
Find the line that says LoadModule php5_module libexec/apache2/libphp5.so and uncomment it by editing out the # at the beginning of the line. (Then save the file, obviously.)
Go to Terminal and type sudo apachectl graceful at the console:
I looked up the information on the file http-mpm.conf at the Apache website:
It says LockFile is a correct directive. I don't know why I'm getting the same error you are. So in terminal, I went to:
and restored the httpd-mpm.conf file from before I loaded El Capitan. I used these commands:
sudo mv httpd-mpm.conf httpd-mpm.conf....
In my opinion you hosed your various httpd launch daemons/start mechanisms by executing too many httpd related commands.
With homebrew and homebrew's apache-httpd installed and the default PATH you have six ways to start httpd.
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
sudo /usr/sbin/apachectl start
Instead of guessing which php.ini you need to alter, run this command to locate the file:
php -r 'phpinfo();' | grep 'php.ini'
Even though I use MAMP PRO, by default my command-line PHP commands are not executed using their copy of PHP. In my case it says the file is found at /etc/php.ini
Once you have located the file, follow the instructions on all of ...
/etc/php.ini.default serves only as a reference and is not read out by PHP at all. The built-in PHP installation will look for the file /etc/php.ini instead. This file is not present by default, but you can copy /etc/php.ini.default to /etc/php.ini and make your modifications in there. You could also just create an empty file and only add any directives you ...
Regarding homebrew httpd, one issue I recently ran into was an old leftover httpd.pid file that was preventing httpd from starting. Symptom was apachectl start said httpd is already running, but it was not.
Cause was an old file here:
Solution was to delete this pid file and then httpd started.
To start apache
sudo apachectl start
This will give you a basic Apache server with a DocumentRoot at /Library/WebServer/Documents/
You can enable things like PHP and virtualhosts by making use of the configuration file, which must be edited as root:
Restart the apache server (like after editing the config file) with
sudo apachectl ...
I update to macOSS Sierra, Version 10.12
I face the same issue, I did two things to fix it properly. Following is my approaches.
1) Please check "/private/etc/apache2/extra/httpd-userdir.conf" file.
2)**And edit your "/etc/apache2/httpd.conf"
After updating to macOS Sierra, Apache httpd moves the old httpd.conf to httpd.conf.pre-update and place the new one. In order to work the localhost work please try the below procedure:
sudo mv httpd.conf httpd.conf-afterupdate
sudo mv httpd.conf.pre-update httpd.conf
sudo apachectl configtest
sudo apachectl restart
I generally fix this by setting the Apache user to myself in local environments and in machines where the only user who uses Apache is me. In /private/etc/apache2/httpd.conf, set User to your username from _www, e.g.:
And then restart Apache:
$ sudo apachectl restart
If you have active sessions, they are going ...
I had the same problem - it's based on mod_userdir exclusion after updating to Mac OS X Mojave. There are a few steps to repair that:
Load the module mod_userdir in /etc/apache2/httpd.conf
At the end of the httpd.conf make sure to load httpd-userdir.conf
In httpd-userdir.conf include a local file in /etc/apache2/users/<username>.conf
Put a directory ...
There should be 3 files in /Library/WebServer/Documents:
If these files are missing, it really shouldn't matter.
As soon as you create your own HTML file and place it in that folder, the "It works!" message should be replaced with your new index.html file.
Hope this helps.
I found a solution to your problem here.
Using Terminal "How do I make Apache start automatically":
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
You were close to the solution just needed the -w override.
the -w Overrides the Disabled key and sets it to false.
The file /etc/apache2/original/httpd.conf (in OS X 10.11.5) has the following content with three trailing empty lines:
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, ...
This worked for me when I ran into the same problem.
Please check "/private/etc/apache2/extra/httpd-userdir.conf" file.
and restart apache.
I think default apache path
and homebrew apache path
And you may have 2 apache in your system use this cmd to check
which -a apachectl
apache for default
apache for homebrew. I think so.
The command below use for default apache. I think.
The answers above work great for the default apache that comes pre-installed on the mac. In my case, I'm using Apache (on High Sierrra) installed via Homebrew. Here's the procedure I used to locate my error log:
>ps -ef |grep httpd
This gives an output with lines like this:
502 10587 10586 0 11:11AM ?? 0:00.00 /usr/local/opt/httpd/bin/httpd -...
OK, so I found the culprit.
It is amazing that no error message was visible in console or in the error logs, but I found a site which helped me a lot.
In that post, the author, Josh, suggested restarting apache using the following command:
sudo bash -x /usr/sbin/...
It looks like you have nearly everything correct. I'm running Mavericks with a couple dozen virtual hosts, so this should work for you.
First, and this might be all you need to do to fix things, you need to enclose your DocumentRoot in quotes. So,
You have to edit the file /usr/local/etc/apache2/2.4/httpd.conf.
Search for and uncomment the following two lines (remove the # at the beginning of the line):
#LoadModule vhost_alias_module libexec/mod_vhost_alias.so
Then edit the file /usr/local/etc/apache2/2.4/extra/httpd-vhosts.conf to suit ...
I have solved the problem by restoring my Hosts file (it was empty):
But before, you have to check your hosts file.
If nothing is shown, that means your hosts file is empty.
Then just copy and paste this over the existing hosts file then save it as plain text to restore it.
# Host Database
# localhost is used to configure the ...