Joomla 1.5 on PHP7 = JError Unable to load Database Driver

Need help with the Administration of your Joomla! 1.5 site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Post Reply
GTAlex
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Fri Mar 03, 2017 9:05 am

Joomla 1.5 on PHP7 = JError Unable to load Database Driver

Post by GTAlex » Fri Mar 03, 2017 9:08 am

Joomla 1.5 on PHP7

dbtype = "mysqli"
"JError Unable to load Database Driver"

try dbtype = "mysqli"
again
"JError Unable to load Database Driver"


help!

mbabker
Joomla! Hero
Joomla! Hero
Posts: 2177
Joined: Sun Feb 28, 2010 8:26 pm

Re: Joomla 1.5 on PHP7 = JError Unable to load Database Driver

Post by mbabker » Fri Mar 03, 2017 1:29 pm

1.5 is not compatible with PHP 7. The last version it was actually compatible with without PHP warnings is PHP 5.3; it will run OK on 5.4 (and supposedly 5.5, I'm not sure on 5.6) but you will need to turn off error reporting because the platform will emit a lot of strict standards warnings due to its PHP 4 compatibility. You will need to downgrade PHP.
So long and thanks for all the fish.

Manually updating Joomla? See https://gist.github.com/mbabker/d7bfb4e ... 3607f89281

User avatar
imanickam
Joomla! Master
Joomla! Master
Posts: 27040
Joined: Wed Aug 13, 2008 2:57 am
Location: Chennai, India

Re: Joomla 1.5 on PHP7 = JError Unable to load Database Driver

Post by imanickam » Fri Mar 03, 2017 1:43 pm

I doubt whether Joomla! 1.5 will run on PHP 7. As you would notice from the document https://docs.joomla.org/Joomla_1.5_won' ... on_PHP_5.4 Joomla! 1.5 will not even work on PHP 5.4.

Be known that Joomla! 1.5 is no longer supported. The last version of Joomla! 1.5 is 1.5.26. In addition, there are two security hot fixed after v1.5.26.


Note:
As Joomla! 1.5 is no longer supported, you must plan to upgrade your site to Joomla! 3.6.5 (which is the latest version at present). Do the upgrade/migration in a test environment before attempting to upgrade the production live site.
Ilagnayeru (MIG) Manickam | இளஞாயிறு மாணிக்கம்
Joomla! - Global Moderators Team | Translations Coordination Team | Tamil (தமிழ்) Translation Team

Eegan - Support the poor and underprivileged

ocelot_pl
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Mon Jul 02, 2018 11:15 am

Re: Joomla 1.5 on PHP7 = JError Unable to load Database Driver

Post by ocelot_pl » Mon Jul 02, 2018 11:37 am

I know that Joomla 1.5 is not supported on PHP 7, but easier for me was to adopt it to PHP 7.1 than convert the whole site. ;)

You need to do a few small modifications:

1) Type in config files 'mysqli' instead of 'mysql'
configuration.php
libraries/joomla/config.php - update here fields with database settings: connection, username, password, etc

2) Modify the file includes\framework.php

Code: Select all

@set_magic_quotes_runtime( 0 );
change to

Code: Select all

if(version_compare(PHP_VERSION, '5.3.0', '<')) 
{
  @set_magic_quotes_runtime( 0 ); 
}
or if you are not going to come back to the previous version of PHP, you can comment the line, or delete it

Code: Select all

//@set_magic_quotes_runtime( 0 );
Find all other instances of this function in .php files and do the same.
In my project I had to do the same in the following files:

Code: Select all

administrator/includes/framework.php 
includes/framework.php 
plugins/editors/xstandard/attachmentlibrary.php
plugins/editors/xstandard/directory.php 
plugins/editors/xstandard/imagelibrary.php
...
3) Modify the function in the file
libraries/joomla/registry/registry.php

Code: Select all

	/**
	 * Get a registry value
	 *
	 * @access	public
	 * @param	string	$regpath	Registry path (e.g. joomla.content.showauthor)
	 * @param	mixed	$default	Optional default value
	 * @return	mixed	Value of entry or null
	 * @since	1.5
	 */
	function getValue($regpath, $default=null)
	{
		// Initialise variables.
		$result = $default;

		if (!strpos($regpath, '.'))
		{
			return (isset($this->data->$regpath) && $this->data->$regpath !== null && $this->data->$regpath !== '') ? $this->data->$regpath : $default;
		}
		// Explode the registry path into an array
		$nodes = explode('.', $regpath);

		// Get the namespace
		//$namespace = array_shift($nodes);
		$count = count($nodes);
		if ($count < 2) {
			$namespace = $this->_defaultNameSpace;
			$nodes[1]  = $nodes[0];
		} else {
			$namespace = $nodes[0];
		}

		// Initialize the current node to be the registry root.
		//$node = $this->data;
		$node = $this->_registry[$namespace]['data'];

		$found = false;
		$skip_first = true;

		// Traverse the registry to find the correct node for the result.
		foreach ($nodes as $n)
		{

			if(!$skip_first)
			{
				if (isset($node->$n))
				{
					$node = $node->$n;
					$found = true;
				}
				else
				{
					$found = false;
					break;
				}
			}

			$skip_first = false;
		}
		if ($found && $node !== null && $node !== '')
		{
			$result = $node;
		}

		return $result;
	}
4) Modify the function in the file
administrator/components/com_joomlastats/count.classes.php

Code: Select all

			if( ereg( '([a-zA-Z])', $xt ) ) {
replace with:

Code: Select all

			if( preg_match( '([a-zA-Z])', $xt ) ) {
5) To reduce the number of warnings in the error_log file you can add the following line at the beginning of the index.php file:

Code: Select all

error_reporting(E_ALL ^ (E_NOTICE | E_WARNING | E_DEPRECATED));
After this changes, I ran my Joomla 1.5 website on PHP 7.1 successfully.

Let the force be with you.
;)

UroAtienza
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Wed Feb 06, 2008 2:26 am

Re: Joomla 1.5 on PHP7 = JError Unable to load Database Driver

Post by UroAtienza » Thu Feb 14, 2019 8:16 am

Hi ocelot,
I tried to implement your steps but at the end I got the following message,

Database Error: Unable to connect to the database:The MySQL adapter "mysql" is not available.

Will appreciate if you can help on this...

Thanks in advance.

gws
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 3771
Joined: Tue Aug 23, 2005 1:56 pm
Location: South coast, UK
Contact:

Re: Joomla 1.5 on PHP7 = JError Unable to load Database Driver

Post by gws » Thu Feb 14, 2019 9:38 am

UroAtienza wrote:
Thu Feb 14, 2019 8:16 am
Hi ocelot,
I tried to implement your steps but at the end I got the following message,

Database Error: Unable to connect to the database:The MySQL adapter "mysql" is not available.

Will appreciate if you can help on this...

Thanks in advance.
You need to use MySqli not MySql .

desklamp
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Fri Feb 22, 2019 10:14 pm

Re: Joomla 1.5 on PHP7 = JError Unable to load Database Driver

Post by desklamp » Fri Feb 22, 2019 11:19 pm

ocelot_pl -- That was fantastic. However, my site can't seem to find it's own Joomla library files.

Here are some errors I'm getting:
PHP Fatal error: Uncaught Error: Class 'JRequest' not found in /libraries/joomla/import.php
PHP Fatal error: Uncaught Error: Class 'JVersion' not found in /libraries/joomla/import.php
PHP Fatal error: Uncaught Error: Class 'JFactory' not found in /index.php
PHP Fatal error: Uncaught Error: Class 'JApplication' not found in /libraries/joomla/factory.php
PHP Fatal error: Class 'JObject' not found in /libraries/joomla/application/application.php

Any ideas?

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 11028
Joined: Thu Feb 15, 2007 5:48 am
Location: Oxford, UK

Re: Joomla 1.5 on PHP7 = JError Unable to load Database Driver

Post by toivo » Sat Feb 23, 2019 7:03 am

Modifications to the Joomla! core are not supported at this forum. Joomla 1.5 is very old and vulnerable. Upgrading can involve a lot of work and require an expert to do the migration, but it is far better in the long run to have migrated, than struggle with core modifications and unsupported third party templates and other extensions.
Toivo Talikka, Global Moderator
troubleshooting smtp and other articles http://talikka.com/joomla

desklamp
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Fri Feb 22, 2019 10:14 pm

Re: Joomla 1.5 on PHP7 = JError Unable to load Database Driver

Post by desklamp » Sat Feb 23, 2019 7:53 am

I'm not trying to modify the Joomla core, but instead I'm only trying to fix the problem. The goal is to get Joomla 1.5 to work with PHP 7.

I'm guessing a deprecated function, like ereg, is causing Joomla to not find its own core files. If I fix that, then I get it all back (I hope).

So my question is this:
- What change (from PHP 5 to PHP 7) would cause Joomla to not find its own files?

frostmakk
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 158
Joined: Sun Dec 28, 2014 9:30 am
Location: Stavanger, Norway

Re: Joomla 1.5 on PHP7 = JError Unable to load Database Driver

Post by frostmakk » Sat Feb 23, 2019 8:38 am

desklamp wrote:
Sat Feb 23, 2019 7:53 am
The goal is to get Joomla 1.5 to work with PHP 7.
And figure out all the vulnerabilities and patch them too, without introducing new ?
As a pure academic exercise you will learn a lot from an undertaking like this, but to most of the users in this forum it is a pointless task. I don't expect many people would waste their time helping you on this one.
Good luck whipping a dead horse.

desklamp
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Fri Feb 22, 2019 10:14 pm

Re: Joomla 1.5 on PHP7 = JError Unable to load Database Driver

Post by desklamp » Sat Feb 23, 2019 3:45 pm

frostmakk wrote:
Sat Feb 23, 2019 8:38 am
desklamp wrote:
Sat Feb 23, 2019 7:53 am
The goal is to get Joomla 1.5 to work with PHP 7.
And figure out all the vulnerabilities and patch them too, without introducing new ?
As a pure academic exercise you will learn a lot from an undertaking like this, but to most of the users in this forum it is a pointless task. I don't expect many people would waste their time helping you on this one.
Good luck whipping a dead horse.
ocelot_pl already did it, and wrote instructions (above).

I'm just trying to do the same, but I'm running into problems.


Post Reply

Return to “Administration 1.5”