Joomla | Database Error: The PHP `ext/mysql` extension is removed in PHP 7, cannot use the `mysql` driver

This error shows up when you change/upgrade the PHP version of your Joomla website to PHP 7.XX.

This is because the mysql extension is removed in PHP 7. You may need to change all those functions in PHP code to mysqli_* instead of mysql_* if you want to use PHP 7 for your Joomla website.

In cPanel EasyApache 4, the mysqli extension is provided by the mysqlnd package.

For example:

root@server [~]# rpm -qa | grep ea-php7 | grep mysqlnd
ea-php70-php-mysqlnd-7.0.33-9.9.1.cpanel.x86_64
ea-php71-php-mysqlnd-7.1.30-4.4.1.cpanel.x86_64
ea-php72-php-mysqlnd-7.2.20-3.3.1.cpanel.x86_64

Subdomain not inheriting PHP version of the main domain | Litespeed issue on cPanel

As you know, in cPanel Multi PHP Manager platform, it does support the ‘inherit’ method between the addon domains/subdomains and its main/primary domain.

When you set an Addon domain(if down to the level of main domain’s document root) or Subdomain to use the Inherit option, Apache uses the PHP version that exists in the first .htaccess file that it finds in the domain’s file structure. If the system cannot find a .htaccess file on the top-level domain’s file structure, Apache then uses the system default PHP version for the addon domain or subdomain.

Refer here https://documentation.cpanel.net/display/EA4/PHP+Inheritance

According to the cPanel:
The main domain example.dom default document root is /home/USER/public_html and subdomain sub.example.com should by default be created as /home/USER/public_html/sub

Here on the problematic account, the user had set that like, main domain example.com to /home/USER/public_html and subdomain sub.example.com to /home/USER/public_html/addons/sub

Even if that is the case, according to cPanel PHP inherit feature, when apache looks up for the PHP version of the subdomain, it finds PHP inherit setting and it traverses N’th levels above to find parent .htaccess file with PHP version in it. Once it finds the parent .htaccess file with PHP version in it, the Apache inherits the same PHP version for the subdomain itself.

Here, in this case, subdomain was not inheriting PHP version of the main domain working with Litespeed web server. This is because LiteSpeed only reads 1 level above the Document Root of a subdomain. Means here, the subdomain document root the user set was /home/USER/public_html/addons/sub and main domain /home/USER/public_html, so the Litespeed webserver was traversing only maximum of one level above, ie the folder “sub -> addons”. Hence, the PHP version from the main domain wont apply.

The solution for PHP inherit to work in such cases is, you can configure the same main domain PHP version in /home/USER/public_html/addon/.htaccess manually and it would apply to sub.example.com as well. Else, apply the same PHP version to the subdomain sub.example.com through cPanel > Multi PHP Manager or CloudLinux Selector PHP(if your server is running on CloudLinux).

cPanel domlogs/Webserver Access logs are showing only local server IP addresses

This happens when we have a reverse proxy Nginx->Apache set up on the server. To be precise, when the Apache based website is behind the reverse proxy(Nginx). In such cases, we may see the accessing IPs on the website access logs as server’s local IP address itself. This behavior is because the reverse proxy or load balancer acts as client to Apache and the Apache sees the internal IP address on its website access log. This doesn’t help an administrator to track down real client IP addresses that access from the outside world.

We can use mod_rpaf module in this case for the Apache.

My machine here is a Centos/cPanel system.

cd /root
wget https://github.com/y-ken/mod_rpaf/archive/master.zip
unzip master.zip

Now compile it

cd mod_rpaf-master/
apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c

Finally, add the module to install Mod_rpaf on cPanel

LoadModule rpaf_module modules/mod_rpaf-2.0.so
<IfModule mod_rpaf-2.0.c>
RPAFenable On
RPAFsethostname On
RPAFproxy_ips 127.0.0.1 xx.xx.xx.xx
</IfModule>

Restart Apache to apply the changes:

service httpd restart

A good replacement for mod_rpaf is mod_remoteip which can be installed via Easyapache itself on the cPanel servers.

Legacy filter_module syntax causing 500 error in apache 2.4

Hey, sometimes you may come up with the following error in error log which is actually causing by legacy filter_module syntax on the htaccess file.


======================
[Sun Oct 06 18:20:24.119633 2013] [core:alert] [pid 47884] [client 5.x.x.x:54039] /home/user/public_html/.htaccess: FilterProvider takes three arguments, filter-name provider-name match-expression
[Sun Oct 06 18:20:31.705923 2013] [core:alert] [pid 48315] [client 157.x.x.x:46020] /home/user/public_html/.htaccess: FilterProvider takes three arguments, filter-name provider-name match-expression
[Sun Oct 06 18:20:31.707094 2013] [core:alert] [pid 48315] [client 157.x.x.x:46020] /home/user/public_html/.htaccess: FilterProvider takes three arguments, filter-name provider-name match-expression
======================

Probably the apache version is 2.4 in your server and it wont take the legacy filter_module syntax. You should need to make some changes in it. For example my users filter_module rules were as follows in his .htaccess file.


FilterDeclare COMPRESS
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/json
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xhtml+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/rss+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject
FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $image/x-icon
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf
FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype
FilterChain COMPRESS
FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no

I changed it to


FilterDeclare COMPRESS
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/html'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/css'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/plain'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/x-component'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/javascript'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/json'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/xhtml+xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/rss+xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/atom+xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/vnd.ms-fontobject'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'image/svg+xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'image/x-icon'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/x-font-ttf'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'font/opentype'"
FilterChain COMPRESS
FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no

The error has gone then 🙂