XF 2.0 Upgrade error using command line upgrade

RobParker

Well-known member
[ErrorException]
[E_WARNING] file_put_contents(/home/sites/xx/public_html/internal_data/code_cache/templates/l1/s0/public/_media_site_embed_applemusic.php): failed to open stream: Permission denied

Is that an issue? I assume it's because I'm logged in as the user account but the files are owned by apache.

This seems to be stopping the upgrade completing.

It says this:
Current version: 2000170
Upgrade target: 2000170 (2.0.1)
You are already running the latest version. Rebuild the master data? [y/n] y

But the site is still stuck on:
"The site is currently being upgraded. Please check back later."
 
I ran the test migration using the command line:
1523310301474.webp

But when I log in to the test site, I get the message
An upgrade is pending. The forum is only accessible in debug mode.
Complete upgrade

When I click to do so, I get this server error:
  • ErrorException: [E_WARNING] file_put_contents(/home/sites/avforums/public_html/internal_data/code_cache/templates/l1/s0/public/_media_site_embed_applemusic.php): failed to open stream: Permission denied
  • src/vendor/league/flysystem/src/Adapter/Local.php:196
  • Generated by: Stuart Wright
  • Apr 9, 2018 at 10:39 PM
Stack trace
#0 [internal function]: XF::handlePhpError(2, '[E_WARNING] fil...', '/home/sites/avf...', 196, Array)
#1 src/vendor/league/flysystem/src/Adapter/Local.php(196): file_put_contents('/home/sites/avf...', '<?php\n// FROM H...', 2)
#2 src/vendor/league/flysystem/src/Filesystem.php(98): League\Flysystem\Adapter\Local->update('templates/l1/s0...', '<?php\n// FROM H...', Object(League\Flysystem\Config))
#3 [internal function]: League\Flysystem\Filesystem->put('templates/l1/s0...', '<?php\n// FROM H...', Object(League\Flysystem\Config))
#4 src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php(431): call_user_func_array('parent::put', Array)
#5 src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php(395): League\Flysystem\EventableFilesystem\EventableFilesystem->callFilesystemMethod('put', Array)
#6 src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php(57): League\Flysystem\EventableFilesystem\EventableFilesystem->delegateMethodCall('put', Array)
#7 [internal function]: League\Flysystem\EventableFilesystem\EventableFilesystem->put('templates/l1/s0...', '<?php\n// FROM H...', Array)
#8 src/vendor/league/flysystem/src/MountManager.php(269): call_user_func_array(Array, Array)
#9 src/vendor/league/flysystem/src/MountManager.php(179): League\Flysystem\MountManager->invokePluginOnFilesystem('put', Array, 'code-cache')
#10 src/XF/Util/File.php(113): League\Flysystem\MountManager->__call('put', Array)
#11 src/XF/Service/Template/Compile.php(132): XF\Util\File::writeToAbstractedPath('code-cache://te...', '<?php\n// FROM H...')
#12 src/XF/Service/Template/Compile.php(29): XF\Service\Template\Compile->writeCompiled(Object(XF\Entity\Template), 'code-cache://te...', 'return array('m...')
#13 src/XF/Entity/Template.php(428): XF\Service\Template\Compile->recompile(Object(XF\Entity\Template))
#14 src/XF/Mvc/Entity/Entity.php(1145): XF\Entity\Template->_postSave()
#15 src/XF/Mvc/Entity/Entity.php(1139): XF\Mvc\Entity\Entity->save(true, false)
#16 src/XF/AddOn/DataType/BbCodeMediaSite.php(85): XF\Mvc\Entity\Entity->save(true, false)
#17 src/XF/Job/AddOnData.php(108): XF\AddOn\DataType\BbCodeMediaSite->importAddOnData('XF', Object(SimpleXMLElement), 0, 7.5552520751953)
#18 src/XF/Job/Atomic.php(38): XF\Job\AddOnData->run(7.5552520751953)
#19 src/XF/Job/Manager.php(241): XF\Job\Atomic->run(8)
#20 src/XF/Job/Manager.php(187): XF\Job\Manager->runJobInternal(Array, 8)
#21 src/XF/Job/Manager.php(138): XF\Job\Manager->runJobEntry(Array, 8)
#22 src/XF/Install/Controller/AbstractController.php(24): XF\Job\Manager->runUnique('xfInstallUpgrad...', 8)
#23 src/XF/Install/Controller/Upgrade.php(251): XF\Install\Controller\AbstractController->manualJobRunner('index.php?upgra...', 'index.php?upgra...')
#24 src/XF/Mvc/Dispatcher.php(249): XF\Install\Controller\Upgrade->actionRunJob(Object(XF\Mvc\ParameterBag))
#25 src/XF/Mvc/Dispatcher.php(88): XF\Mvc\Dispatcher->dispatchClass('XF:Upgrade', 'RunJob', 'html', Object(XF\Mvc\ParameterBag), NULL, Object(XF\Install\Controller\Upgrade), NULL)
#26 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#27 src/XF/App.php(1891): XF\Mvc\Dispatcher->run()
#28 src/XF.php(328): XF\App->run()
#29 install/index.php(14): XF::runApp('XF\\Install\\App')
#30 {main}
Request state
<pre class='xdebug-var-dump' dir='ltr'>
<small>/home/sites/avforums/public_html/src/XF/Debugger.php:28:</small>
<b>array</b> <i>(size=4)</i>
'url' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#cc0000'>'/install/index.php?upgrade/run-job'</font> <i>(length=34)</i>
'referrer' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#cc0000'>'https://xf2.avforums.com/install/index.php?upgrade/run'</font> <i>(length=54)</i>
'_GET' <font color='#888a85'>=&gt;</font>
<b>array</b> <i>(size=1)</i>
'upgrade/run-job' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#cc0000'>''</font> <i>(length=0)</i>
'_POST' <font color='#888a85'>=&gt;</font>
<b>array</b> <i>(size=3)</i>
'_xfRedirect' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#cc0000'>'https://xf2.avforums.com/install/index.php?upgrade/options'</font> <i>(length=58)</i>
'_xfToken' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#cc0000'>'********'</font> <i>(length=8)</i>
'execute' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#cc0000'>'1'</font> <i>(length=1)</i>
</pre>
Sounds like a folder permissions issue?
Please help.
 
I really don’t think the CLI tools play nicely when you don’t have permissions/owner as expected. I guess that’s understandable as they were originally meant to be “experts only” but given that all big boards are now recommended to use them I really think they should be revisited and tidied up a bit (or at least have better instructions).

The problem we always run into is that our “apache” user owns the files and this gives an issue when logged in as our default user via SSH. You should be able to change permissions on the files to resolve it, that worked for us.
 
Top Bottom