Apache Command Line Not Functioning - apache

Installed Apache Ver 2.2.3 on my vps with Centos 5.6 but when I try the a2dismod and a2enmod got Command not found error.
What can I do to fix it?
Thank you
This is my first vps and this is also my first experience with linux and centos.
The server is running fine just need to disable few modules.

On CentOS there are no a2enmod and a2dismod commands. To disable unneeded modules in Apache, you need to carry out steps as described at the lower end of – for instance – this post: http://www.cyberciti.biz/faq/howto-disable-apache-modules-under-linux-unix/

Perhaps those commands were not in your path? If the programs are in your current working directory, try ./a2dismod.
To see what path our shell is searching, try echo $PATH.

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.

Mac OS Mojave downgrade PHP 7.3 to 7.2.14

I have installed PHP 7.2.14 with brew.
brew install php#7.2
On CLI I have already the 7.2.14 version, but not on Apache.
What should I do, so I can remove 7.3 from my Mac and use only 7.2.14
you need to run
brew link php#7.2
To force the link and overwrite all conflicting files:
brew link --overwrite php#7.2
To list all files that would be deleted:
brew link --overwrite --dry-run php#7.2
The PHP version in your CLI has nothing to do with the version you have on your Apache module.
You need to disable/enable the right modules in apache in order for the right php version to take affect.
For enabling/disabling a mod, you have this nice helper commands:
a2enmod <MOD_NAME> // Enable a mod
a2dismod <MOD_NAME> // Disable a mod
This one is not tested, but you should be able to do:
a2dismod php7.3
a2enmod php7.2
P.S
Not sure the apache helper commands are available in mac so you can do it directly through the httpd.conf file.
checkout /etc/apache2/httpd.conf and make sure the right modules are loaded.
Hope it helps.
Good luck :)

Set php7 location to Apache (Macports)

I've installed php7 via MacPorts to the El Capitan using this tutorial.
Is it possible to execute php7 with default OSX Apache (not Apache from MacPorts)? If yes, where should I set php7 location in Apache?
MacPorts will build all modules only for the Apache httpd provided by MacPorts itself and not for the system version.
See the notes for the php70-apache2handler port how you can enable the module:
$ port notes php70-apache2handler
php70-apache2handler has the following notes:
If this is your first install, you need to enable php70-apache2handler in your web server.
To enable php70-apache2handler, run:
cd /opt/local/apache2/modules
sudo /opt/local/apache2/bin/apxs -a -e -n php7 mod_php70.so
If someone had the same problem, this tutorial helped to solve my problem.

Installing Apache server

How to install Apache server on your computer? I have downloaded the file from here: http://httpd.apache.org/download.cgi but there is no installation file in this archive. What file should I be looking for or is there some other way to go about it completely and I am being totally wrong?
You could read the documentation : http://httpd.apache.org/docs/2.4/install.html
If you're Windows user, I would like to suggest you to install XAMPP from
(apache, mysql and php5)
https://www.apachefriends.org/download.html
If you're Linux user, type following command (Ubuntu or Debian)
$ sudo apt-get install apache2

(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. :)