6

when I configured pnp4nagios,the following questions happened.

PHP GD extension→ PHP GD extension not available

PHP zlib extension→ PHP zlib extension not available

PHP socket extension→ PHP socket extension not available

Apache Rewrite Module→ Apache mod_rewrite is not enabled

google told me perhaps my php was broken during the installation. Also,I got this pageenabling-mod-rewrite-on-ubuntu

But,my server is CentOS,I carried out the command "a2enmod rewrite",the result is "-bash: a2enmod: command not found"……

What can I do?Thanks.

3 Answers 3

26

a2enmod is a debianism, on CentOS you will need to do this manually. Please refer to the Apache documentation to find out how to do this.

6
  • 16
    "debianism" is a word I appreciate, coming from Ubuntu.
    – Meetai.com
    Jul 2, 2014 at 11:00
  • 2
    @Dennis So many words for RTFM. Even the link points to the docs front page :D
    – Pichan
    Dec 10, 2014 at 11:06
  • 4
    This "manuallity" doesn't get life easier, when you're automating setup
    – holms
    May 25, 2015 at 18:14
  • 3
    CentOS team is so arrogant :(
    – Dr Deo
    Dec 6, 2018 at 4:35
  • 2
    apache management in ubuntu is so much nicer, would love to see the centos guys do the same
    – Izac
    Sep 24, 2019 at 14:17
7

PHP zlib and sockets are part of php-common. Install php-gd and php-common

yum install php php-gd php-common

to enable sockets find the PHP configuration directory and run the following commands in the terminal

./configure --enable-sockets
make && make install

Apache rewrite module allows URL rewriting. It's enabled by Default in Centos 7. Check if it's already enabled in your version. The following command outputs a list of Apache modules that are currently enabled:

httpd -M

If it is not already enabled, you will need to enable it by modifying the configuration file

sudo nano /etc/httpd/conf.modules.d/00-base.conf

and include the following line

LoadModule rewrite_module modules/mod_rewrite.so

Save the file and restart the Apache server

sudo systemctl restart httpd
1
  • On my server (CentOS 6.9, Apache 2.2.15), there isn't a conf.modules.d folder. Instead, I need to modify the main Apache configuration file: /etc/httpd/conf/httpd.conf
    – Morgan G
    Aug 11, 2017 at 17:24
0

Most of the needed mods are already installed. You can check for installed mods via:
httpd -M | grep modname

if these aren't loaded, they might need to be activated in a conf file alike: LoadModule rewrite_module modules/mod_rewrite.so

if you have mods which need to be added, usually these will be installed via:
dnf install modname

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .