Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
vzan2012 opened this issue Oct 27, 2022 · 13 comments
Open

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

vzan2012 opened this issue Oct 27, 2022 · 13 comments

Comments

@vzan2012
Copy link

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

@vzan2012 vzan2012 changed the title Error: Unable to migrate the files from database to S3 [Error] Unable to migrate the files from database to S3 Oct 27, 2022
@JediKev
Copy link
Contributor

JediKev commented Oct 27, 2022

@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
Copy link
Author

vzan2012 commented Oct 28, 2022

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
Copy link
Author

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

@JediKev
Copy link
Contributor

JediKev commented Oct 30, 2022

@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
Copy link
Author

vzan2012 commented Nov 1, 2022

@JediKev

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

But still getting the same error :(

@JediKev
Copy link
Contributor

JediKev commented Nov 1, 2022

@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
Copy link

vicman commented Aug 15, 2024

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
Copy link
Contributor

JediKev commented Aug 15, 2024

@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
Copy link

vicman commented Aug 16, 2024

@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
Copy link
Contributor

JediKev commented Aug 16, 2024

@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
Copy link

vicman commented Aug 16, 2024

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

@vicman
Copy link

vicman commented Aug 16, 2024

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
Copy link

vicman commented Aug 16, 2024

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants