Jul 04

Joomla site error after changing account’s username

When renaming cpanel username of a Joomla site, please note that that only changes in cPanel related settings and the database name. The change never make any effect on the 3rd party softwares the site is using. That is the username wont be changed automatically in the Joomla configuration file. We need to change the username manually in the “configuration.php” file of Joomla.

The following error we get sometimes after changing account’s username and when the change not automatically made in Joomla configuration file.

========================
*Warning*: require_once()
[function.require-once]:
open_basedir restriction in effect.
File(/home/oldusername/public_html//includes/version.php) is not within the
allowed path(s): (/home/newusername:/usr/lib/php:/usr/local/lib/php:/tmp) in *
/home/newusername/public_html/includes/joomla.php* on line *71*
========================

In above it is clear that, because of old username entry in Joomla config file, when we try to load up the site, Joomla seeks for the olduser and found it doesn’t exist inside anywhere in the public_html directory of site. So it finally tries to jump outside of the home user directory and for to search the user outside of it. But the PHP open_basedir restriction wont allow it to go outside of the public_html directory and errors generates when we load the site on browser.

To rectify this, please manually change to new username in the Joomla configuration file too.

If you are still facing the database connecting issue when loading site, then got to check your site’s database. May be it still contains old username as starting name for tables in it. You need to rename them all.

For that, following the below steps:
#cd /var/lib/mysql
#mysqldump user_db > user_db.sql
#replace oldusername newusername — user_db.sql
#mysqladmin drop user_db
#mysqladmin create user_db
#mysql user_db < user_db.sql

Your site will be loading fine for sure 🙂

Leave a Reply

Your email address will not be published.