How to fix HTTPD (Apache) Error 256 on OSX Monterey 12.5 - apache

I have a Apache2 installed with Homebrew on a Mac running OSX Monterey. I haven't done LAMP development for a while, so I'm not sure when the error started, but I've recently updated OSX to 12.5. When I returned to working on a LAMP project, my Apache installation stopped working. Running brew services produced the following output: Name Status User File httpd error 256 root ~/Library/LaunchAgents/homebrew.mxcl.httpd.plist mysql started Nizz0k ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist.
Running the stop, start, and restart commands produces "success" output in the terminal, but Apache doesn't work. I can't navigate to my local vhosts, and of course, running brew services still shows an error.
In running apachectl -e error Apache complains about permissions to the error logs
I have tried:
uninstalling and reinstalling HTTPD
The apr-utilities fix.
confirming Mac installed Apache is stopped.
At this point, I think my problem is that there was conflicting information about how to run Apache on Homebrew. Earlier versions apparently required sudo, but running it this was now produces warnings like this:
Warning: Taking root:admin ownership of some httpd paths:
/usr/local/Cellar/httpd/2.4.54/bin
/usr/local/Cellar/httpd/2.4.54/bin/httpd
/usr/local/opt/httpd
/usr/local/opt/httpd/bin
/usr/local/var/homebrew/linked/httpd
This will require manual removal of these paths using `sudo rm` on
brew upgrade/reinstall/uninstall.
Warning: httpd must be run as non-root to start at user login!
/Library/LaunchDaemons/homebrew.mxcl.httpd.plist: service already bootstrapped
Bootstrap failed: 37: Operation already in progress
Error: Failure while executing; `/bin/launchctl bootstrap system /Library/LaunchDaemons/homebrew.mxcl.httpd.plist` exited with 37.
The issue is even after removing the paths as suggested in the error, a reinstallation brings Root back as the owner.

I do have the same problem with nginx.
Manually unloaded it and then restarting it worked fine.
Try:
sudo launchctl bootout system /Library/LaunchDaemons/homebrew.mxcl.httpd.plist
sudo brew services start httpd

Related

httpd not showing/using most updated version of apache (via brew)

I just installed the latest version of Apache (2.4.43) using brew on Mac OS (10.14.5). (Using instructions from this site.) But after restarting the service, httpd -v still shows 2.4.34 running from the Mac OS default. The same old version is shown when I query apachectl -v.
Thinking that perhaps I needed to update with one more step, I ran brew update httpd but it said that "httpd 2.4.43 already installed."
I'm still pretty new to using brew, and this is my first time creating an Apache server, so any help here would be appreciated. Thanks!
Sorry - easy fix. I neglected to update my .bash_profile to include /usr/local/opt/apache2/bin.
This was clear after I ran which apachectl, and it displayed the default directory for the preinstalled version of Apache - /usr/sbin/apachectl.
I ended up stopping the default version and prevented it from starting again on boot:
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
Then, started the newly installed version, and it worked fine.

Homebrew PHP Install Breaks Apache 2.4

When I recently installed PHP56 via Homebrew, Apache would no longer start, with this error in the logs:
Cannot load /usr/local/opt/php56/libexec/apache2/libphp5.so into server: dlopen(/usr/local/opt/php56/libexec/apache2/libphp5.so, 10): image not found
Note: I'm running Apache 2.4 on Mac El-Capitan.
How can I resolve this error and get Apache running again?
I've seen this before. If you brew options php56, it says:
With the release of macOS Sierra the Apache module is now not built by default. If you want to build it on your system
you have to install php with the --with-apache option. See brew options php56 for more details.
Thus, try uninstalling (brew uninstall php56) then reinstalling php56 with the flag --with-apache for Apache v2.4.x (--with-apache22 for Apache 2.2). Generally, you can check your Apache version by typing in command line: httpd -v.
My version is 2.4.18, so I would brew install php56 --with-apache, which creates the proper file path /usr/local/opt/php56/libexec/apache2/libphp5.so.
Now, it is properly compiled with Apache Handler module.
IMPORTANT: installing php56 with this option appears to also install httpd24. From a brew program stance, this makes sense. However, this may break your server set up. If you don't want to use brew's Apache install, do a brew unlink httpd24 after this.
To see additional brew build options, try brew options php56.

Installing Cobbler on Ubuntu 15.10 seems to break apache, how can I fix this?

I am trying to install Cobbler on a brand new Ubuntu 15.10 virtual box but it is not working. When I run the apt-get install cobbler cobbler-web it seems to break apache completely to the point I can't get it working again.
I see this in the apache error log:
[wsgi:crit] [pid 8112:tid 140273573488512] mod_wsgi (pid=8112): The mod_python module can not be used on conjunction with mod_wsgi 4.0+. Remove the mod_python module from the Apache configuration.
and this in the auth.log:
polkitd(authority=local): Unregistered Authentication Agent for unix-process:8081:54865 (system bus name :1.24, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
I have tried removing the mod_python and wsgi modules but apache still doesn't start up. And I think Cobbler uses them anyways, so I kind of need them.
I have also tried disabling polkitd. I don't find any clues when searching for that weird error message.
I was able to install Cobbler on Ubuntu 14.04 pretty easily and apache works fine.
Here is the basic chain of install commands I used:
apt-get update
apt-get install apache2
apt-get install isc-dhcp-server
apt-get install bind9 bind9utils bind9-doc
apt-get install cobbler cobbler-web debmirror mkisofs
Disable the module by typing sudo a2dismod python
You should then see this:
Module python disabled. To activate the new configuration, you need to
run: service apache2 restart
So type sudo service apache2 restart.
If that doesn't fix it, check the error log for more information by typing
cat /var/log/apache2/error.log.

(httpd) Getting some problems with Mod_security Installation

I'm using Webuzo on my first unmanaged VPS (CentOS 6.4,OpenVZ). I tried to install Mod_Security following this guide. I installed Modsecurity-apache_2.6.6 but there's a problem in Step3 that prevents me from installing OWASP Mod_Security Core Rule Set
wget http://www.modsecurity.org/download/modsecurity-apache_2.6.6.tar.gz
The Download address has been removed. So I found another guide for the rule set but I can't get this command to work
git clone https://github.com/SpiderLabs/owasp-modsecurity-crs.git
It returns "-bash: git: command not found"
What command should I use to get OWASP CRS?
Also, I suspect the mod_security installation is incomplete since httpd server is unable to restart after installing modsecurity. Here's the configuration error:
[root#xx ~]# httpd -t
Syntax error on line 7 of /etc/httpd/conf.d/modsecurity.conf:
Invalid command 'SecRuleEngine', perhaps misspelled or defined by a module not included in the server configuration
Should I uninstall Mod_Secuirty first since everything seems to have become a mess now?
Any help is appreciated.
The apache binary in case of Webuzo is located at /usr/local/apps/apache and the modules are located at /usr/local/apps/apache/modules/lib.
Also the apache configurations in case of Webuzo are located at /usr/local/apps/apache/etc/ and /usr/local/apps/apache/etc/conf.d/
It seems you are trying to compile mod_security at an inappropriate location.
As you are having error with modsecurity.conf, I wonder whether you have followed the step
Step 4: Configuring Mod_Security
In the guide you have followed.
"-bash: git: command not found"
This error can be resolved by installing the package that includes git. try
yum install git-core -y
Both guide1 and guide2 are good to install mod_sec and follow any one. :)

Php-gd: PHP Extension gd must be loaded & Unable to locate package

Having an issue with php-gd
I inserted this command:
sudo apt-get install php5-curl php5-mcrypt php5-gd php5-common
throughout the process to setup Magento but when I went through Validation, this is what I got:
"PHP Extension gd must be loaded"
When the warning showed up. I tried to install it again using:
sudo apt-get install php5-gd
This was the message that I received:
"Reading package lists... Done E: Unable to locate package"
I Would like some direction on how to fix this Error.
Restarting the webserver after installing php5-gd loads the package.
check. reloading the web server. services such as php-pfm (php5-fpm), fcgi, fastcgi, etc load once and remain in the background. Adding modules does not impact the running copy. It must be restarted to load the module into active use.
Use synaptic package manager for easier installation.
After installing and it still does not work, look at the apache modules, mine is at /etc/php5/apache2/conf.d/20-gd.ini
; configuration for php GD module
; priority=20
; extension=gd.so
Even if the module exists and is installed on the system, it is commented out on the module config. Uncomment it, then restart Apache, then you should be fine.