XF 1.3 Error: vBulletin 3.8 - Import Attached Files


that the import of vbulletin could be so problematic I did not imagend. We want to import a small vBulletin 3.8.7 to Xenforo. All Importers now have worked, till "Import Attached Files".

We have startet with a new xenforo installation, no content - only one admin-user. The attached files are saved in the database.

If we click "Import Attached Files" I get this errors:

Server Error
Mysqli statement execute error : Duplicate entry '1' for key 'PRIMARY'

  1. Zend_Db_Statement_Mysqli->_execute() in Zend/Db/Statement.php at line 297
  2. Zend_Db_Statement->execute() in Zend/Db/Adapter/Abstract.php at line 479
  3. Zend_Db_Adapter_Abstract->query() in Zend/Db/Adapter/Abstract.php at line 574
  4. Zend_Db_Adapter_Abstract->insert() in XenForo/DataWriter.php at line 1624
  5. XenForo_DataWriter->_insert() in XenForo/DataWriter.php at line 1613
  6. XenForo_DataWriter->_save() in XenForo/DataWriter.php at line 1405
  7. XenForo_DataWriter->save() in XenForo/Model/Import.php at line 1890
  8. XenForo_Model_Import->importAttachment() in XenForo/Model/Import.php at line 1936
  9. XenForo_Model_Import->importPostAttachment() in XenForo/Importer/vBulletin.php at line 3043
  10. XenForo_Importer_vBulletin->stepAttachments() in XenForo/Importer/Abstract.php at line 97
  11. XenForo_Importer_Abstract->runStep() in XenForo/ControllerAdmin/Import.php at line 187
  12. XenForo_ControllerAdmin_Import->_runStep() in XenForo/ControllerAdmin/Import.php at line 239
  13. XenForo_ControllerAdmin_Import->_startStep() in XenForo/ControllerAdmin/Import.php at line 182
  14. XenForo_ControllerAdmin_Import->actionStartStep() in XenForo/FrontController.php at line 347
  15. XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
  16. XenForo_FrontController->run() in /var/www/vhosts/acer-userforum.de/httpdocs/admin.php at line 13
[Sat Jun 07 10:12:25 2014] [error] [client] Premature end of script headers: cgi_wrapper, referer:

Can someone help me to solve the problem?



XenForo developer
Staff member
The premature end of script headers may be relevant - it sounds like PHP may have crashed, but after the first attachment(s) were in the database.

Your best bet to continue is to look in the database at the xf_attachment table and remove any row with an ID greater than or equal to the ID in that error. (If it's 1, then you can just empty the whole xf_attachment table.)

I have removed all data from xf_attachment and xf_attachment_data table. After that I clicked again on "Import Attached Files". Than I got this error:

500 Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator to inform of the time the error occurred and of anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Web Server at domain.com

[Sat Jun 07 12:12:38 2014] [error] [client] Premature end of script headers: cgi_wrapper, referer:

Any more Ideas? Or do I have to move the attachments first from database to filesystem?


Jake Bunce

XenForo moderator
Staff member
HTTP 500 is an error returned by the server itself. Ideally the logs on the server will have more information about the error (contact your host or server person).

The "duplicate entry" error can also be caused by the following:

1) You are importing into a "not fresh" installation of XenForo (some one has posted at least one attachment) and you have enabled the import option to preserve the source ids (requires fresh installation).

2) An id collision in the source data (vBulletin).

I suggest investigating the HTTP 500 error with your host or server person first though.


XenForo developer
Staff member
I think that PHP is crashing at some point which is causing that 500 ISE. It will have imported a few attachments before that happened.

Unfortunately, it may be a bit difficult to figure out why it crashed. It could be a memory limit, as large attachments can require a fair amount of memory to process. (This is likely not PHP's own memory limit, but something outside it.)