Page 1 of 1

Joomla 1.5 on PHP7 = JError Unable to load Database Driver

Posted: Fri Mar 03, 2017 9:08 am
by GTAlex
Joomla 1.5 on PHP7

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

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


help!

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

Posted: Fri Mar 03, 2017 1:29 pm
by mbabker
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.

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

Posted: Fri Mar 03, 2017 1:43 pm
by imanickam
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.

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

Posted: Mon Jul 02, 2018 11:37 am
by ocelot_pl
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.
;)

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

Posted: Thu Feb 14, 2019 8:16 am
by UroAtienza
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.

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

Posted: Thu Feb 14, 2019 9:38 am
by gws
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 .

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

Posted: Fri Feb 22, 2019 11:19 pm
by desklamp
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?

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

Posted: Sat Feb 23, 2019 7:03 am
by toivo
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.

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

Posted: Sat Feb 23, 2019 7:53 am
by desklamp
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?

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

Posted: Sat Feb 23, 2019 8:38 am
by frostmakk
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.

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

Posted: Sat Feb 23, 2019 3:45 pm
by desklamp
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.