1
votes

I am deploying a TYPO3 6.2 project with (current master of) Surf. Both EXT:typo3_console (1.1.8) and EXT:coreapi (1.3.0) are installed (in the most current compatible versions) and activated in the TYPO3 project.

Unfortunatelly I get an error when requesting the successfully deployed project in the browser:

Fatal error: Cannot redeclare class tx_pdfcreator2 in /var/www/vhosts/preview/htdocs/releases/20161122165450/Web/typo3conf/ext/pdf_creator2/class.tx_pdfcreator2.php on line 37

After clearing the Opcode Cache in TYPO3's Install Tool the TYPO3 instance works again.

Clearing the Opcode Cache via EXT:coreapi does not solve the problem although the output on the console is "The complete opcode cache has been cleared".

This is the output Surf generates:

Deploying preview (20161122165450)
Stage initialize
Webserver 001 (Project_001) TYPO3\Surf\Task\CreateDirectoriesTask
Webserver 001 (Project_001) TYPO3\Surf\Task\Generic\CreateDirectoriesTask
Stage package
Webserver 001 (Project_001) TYPO3\Surf\Task\Package\GitTask
Webserver 001 (Project_001) Foo\Deployment\Task\LocalInstallTask
Stage transfer
Webserver 001 (Project_001) TYPO3\Surf\Task\Transfer\RsyncTask
Webserver 001 (Project_001) TYPO3\Surf\Task\Generic\CreateSymlinksTask
Webserver 001 (Project_001) TYPO3\Surf\Task\TYPO3\CMS\CreatePackageStatesTask
Stage update
Webserver 001 (Project_001) TYPO3\Surf\Task\TYPO3\CMS\SymlinkDataTask
Webserver 001 (Project_001) TYPO3\Surf\Task\TYPO3\CMS\CopyConfigurationTask
Stage migrate
Webserver 001 (Project_001) TYPO3\Surf\Task\TYPO3\CMS\SetUpExtensionsTask
Webserver 001 (Project_001) TYPO3\Surf\Task\TYPO3\CMS\CompareDatabaseTask
Stage finalize
Stage test
Stage switch
Webserver 001 (Project_001) TYPO3\Surf\Task\SymlinkReleaseTask
Node "Webserver 001" is live!
Webserver 001 (Project_001) TYPO3\Surf\Task\TYPO3\CMS\FlushCachesTask
Stage cleanup
Webserver 001 (Project_001) TYPO3\Surf\Task\CleanupReleasesTask
Removing releases 20161117180245

Any idea what went wrong here and how I could solve the problem?

2

2 Answers

3
votes

To clear opcode caches with surf you need to add the WebOpcacheResetCreateScriptTask and WebOpcacheResetExecuteTask tasks to your workflow.

Clearing opcode caches on cli with coreapi will do nothing. See http://insight.helhum.io/post/142295674970/what-you-need-to-know-about-php-opcode-cache for a detailed explenation

1
votes

Using the Surf tasks \TYPO3\Surf\Task\Php\WebOpcacheResetCreateScriptTask and \TYPO3\Surf\Task\Php\WebOpcacheResetExecuteTask (which come with Surf) instead of EXT:coreapi worked for me!

$workflow->addTask(WebOpcacheResetCreateScriptTask::class, 'package', $this);
$workflow->addTask(WebOpcacheResetExecuteTask::class, 'switch', $this);