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.


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.

  • 9
    "debianism" is a word I appreciate, coming from Ubuntu. – Meetai.com Jul 2 '14 at 11:00
  • 1
    @Dennis So many words for RTFM. Even the link points to the docs front page :D – Pichan Dec 10 '14 at 11:06
  • 3
    This "manuallity" doesn't get life easier, when you're automating setup – holms May 25 '15 at 18:14
  • 1
    CentOS team is so arrogant :( – Dr Deo Dec 6 '18 at 4:35

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
  • 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 '17 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.