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.
Locked
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!

deleted user

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

Post by deleted user » 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.

User avatar
imanickam
Joomla! Master
Joomla! Master
Posts: 28193
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 | Joomla! Core - Tamil (தமிழ்) Translation Team Coordinator
Former Joomla! Translations Coordination Team Lead
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! Champion
Joomla! Champion
Posts: 5886
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: 17353
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

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

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! Explorer
Joomla! Explorer
Posts: 262
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.

wizzits
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Thu Apr 19, 2012 6:18 pm

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

Post by wizzits » Wed Mar 04, 2020 5:44 pm

I Just tried to convert the PHP code on an old Joomla 1.5 to run on PHP 7, and gave up. the getValue code above was excellent, I was able to get past JERROR on the database, I had even converted the JUser class to be truly dynamic, but every fix led to more questions and problems. So after around five hours of this, I spun up an Amazon EC2 running their oldest available AMI (probably will be unavailable after December 2020) and it had PHP 5.6 in the repository. This took an hour, but I am a lot more comfortable with this.

The problem with J1.5 is that PHP at the time was still getting acclimated to class and object, and the Joomla team was (mostly) using a class as a static set of functions. These days, we are far ahead of that in PHP using a class as a truly dynamic object of data and methods. They did a little of that, and PHP had some kludginess that made it work prior to 7.0 - I specifically converted JUser to a dynamic class, but I had to instantiate in the index.php and pass it with $GLOBAL['JoomUser']->method() which is pretty kludgy too.

So I ripped it all up and provisioned EC2 running 5.6 - done.

I think a good developer could finish the conversion in a couple of weeks. But to what end? I pay developers between $50 and $200 an hour. That's why I looked at this myself before delegating the job. I am not going to pay $10k to get a buggy version of Joomla, when the Joomers have a really good version to which I can apply the money as an upgrade.

Anyhow, I have bought myself another year with the EC2 instance, there are some hosting costs, but the site is up and running.


Locked

Return to “Administration 1.5”