Friday, July 24, 2020

Wordpress warning: Use of undefined constant WP_CONTENT_DIR

After upgrading PHP from version 5 to 7 on my shared hosting server, I've got the following error on my wordpress sites:

Warning: Use of undefined constant WP_CONTENT_DIR - assumed 'WP_CONTENT_DIR' (this will throw an Error in a future version of PHP).
Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0



As an workaround, I added the following on the wp-config.php before the call to wp-settings.php:
define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );



Wordpress error - MySQL extension error after PHP upgrade

When I tried to update PHP version on my shared hosting server from PHP5 to PHP7, my wordpress sites started to give the following error:

Your PHP installation appears to be missing the MySQL extension which is required by WordPress.


To solve it, I had to update the .htaccess file in public_html folder with the following line:

AddHandler application/x-httpd-ea-php73 .php .php7 .phtml