I have an OroCRM running on horizontal scaling structure. I managed to configure KnpGaufretteBundle to save files using the AmazonS3 adaptor. I did a test uploading an avatar for the logged user and I can see the file on Amazon.
The problem now is: When I click on user details on OroCRM, I see the image pointing to some url like this:
Look’s like we have an issue in AttachmentBundle – it uses only locale file system to generate appropriate URL. Thank you very much for reporting, we definitely need to fix this issue!
As for workaround – you can override AttachmentManager service and fix this issue there according to your local environment.
Hi, @rbandeira. This link goes to the resized image cache. Yes. It’s goes to your server, not to the Amazon. If such resized file does not exists, server will receive original image from the Amazon, resize it and put to the server’s cache to minimize requests to the storage.
I did some research and managed to solve the problem so here it is the solution just in case someone else face the same issue.
1) First I found this on Nginx error logs:
1
2
3
4
5
...
2016/03/0117:00:23[error]956#956: *449 FastCGI sent in stderr: "PHP message: PHP Notice: Use of undefined constant CURLOPT_CLOSEPOLICY - assumed 'CURLOPT_CLOSEPOLICY' in /usr/share/nginx/html/crm-enterprise-application/vendor/amazonwebservices/aws-sdk-for-php/lib/requestcore/requestcore.class.php on line 626
PHP message:PHP Notice:Useof undefined constant CURLCLOSEPOLICY_LEAST_RECENTLY_USED-assumed'CURLCLOSEPOLICY_LEAST_RECENTLY_USED'in/usr/share/nginx/html/crm-enterprise-application/vendor/amazonwebservices/aws-sdk-for-php/lib/requestcore/requestcore.class.php on line626
PHP message:PHP Warning:curl_setopt()expects parameter2tobe long,stringgiven in/usr/share/nginx/html/crm-enterprise-application/vendor/amazonwebservices/aws-sdk-for-php/lib/requestcore/requestcore.class.php on line626
...
When we go to KnpGaufretteBundle documentation it says to use Amazon SDK version 1.6.2. (“amazonwebservices/aws-sdk-for-php”: “1.6.2”), and I noticed that AWS SDK version 1.6.3 doesn’t have THIS LINE that was generating errors as we saw on nginx error logs.
So, I changed the composer.json to use aws-sdk 1.6.3.
2) After that I just had to set write permissions on web/media folder. Found this checking app/logs/prod.log.
1
2
3
4
5
6
7
...
[2016-03-0117:38:24]
request.CRITICAL:Uncaught PHP Exception RuntimeException:"Could not create directory media/cache"at/usr/share/nginx/html/crm-enterprise-application/vendor/liip/imagine-bundle/Liip/ImagineBundle/Imagine/Cache/Resolver/AbstractFilesystemResolver.php line124
{"exception":"[object] (RuntimeException: Could not create directory media/cache at /usr/share/nginx/html/crm-enterprise-application/vendor/liip/imagine-bundle/Liip/ImagineBundle/Imagine/Cache/Resolver/AbstractFilesystemResolver.php:124, Symfony\\Component\\Filesystem\\Exception\\IOException:
Failed to create \"media/cache\": mkdir(): Permission denied. at /usr/share/nginx/html/crm-enterprise-application/vendor/symfony/symfony/src/Symfony/Component/Filesystem/Filesystem.php:100)"}
[]
...
Hope this can help someone else and again, thank you very much.
We collect cookie information with a goal to provide you with the best user experience. By using this website, you agree to our use of cookies. Read Oro Inc.’s Cookie policy.
We collect cookie information with a goal to provide you with the best user experience. By using this website, you agree to our use of cookies. Read Oro Inc.’s Cookie policy.