osTicket / osTicket-plugins

Core plugins for osTicket (v1.8+)
GNU General Public License v2.0
149 stars 162 forks source link

[Error] Unable to migrate the files from database to S3 #246

Open vzan2012 opened 2 years ago

vzan2012 commented 2 years ago

Hello, I'm using the lower version of S3 plugin.

php manage.php file migrate --backend D --to 3

When I execute this command, I get an error.

I couldn't able to resolve this error.

Please help me in resolving the issue.

image
JediKev commented 2 years ago

@vzan2012

What is your version of osTicket? What version of PHP are you using? What "lower version" of the S3 Plugin are you referring to? Are you using an official build of the plugin (storage-s3.phar) or using an un-PHARed version or version from Git?

Cheers.

vzan2012 commented 2 years ago

Hello @JediKev ,

Yes, I'm using an OsTicket version v1.15.1 PHP 7.2.34

S3 Plugin - Version - 0.2.1 (from Git)

I'm able to insert images (from OsTicket) to the bucket successfully using this plugin. I'm performing the migration of existing files to the bucket. But the migration fails :(

vzan2012 commented 1 year ago

👋 @JediKev I think that the exception raises from this section of code...

image
JediKev commented 1 year ago

@vzan2012

Sounds like you didn’t hydrate the plugin. When downloading raw plugins you must first hydrate them to download and setup the dependencies. You will need to follow the instructions listed in this repo's README file:

Cheers.

vzan2012 commented 1 year ago

@JediKev

Yes, Now I have hydrated the plugin and executed the steps as you mentioned.

But still getting the same error :(

JediKev commented 1 year ago

@vzan2012

You are using an old version of osTicket and old version of the plugin so I would encourage you to upgrade to the latest 1.15.x release and retest. If that fails then I would encourage you to download the plugin appropriate for your version from our downloads page on our website.

Cheers.

vicman commented 2 months ago

I am using osticket version 1.17.2, the plugin works correctly, now I want to migrate the file history to S3, but it shows me the following error:

osTicket# php manage.php file migrate --backend D --to 3
PHP Fatal error:  Uncaught Error: Call to undefined function mysqli_init() in /var/www/html/osTicket/include/mysqli.php:28
Stack trace:
#0 /var/www/html/osTicket/bootstrap.php(205): db_connect()
#1 /var/www/html/osTicket/include/cli/modules/file.php(56): Bootstrap::connect()
#2 /var/www/html/osTicket/include/class.cli.php(240): FileManager->run()
#3 /var/www/html/osTicket/manage.php(70): Module->_run()
#4 /var/www/html/osTicket/include/class.cli.php(240): Manager->run()
#5 /var/www/html/osTicket/manage.php(79): Module->_run()
#6 {main}
  thrown in /var/www/html/osTicket/include/mysqli.php on line 28
JediKev commented 2 months ago

@vicman

This is not an osTicket issue; rather a server issue/user error. It appears as though your php command is pointing to a different version of PHP than what your osTicket site is running and/or is missing the mysqli extension. First run php --version and confirm it shows the right version. If not then you should find the appropriate command that points to the correct version. When in doubt, check with your hosting provider and/or server admin.

If it is showing the correct version then it’s definitely missing the mysqli extension. To resolve that you would need to install and enable the PHP mysqli extension. There are guides online that will explain how to do so for your specific server and PHP version.

Cheers.

vicman commented 2 months ago

@vicman

This is not an osTicket issue; rather a server issue/user error. It appears as though your php command is pointing to a different version of PHP than what your osTicket site is running and/or is missing the mysqli extension. First run php --version and confirm it shows the right version. If not then you should find the appropriate command that points to the correct version. When in doubt, check with your hosting provider and/or server admin.

If it is showing the correct version then it’s definitely missing the mysqli extension. To resolve that you would need to install and enable the PHP mysqli extension. There are guides online that will explain how to do so for your specific server and PHP version.

Cheers.

Hello friend, thanks for replying. I get this when I run the command php -v

osTicket# php -v
PHP 8.3.1 (cli) (built: Dec 21 2023 20:11:48) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.1, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.1, Copyright (c), by Zend Technologies
JediKev commented 2 months ago

@vicman

Precisely as I suspected, that version of PHP (8.3.x) does not match the version of PHP your osTicket site is running. You would need to reach out to your server admin and/or hosting provider and have them provide you with the correct PHP executable that points to the appropriate version of PHP. Once you have that you can retest the migrate command using the new PHP executable.

Cheers.

vicman commented 2 months ago

you are right, I will try to do what you say. image

vicman commented 2 months ago

I made the change you mention and it works. Thanks

osTicket# alias php='/usr/bin/php8.2'
root@helpdesk:/var/www/html/osTicket# php -v
PHP 8.2.14 (cli) (built: Dec 21 2023 20:19:23) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.14, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.14, Copyright (c), by Zend Technologies
root@helpdesk:/var/www/html/osTicket# php manage.php file backends
D -- In the database (AttachmentChunkedData)
6 -- upload_dir folder (from osTicket v1.6) (OneSixAttachments)
3 -- S3 (edevhelpdesk/adjuntos) (S3StorageBackend)
vicman commented 2 months ago

@JediKev I have modified the s3 plugin to receive other types of s3 compatible providers in addition to amazon (ex Wasabi), in case developers want to add it to the productive branch.

https://github.com/vicman/osTicket-plugins/tree/develop/storage-s3

image

image