Trying to upgrade PHP

General questions relating to Joomla! 3.x.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Post Reply
ross_thompson
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Mon Feb 26, 2024 6:16 pm

Trying to upgrade PHP

Post by ross_thompson » Mon Feb 26, 2024 6:36 pm

We have a Joomla 3.9.1 installation on Windows, which we are trying to upgrade. We've successfully moved from PHP 7.2 to 7.4.33 I'm currently trying to upgrade to PHP8.0 (which the Joomla website says is the preferred version, so it should work). Once we have Joomla 3.9.1 working on PHP 8, the plan is to try and upgrade to Joomla 4.

When we try to run Joomla on PHP 8, we we a 500 error and the following in the PHP error log:

Code: Select all

PHP Fatal error:  Array and string offset access syntax with curly braces is no longer supported in D:\webRoot\libraries\vendor\joomla\string\src\phputf8\utils\unicode.php on line 46
D:\webroot is the root directory for the Joomla install.

Is this a known issue? Is there something we can do to correct it? Is this a core Joomla issue, or something from a third-party vendor?

Thanks for your help.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44096
Joined: Sat Apr 05, 2008 9:58 pm

Re: Trying to upgrade PHP

Post by Webdongle » Mon Feb 26, 2024 6:55 pm

Php 8 is probably too high for J3.9.1. See viewtopic.php?f=841&t=1007536#p3715699

You will need to update Joomla then update php then update php and the database
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

User avatar
AMurray
Joomla! Exemplar
Joomla! Exemplar
Posts: 9747
Joined: Sat Feb 13, 2010 7:35 am
Location: Australia

Re: Trying to upgrade PHP

Post by AMurray » Mon Feb 26, 2024 9:23 pm

@webdongle is right.

3.9.1 was released seven years ago.

PHP 8.0 was released four years ago.

I wouldn't expect PHP 8 to run Joomla 3.9.1
Regards - A Murray
General Support Moderator

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44096
Joined: Sat Apr 05, 2008 9:58 pm

Re: Trying to upgrade PHP

Post by Webdongle » Mon Feb 26, 2024 9:52 pm

I've updated a few sites from that far back to J4/J5 and imho the method posted above is the best I've used.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30942
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Trying to upgrade PHP

Post by Per Yngve Berg » Mon Feb 26, 2024 10:17 pm

Run the normal update of Joomla to 3.10.12 first.

ross_thompson
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Mon Feb 26, 2024 6:16 pm

Re: Trying to upgrade PHP

Post by ross_thompson » Tue Feb 27, 2024 8:19 pm

Thank you for your help.

I've successfully upgraded to Joomla 3.10.12, but when I try and go from there to Joomla 4.0.0, I get 500 errors with nothing in the PHP error log.

If I'm running on PHP 8.0.30 or PHP 8.3.3, I get a 500 error on both the front-end site and the Admin page. On PHP 7.4.33 (which worked with Joomla 3.X), I get a 500 error on the front-end, but the Admin page comes up, but the only content is "An error has occurred. Call to undefined method Joomla\CMS\Application\AdministratorApplication::isSite()".

Does anyone have any idea what I can do to fix this?

Thanks again.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44096
Joined: Sat Apr 05, 2008 9:58 pm

Re: Trying to upgrade PHP

Post by Webdongle » Tue Feb 27, 2024 8:49 pm

Install Akeeba and make a backup
Follow viewtopic.php?f=841&t=1007536#p3715699
If you don't then your live site will become a mess. You may need to use the default Template after you install the site on localhost.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17445
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: Trying to upgrade PHP

Post by toivo » Tue Feb 27, 2024 9:18 pm

ross_thompson wrote:
Tue Feb 27, 2024 8:19 pm
"An error has occurred. Call to undefined method Joomla\CMS\Application\AdministratorApplication::isSite()".
The error comes from an incompatible third party plugin.

It is possible to identify the incompatible extension. Edit the file configuration.php in the main Joomla folder and update the following lines:

Code: Select all

	public $debug = true;
	public $error_reporting = 'maximum';
	public $log_everything = 1;
The error message will now identify the script and the line number where the error occurs and also display the PHP call stack. Copy and paste those messages here for advice.
Toivo Talikka, Global Moderator

ross_thompson
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Mon Feb 26, 2024 6:16 pm

Re: Trying to upgrade PHP

Post by ross_thompson » Tue Feb 27, 2024 9:51 pm

Code: Select all

Call to undefined method Joomla\CMS\Application\SiteApplication::isSite()
...\plugins\system\k2\k2.php:55
50 
51         // Load the K2 classes
52         JLoader::register('K2Table', JPATH_ADMINISTRATOR.'/components/com_k2/tables/table.php');
53         JLoader::register('K2Controller', JPATH_BASE.'/components/com_k2/controllers/controller.php');
54         JLoader::register('K2Model', JPATH_ADMINISTRATOR.'/components/com_k2/models/model.php');
55         if ($app->isSite()) {
56             K2Model::addIncludePath(JPATH_SITE.'/components/com_k2/models');
57         } else {
58             // Fix warning under Joomla 1.5 caused by conflict in model names
59             if (K2_JVERSION != '15' || (K2_JVERSION == '15' && JRequest::getCmd('option') != 'com_users')) {
60                 K2Model::addIncludePath(JPATH_ADMINISTRATOR.'/components/com_k2/models');

Code: Select all

plgSystemK2->onAfterInitialise()
...\libraries\src\Plugin\CMSPlugin.php:285
280 				}
281 
282 				// Convert to indexed array for unpacking.
283 				$arguments = \array_values($arguments);
284 
285 				$result = $this->{$methodName}(...$arguments);
286 
287 				// Ignore null results
288 				if ($result === null)
289 				{
290 					return;

Code: Select all

Joomla\CMS\Plugin\CMSPlugin->Joomla\CMS\Plugin\{closure}()
...\libraries\vendor\joomla\event\src\Dispatcher.php:486
481 				if ($event->isStopped())
482 				{
483 					return $event;
484 				}
485 
486 				$listener($event);
487 			}
488 		}
489 
490 		return $event;
491 	}

ross_thompson
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Mon Feb 26, 2024 6:16 pm

Re: Trying to upgrade PHP

Post by ross_thompson » Tue Feb 27, 2024 9:53 pm

K2 is the most recent version, v2.11.20230111, which was previously working in Joomla 3.X.

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30942
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Trying to upgrade PHP

Post by Per Yngve Berg » Tue Feb 27, 2024 10:59 pm

There is no K2 for J4.

You have to migrate K2 Articles to Core Articles.

This Extension for migration is available, but it runs on J3 only.

https://extensions.joomla.org/extension ... migration/

ross_thompson
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Mon Feb 26, 2024 6:16 pm

Re: Trying to upgrade PHP

Post by ross_thompson » Wed Feb 28, 2024 1:05 pm

OK... I don't think we actually use K2 any more; is there a way I can remove it without going through the admin tools, which are currently inaccessible? Or do I need to downgrade back to 3.10? How would I do that?

ross_thompson
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Mon Feb 26, 2024 6:16 pm

Re: Trying to upgrade PHP

Post by ross_thompson » Wed Feb 28, 2024 4:01 pm

I rolled back to a server snapshot from before the upgrade, removed K2, and re-ran the upgrade to 4.0.0.

The admin area now works fine, but the front end is giving 500 errors again.

Code: Select all

behavior::caption not found.
...\libraries\src\HTML\HTMLHelper.php:149
144 
145 			$toCall = array($service, $func);
146 
147 			if (!\is_callable($toCall))
148 			{
149 				throw new \InvalidArgumentException(sprintf('%s::%s not found.', $file, $func), 500);
150 			}
151 
152 			static::register($key, $toCall);
153 
154 			return static::call($toCall, $methodArgs);

Code: Select all

Joomla\CMS\HTML\HTMLHelper::_()
...\templates\aafes\html\com_content\featured\default.php:15
10 // no direct access
11 defined('_JEXEC') or die;
12 
13 JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
14 
15 JHtml::_('behavior.caption');
16 
17 // If the page class is defined, add to class as suffix.
18 // It will be a separate class if the user starts it with a space
19 ?>
20 <div class="blog-featured<?php echo $this->pageclass_sfx;?>">

Arguments
key	
string(22) "jhtml.behavior.caption"

Code: Select all

include()
...\libraries\src\MVC\View\HtmlView.php:429
424 			// Start capturing output into a buffer
425 			ob_start();
426 
427 			// Include the requested template filename in the local scope
428 			// (this will execute the view logic).
429 			include $this->_template;
430 
431 			// Done with the requested template; get the buffer and
432 			// clear it.
433 			$this->_output = ob_get_contents();
434 			ob_end_clean();

Arguments
0	
string(64) "D:\webRoot\templates\aafes\html\com_content\featured\default.php"

Code: Select all

Joomla\CMS\MVC\View\HtmlView->loadTemplate()
...\libraries\src\MVC\View\HtmlView.php:218
213 					'extension'  => $context
214 				]
215 			)
216 		);
217 
218 		$result = $this->loadTemplate($tpl);
219 
220 		$eventResult = $app->getDispatcher()->dispatch(
221 			'onAfterDisplay',
222 			AbstractEvent::create(
223 				'onAfterDisplay',

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17445
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: Trying to upgrade PHP

Post by toivo » Wed Feb 28, 2024 8:50 pm

Code: Select all

Joomla\CMS\HTML\HTMLHelper::_()
...\templates\aafes\html\com_content\featured\default.php:15
The error comes from a template override that is not compatible with Joomla 4. Does the template 'aafes' have a version compatible with Joomla 4?

Rename the override folder templates/aafes/html/com_content into com_content-bad or similar, or delete that folder. If the template has other problems, use Cassiopeia or install a new Joomla 4 template.
Toivo Talikka, Global Moderator

ross_thompson
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Mon Feb 26, 2024 6:16 pm

Re: Trying to upgrade PHP

Post by ross_thompson » Wed Feb 28, 2024 9:14 pm

OK, thanks for this. The AAFES template would have been built in-house by my predecessor, and there's no reason they would have created a Joomla4 version.

Switching to Cassiopea works, in that I don't get a 500 error, but I only get a header bar that says "Casseopea" and two links for "Home" and "Login".

The Home link gives me a 404 error with "Component not found", and the Login link gives me a 500 error with "Class 'JRequest' not found".

I'm starting to think that upgrading past Joomla 3.10.12 / PHP 7.4.33 is simply not going to work for us.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44096
Joined: Sat Apr 05, 2008 9:58 pm

Re: Trying to upgrade PHP

Post by Webdongle » Wed Feb 28, 2024 9:42 pm

ross_thompson wrote:
Wed Feb 28, 2024 9:14 pm
...
I'm starting to think that upgrading past Joomla 3.10.12 / PHP 7.4.33 is simply not going to work for us.
Webdongle wrote:
Tue Feb 27, 2024 8:49 pm
Install Akeeba and make a backup
Follow viewtopic.php?f=841&t=1007536#p3715699
If you don't then your live site will become a mess. You may need to use the default Template after you install the site on localhost.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17445
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: Trying to upgrade PHP

Post by toivo » Wed Feb 28, 2024 9:51 pm

When you changed the default template to Cassiopeia, the names of the old template positions are not found. Edit each module and assign them to the template positions available in Cassiopeia.

The login link may be pointing to a third party component or the page has a third party module that is incompatible with Joomla 4. Check the JED and the websites of the developers of the third party extensions, if there is a Joomla 4 compatible version of the third party extension.

Turn on the option 'Debug System' in Global Configuration to find out where the 404 or 500 error occur. Post the messages and the PHP call stack here.

Post also the results from the Forum Post Assistant (FPA) by following the instructions at https://forumpostassistant.github.io/docs/ so that the configuration can be reviewed.
Toivo Talikka, Global Moderator

ross_thompson
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Mon Feb 26, 2024 6:16 pm

Re: Trying to upgrade PHP

Post by ross_thompson » Wed Mar 13, 2024 1:00 pm

OK, I've had to work on other stuff for a while, but I'm getting back to this now.

I have Joomla 4.0.0 running on PHP 8.0.30. The Admin side runs fine, the front end is giving a MissingComponentException. I've tried using our in-house template (built for Joomla 3, the default Cassiopeia template, and a third-party template (https://www.joomlart.com/joomla/templates/ja-simpli) with no difference, so I'm pretty sure it's not a template issue.

Presumably there's a component it's looking for that isn't there. Any idea how I could track that down?

Code: Select all

Component not found.
...\libraries\src\Component\ComponentHelper.php:325
320 			|| $lang->load('tpl_' . $template, JPATH_THEMES . "/$template");
321 		}
322 
323 		if (empty($option))
324 		{
325 			throw new MissingComponentException(Text::_('JLIB_APPLICATION_ERROR_COMPONENT_NOT_FOUND'), 404);
326 		}
327 
328 		if (JDEBUG)
329 		{
330 			Profiler::getInstance('Application')->mark('beforeRenderComponent ' . $option);

Code: Select all

Joomla\CMS\Component\ComponentHelper::renderComponent()
...\libraries\src\Application\SiteApplication.php:206
201 		else
202 		{
203 			$document->setGenerator('Joomla! - Open Source Content Management');
204 		}
205 
206 		$contents = ComponentHelper::renderComponent($component);
207 		$document->setBuffer($contents, 'component');
208 
209 		// Trigger the onAfterDispatch event.
210 		PluginHelper::importPlugin('system');
211 		$this->triggerEvent('onAfterDispatch');
Arguments
option	
NULL

Code: Select all

Joomla\CMS\Application\SiteApplication->dispatch()
...\libraries\src\Application\SiteApplication.php:245
240 		 * ex: due of the sef urls
241 		 */
242 		$this->checkUserRequireReset('com_users', 'profile', 'edit', 'com_users/profile.save,com_users/profile.apply,com_users/user.logout');
243 
244 		// Dispatch the application
245 		$this->dispatch();
246 
247 		// Mark afterDispatch in the profiler.
248 		JDEBUG ? $this->profiler->mark('afterDispatch') : null;
249 	}
250 

Code: Select all

Joomla\CMS\Application\SiteApplication->doExecute()
...\libraries\src\Application\CMSApplication.php:278
273 			$this->sanityCheckSystemVariables();
274 			$this->setupLogging();
275 			$this->createExtensionNamespaceMap();
276 
277 			// Perform application routines.
278 			$this->doExecute();
279 
280 			// If we have an application document object, render it.
281 			if ($this->document instanceof \Joomla\CMS\Document\Document)
282 			{
283 				// Render the application output.


Post Reply

Return to “General Questions/New to Joomla! 3.x”