{"id":907,"date":"2018-10-19T00:36:15","date_gmt":"2018-10-19T00:36:15","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=907"},"modified":"2018-10-22T22:50:55","modified_gmt":"2018-10-22T22:50:55","slug":"mod_auth_mysql-installation-on-centos-7-and-apache","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/10\/19\/mod_auth_mysql-installation-on-centos-7-and-apache\/","title":{"rendered":"Mod_auth_mysql Installation on Centos 7 and Apache"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/linuxadmin.io\/wp-content\/uploads\/2017\/08\/mod_auth_mysql-installation.png\" alt=\"How to install mod_auth_mysql\" width=\"616\" height=\"257\" \/><\/p>\n<h2>What Is Mod_Auth_Mysql?<\/h2>\n<p>mod_auth_mysql is an Apache module used for authenticating users against a MySQL database. It is commonly used to protect items on a website via a user login prompt. The module is able to authenticate against a MySQL database to check for a valid username and password, it supports various encryption methods. You can view more about it on the <a href=\"http:\/\/modauthmysql.sourceforge.net\/\">project page<\/a>.<\/p>\n<p>This guide assumes you already have a working MySQL installation and Apache is already installed. If you do not have Apache installed please see our guide on <a href=\"https:\/\/linuxadmin.io\/compile-apache-2-4-source\/\">How To Install Apache<\/a><\/p>\n<h3>Install mod_auth_mysql<\/h3>\n<p>The last version of the module was created was designed for Apache 2.0 (we will show you how to patch it for 2.2 and 2.4 as well) First change to a download directory<\/p>\n<p>cd \/usr\/src<\/p>\n<p>Get the package<\/p>\n<p>wget https:\/\/github.com\/linuxadminio\/mod_auth_mysql\/raw\/master\/mod_auth_mysql-3.0.0.tar.gz<\/p>\n<p>Extract the package<\/p>\n<p>tar xfvz mod_auth_mysql-3.0.0.tar.gz<\/p>\n<p>Go into the directory<\/p>\n<p>cd mod_auth_mysql-3.0.0<\/p>\n<p>If you only have Apache 2.0 you can skip the next few steps, if you have 2.2 or 2.4 get the patch<\/p>\n<p>https:\/\/raw.githubusercontent.com\/linuxadminio\/mod_auth_mysql\/master\/mod_auth_mysql-300-apache-22.patch<\/p>\n<p>Patch mod_auth_mysql for Apache 2.2<\/p>\n<p>patch &lt; mod_auth_mysql-300-apache-22.patch<\/p>\n<p>If you have Apache 2.4, you will need to perform one more step. Open up mod_auth_mysql.c<\/p>\n<p>nano mod_auth_mysql.c<\/p>\n<p>Change the following lines<\/p>\n<p>line 908 from<\/p>\n<p>return r-&gt;connection-&gt;remote_ip;<\/p>\n<p>To<\/p>\n<p>return r-&gt;connection-&gt;client_ip;<\/p>\n<p>Line 1273 from:<\/p>\n<p>const apr_array_header_t *reqs_arr = ap_requires(r);<\/p>\n<p>To:<\/p>\n<p>const apr_array_header_t *reqs_arr = NULL;<\/p>\n<p>Line 1275 from:<\/p>\n<p>const array_header *reqs_arr = ap_requires(r);<\/p>\n<p>To:<\/p>\n<p>const array_header *reqs_arr = NULL;<\/p>\n<p>Go ahead and compile it<\/p>\n<p>apxs -c -L\/usr\/lib\/mysql -I\/usr\/include\/mysql -lmysqlclient -lm -lz mod_auth_mysql.c<\/p>\n<p>You should now be able to load the module in your httpd.conf<\/p>\n<p>nano \/etc\/httpd\/conf\/httpd.conf<\/p>\n<p>and add the following line<\/p>\n<p>LoadModule mysql_auth_module modules\/mod_auth_mysql.so<\/p>\n<p>Go ahead and restart apache<\/p>\n<p>service httpd restart<\/p>\n<p>It should restart successfully and you should be able to use mod_auth_mysql to authenticate now.<\/p>\n<p>Aug 17, 2017LinuxAdmin.io<\/p>\n<p><a href=\"https:\/\/linuxadmin.io\/install-mod_auth_mysql-apache\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>What Is Mod_Auth_Mysql? mod_auth_mysql is an Apache module used for authenticating users against a MySQL database. It is commonly used to protect items on a website via a user login prompt. The module is able to authenticate against a MySQL database to check for a valid username and password, it supports various encryption methods. You &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/10\/19\/mod_auth_mysql-installation-on-centos-7-and-apache\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Mod_auth_mysql Installation on Centos 7 and Apache&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-907","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/907","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=907"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/907\/revisions"}],"predecessor-version":[{"id":1193,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/907\/revisions\/1193"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=907"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=907"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=907"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}