1) I have compiled modsecurity using YAJL using --with-yajl but in the config log I see that the yajl library is not picked and in the modsecurity log I get "JSON support was not enabled"
-
1Even after using --with-yajl.. in the make file i see blank values for the following YAJL_CFLAGS = YAJL_LDADD = YAJL_LDFLAGS = YAJL_LIBS = – Java Geo Feb 05 '16 at 15:14
2 Answers
I initially had mod_security working with PHP 5.5 and Apache 2.4, with Ubuntu 12.04, but after enabling JSON request inspection I got the same error as you reported.
To fix it, I had to make yajl, re-compile mod_security with the yajl configure option, and then ensure that Apache was using the updated mod_security, and restart Apache.
mod_security was then able to successfully parse json request body and not output the error any longer.
I went to http://lloyd.github.io/yajl/ and found the download package for yajl-2.1.0, and then referred to https://gist.github.com/rpfilomeno/1140359f4bd360137a98.
For example:
tar -xvzf lloyd-yajl-2.1.0-0-ga0ecdde.tar.gz
cd lloyd-yajl-66cb08c/
sudo ./configure
sudo make
sudo make install
sudo ldconfig
That should install yajl. Then cd
to the folder with the mod_security files, and run
cd ../modsecurity-2.9.1/
sudo ./configure --with-yajl="/usr/local/lib /usr/local"
sudo make
sudo make install
I then configured it to run with Apache 2.4, and have been able to parse requests with a JSON body.
*Note that when making yajl, if there is an error relating to cmake not being installed, run the following sudo apt-get install cmake
, and then try making it again.

- 1,737
- 3
- 17
- 24
Check your config.log if it has following
checking for libyajl config script... no
checking for yajl install... no
configure: optional yajl library not found
Then create a link to yajl.pc as
# ln -s /usr/local/share/pkgconfig/yajl.pc /usr/share/pkgconfig/yajl.pc
In my case file yajl.pc was in /usr/local/share/pkgconfig/ location. If you cannot find it there try " find / -name yajl.pc " to locate it.
Hope this helps you.

- 343
- 1
- 2
- 5