I seem to be getting an error when trying to upload large files into MongoDB..
Fatal error: Uncaught exception 'MongoGridFSException' with message 'could not open file ' in /home/jclark/thundergrid.fusionstrike.com/thundergrid/thundergrid.php:33 Stack trace: #0 /home/jclark/thundergrid.fusionstrike.com/thundergrid/thundergrid.php(33): MongoGridFS->storeUpload('pic', Array) #1 /home/jclark/thundergrid.fusionstrike.com/thundergrid/admin/index.php(7): Admin->upload() #2 {main} Next exception 'MongoGridFSException' with message 'error setting up file: ' in /home/jclark/thundergrid.fusionstrike.com/thundergrid/thundergrid.php:33 Stack trace: #0 /home/jclark/thundergrid.fusionstrike.com/thundergrid/thundergrid.php(0): MongoGridFS->storeUpload() #1 /home/jclark/thundergrid.fusionstrike.com/thundergrid/admin/index.php(7): Admin->upload() #2 {main} thrown in /home/jclark/thundergrid.fusionstrike.com/thundergrid/thundergrid.php on line 33
Is there a reason I'm getting these or...
Many thanks!
If the file is over 2GB/4GB, then this is likely a limitation on how PHP is build on your platform. In most cases, LFS (large file system) is not enabled (and theoretically it's not officially supported by the PHP dev team either). It is also possible that you are using a 32-bit compile of PHP as well, in which case you need a 64-bit build.
Related
I'm using the PHP Google Cloud Storage library (https://github.com/googleapis/google-cloud-php-storage) to upload .msg (outlook message export) files.
However while it works most of the time I'm getting the error below for about 1 in 200 files.
PHP Fatal error: Uncaught Google\Cloud\Core\Exception\BadRequestException: Malformed multipart body. in /home/jamie/import_systems/vendor/google/cloud-core/src/RequestWrapper.php:368
Stack trace:
#0 /home/jamie/import_systems/vendor/google/cloud-core/src/RequestWrapper.php(207): Google\Cloud\Core\RequestWrapper->convertToGoogleException()
#1 /home/jamie/import_systems/vendor/google/cloud-core/src/Upload/MultipartUploader.php(44): Google\Cloud\Core\RequestWrapper->send()
#2 /home/jamie/import_systems/vendor/google/cloud-storage/src/Bucket.php(294): Google\Cloud\Core\Upload\MultipartUploader->upload()
#3 /home/jamie/import_systems/file_uploader.php(47): Google\Cloud\Storage\Bucket->upload()
#4 /home/jamie/import_systems/file_uploader.php(18): UploadAndLinkUpAttachments()
#5 {main}
thrown in /home/jamie/import_systems/vendor/google/cloud-core/src/RequestWrapper.php on line 368
Interestingly I can upload the same files without any issues through the Cloud Storage GUI into the same bucket.
I've checked the library for any encoding options/config but can't see any. I understand its something about the .msg files structure but I would have assumed the library would see that and escape it.
What could the issue be? Or where can I start to debug this?
I have a PHP script that reads files from Cloud Storage. It works fine in local dev. But when it's run in App Engine standard environment, it outputs this error message:
Fatal error: Uncaught Google\Cloud\Core\Exception\ServiceException in /srv/vendor/google/cloud/Core/src/RequestWrapper.php:362
Stack trace:
#0 /srv/vendor/google/cloud/Core/src/RequestWrapper.php(206): Google\Cloud\Core\RequestWrapper->convertToGoogleException(Object(GuzzleHttp\Exception\RequestException))
#1 /srv/vendor/google/cloud/Storage/src/Connection/Rest.php(224): Google\Cloud\Core\RequestWrapper->send(Object(GuzzleHttp\Psr7\Request), Array)
#2 /srv/vendor/google/cloud/Storage/src/StorageObject.php(643): Google\Cloud\Storage\Connection\Rest->downloadObject(Array)
#3 /srv/vendor/google/cloud/Storage/src/StorageObject.php(574): Google\Cloud\Storage\StorageObject->downloadAsStream(Array)
#4 /srv/modules/profile/controllers/getresource.class.php(69): Google\Cloud\Storage\StorageObject->downloadAsString()
This doesn't happen to most of the files. The file causing this issue is about 250KB. I am wondering is there some kind of size limitation with downloadAsString()?
One of the files causing this issue is https://www.justjeans.com.au/wcsstore/JustJeansAuroraStorefrontAssetStore/css/main.css?timestamp=2019070295000
The downloadAsString() method downloads the file using stream, and then casts it to a string before returning it.
Link to the SDK code
There should not be any issues with file sizes unless you are running out of memory in your PHP process.
Is there a file that causes the issue every time? If so, maybe adding that to the question would be a good idea.
I recently installed git for sharing cakephp 3.0 code but after pushing and pulling the browser seems blank then I edit .gitignore file and remove all commands excluding /tem/* because I didn't worry about security right now and then I shared my code and got this error:
Fatal error: Class 'Psr\Log\AbstractLogger' not found in /var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Log/Engine/BaseLog.php on line 24
Fatal error: Uncaught RuntimeException: Could not load class Cake\Log\Engine\FileLog in /var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Log/LogEngineRegistry.php:57 Stack trace: #0
/var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Core/ObjectRegistry.php(91): Cake\Log\LogEngineRegistry->_throwMissingClassError('Cake\\Log\\Engine...', NULL) #1
/var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Log/Log.php(198): Cake\Core\ObjectRegistry->load('Cake\\Log\\Engine...', Array) #2
/var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Log/Log.php(180): Cake\Log\Log::_loadConfig() #3
/var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Log/Log.php(360): Cake\Log\Log::_init() #4
/var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Error/BaseErrorHandler.php(284): Cake\Log\Log::write(3, 'Fatal Error (1)...') #5
/var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Error/BaseErrorHandler.php(216): Cake\Error\BaseErrorHandler->_logError(3, Array) #6
/var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Error/Bas in /var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Log/LogEngineRegistry.php on line 57
I m posting answer for my question, actually its a permission issue in Linux and therefore it doesn't allow to share all the file while using push command in git but while using it doesn't show any error but it doesn't work properly on other end.
Have any of you encountered this error before while running the demo of WURFL? I am tyring to user WURFL to redirect our mobile site visitors to different content but this error is not letting me go ahead.
Here is the error Detail:
Fatal error: Uncaught exception 'WURFL_WURFLException' with message 'The ZipArchive extension is not loaded. Load the extension or use the flat wurfl.xml file' in /var/www/bpaudel/wurfl-php-1.4.1/WURFL/Xml/Utils.php:49 Stack trace: #0 /var/www/bpaudel/wurfl-php-1.4.1/WURFL/Xml/Utils.php(36): WURFL_Xml_Utils::getZippedFile('/var/www/bpaude...') #1 /var/www/bpaudel/wurfl-php-1.4.1/WURFL/Xml/AbstractIterator.php(47): WURFL_Xml_Utils::getXMLFile('/var/www/bpaude...') #2 /var/www/bpaudel/wurfl-php-1.4.1/WURFL/DeviceRepositoryBuilder.php(83): WURFL_Xml_AbstractIterator->__construct('/var/www/bpaude...') #3 /var/www/bpaudel/wurfl-php-1.4.1/WURFL/WURFLManagerFactory.php(150): WURFL_DeviceRepositoryBuilder->build('/var/www/bpaude...', NULL) #4 /var/www/bpaudel/wurfl-php-1.4.1/WURFL/WURFLManagerFactory.php(134): WURFL_WURFLManagerFactory->deviceRepository(Object(WURFL_Storage_File), Object(WURFL_UserAgentHandlerChain)) #5 /var/www/bpaudel/wurfl-php-1.4.1/WURFL/WURFLManagerFactory.php(77): WURFL_WURFLManagerFactory->init() #6 /var/w in /var/www/bpaudel/wurfl-php-1.4.1/WURFL/Xml/Utils.php on line 49
In the error, it also says "use the flat wurfl.xml" file. How would we use wurfl.xml as an alternative?
Thanks,
Bishnu
A normal thrown and uncaught exception in PHP will produce output similar to this:
Fatal error: Uncaught exception 'Exception' with message 'Insufficient permissions or something' in /home/codemonkey/foo/bar/File.php:143
Stack trace:
#0 /home/codemonkey/dev/foo/bar/SomeOtherFile.php(85): foo\bar\File::fromUpload(Array)
#1 /home/codemonkey/dev/foo/bar/OmniDataFileImport.php(35): foo\bar\OmniDataFileImport->performFileImportLogic()
#2 [internal function]: foo\bar\OmniDataFileImport->post(Object(Request), false)
#3 /home/codemonkey/dev/foo/vendor/tonic/lib/tonic.php(654): call_user_func_array(Array, Array)
#4 /home/codemonkey/dev/foo/dispatch.php(22): Resource->exec(Object(Request))
#5 {main}
thrown in /home/codemonkey/dev/foo/broadnet/files/File.php on line 143
The message and stack trace is cool, but I would really like more information. For that reason I want to extend the Exception with more information such as local variables and their values. The problem is that PHP will probably still output the same above information but with the text "Uncaught exception 'MyException'" instead.
Can I override the way PHP displays uncaught exceptions? I recall reading about a function in PHP that you can set as a backup to catch all uncaught exceptions. Perhaps I can use that functionality to format my own message and kill the process.
Thanks for all helpful information on the topic
You are looking for set_exception_handler().
However, you cannot retrieve local variables etc. - PHP's error handling/debugging is rather poor unless you use a debugging extension which is not suitable for a production system.