I encountered strange error with my php-fpm 5.6.30 with OPcache v7.0.6-dev on ubuntu server. I got error at /vendor/monolog/monolog/src/Monolog/Logger.php file concerning array_keys(static::$levels) code in it:
array_keys() expects parameter 1 to be array, object given
The static::$levels property is defined in the top of Logger.php file as array:
protected static $levels = array(
self::DEBUG => 'DEBUG',
self::INFO => 'INFO',
self::NOTICE => 'NOTICE',
self::WARNING => 'WARNING',
self::ERROR => 'ERROR',
self::CRITICAL => 'CRITICAL',
self::ALERT => 'ALERT',
self::EMERGENCY => 'EMERGENCY',
);
This code was installed via composer and never edited manually, so there is no reasons for the file to be changed.
When I look at my laravel.log, I see that something has changed the code behaviour, so lines at the log changed their format:
[2018-05-16 00:19:22] production.INFO: blabla
[2018-05-16 00:20:04] production.[object] (DateTimeZone: {"timezone_type":3,"timezone":"UTC"}): blablabla
The key fact is that when I opened the file using nano, added a comment line into it and saved, the bug disappears. It means that the wrong code was in the opcache, not in the code of the framework.
To conclude, the bytecode of Logger.php was somehow changed and php saw object with DateTimeZone objects in it rather than an array of strings.
The question is - how could the cached bytecode be changed without being totally crashed? What on earth can do this? Can high memory consumption lead to such unexpected changes?
We had the same issue in our project (php 5.6.30, opcache v7.0.6-dev). To solve the problem we analyzed the opcache settings and found that interned_strings_buffer was 4Mb. Raising this value to 64 Mb we solved the problem.
Related
When I am uploading a file to the Azure FILE Storage I am getting the following error:
in
E:\WAMP\www\myweb\_protected\vendor\microsoft\windowsazure\WindowsAzure\Common\Internal\Http\Url.php at line 74 – WindowsAzure\Common\Internal\Validate::isTrue(false, 'Provided URL is invalid.')
E:\WAMP\www\allure\_protected\vendor\microsoft\windowsazure\WindowsAzure\Common\Internal\RestProxy.php at line 122 – WindowsAzure\Common\Internal\Http\Url::__construct('https://cG9rYXJuYXZpb282mGQ=.blo...')
The settings that I have in my config file is:
'filesystem' => [
'class' => 'creocoder\flysystem\AzureFilesystem',
'accountName' => 'azure-accname',
'accountKey' => 'some-long-key-A==',
'container' => 'azure-container',
],
and finally, the code I am calling to save the file is:
if($file = \yii\web\UploadedFile::getInstance($this, 'attachment'))
{
$stream = fopen($file->tempName, 'r+');
Yii::$app->filesystem->writeStream($file->name, $stream);
}
Some additional information that might be helpful
running on yii2 advanced framework
webserver: IIS 8.5 on Windows 2012
PHP 5.4.5
composer used for installation
its a azure file system - the error seems to throw error for blob.core.windows.net, where as I am saving data to file.core.windows.net. What changes should I do in config / settings?
According the source code at https://github.com/creocoder/yii2-flysystem/blob/master/src/AzureFilesystem.php#L62, it seems the package encrypt the storage info string into base64 encode before combine them into the connection string. Which makes the strange looking url format in your error message 'https://cG9rYXJuYXZpb282mGQ=.blo...'.
Please try to set the account info into following format:
...
'accountName' => base64_decode('azure-accname'),
'accountKey' => base64_decode('some-long-key-A=='),
...
Any further concern, please feel free to let me know.
Been using the PHP Soundcloud API for some time now, and it's been working fine. The code I use to create the track array is (and has always been):
$track = json_decode($client->post('tracks', array(
'track[title]' => $title,
'track[asset_data]' => $filename,
'track[description]' => $desc,
'track[genre]' => "Podcast",
'track[artwork_data]' => $image
)));
And it's always been working just fine - until this morning, when I got this error message when uploading a track using my home-made PHP tool:
Fatal error: Uncaught exception 'Services_Soundcloud_Invalid_Http_Response_Code_Exception' with message 'The requested URL responded with HTTP code 422.' in /home/csicon/public_html/PodcastAuthor/lib/Soundcloud.php:943 Stack trace: #0 /home/csicon/public_html/PodcastAuthor/lib/Soundcloud.php(621): Services_Soundcloud->_request('https://api.sou...', Array) #1 /home/csicon/public_html/PodcastAuthor/2-publish.php(52): Services_Soundcloud->post('tracks', Array) #2 {main} thrown in /home/csicon/public_html/PodcastAuthor/lib/Soundcloud.php on line 943
Now, I'm no newb, and know what HTTP code 422 is all about, so I checked the contents of $title, $filename, $desc and $image. They are, in order:
Geekdays #274: 2015-11-17
#/home/csicon/public_html/PodcastAuthor/uploads/g274.mp3
Snowden, the FBI and the Oxford Dictionary are getting blamed for things that they may or may not have done. Also; the air you're breathing might be killing you. This, and so much more, on today's episode of Geekdays.
#/home/csicon/public_html/wp-content/uploads/2014/10/geekdays-600x600.png
All paths (to the mp3 and the image) check out, there's nothing wonky in the character set being used, and it's all worked before. What might have happened here? I'm stumped.
UPDATE! Turns out my webhost has upgraded their PHP environment from 5.4 to 5.6, and this is what broke it. What's changed between 5.4 and 5.6 that might have caused this, in that case?
Turns out my webhost has upgraded their PHP environment from 5.4 to 5.6, and this is what broke it. What's changed between 5.4 and 5.6 that might have caused this, in that case?
How cURL file uploads are handled has changed.
CURLOPT_SAFE_UPLOAD is set to true by default from PHP 5.6 on, and that means file uploads are not possible any more using the #-file path syntax, but CURLFile should be used for file uploads instead.
Try setting CURLOPT_SAFE_UPLOAD to false, using the setCurlOptions method.
Magically started working when I changed to the sebdesign/php-soundcloud version of the curl-file branch. Not sure why the "normal" curl-file branch didn't work, however.
Hey I'm a starter to FuelPHP framework, I'm using version 1.7.2 , I already made my first application, Which is working perfectly in local Virtual host (windows/Wamp) , thou it didn't work well on linux server when I uploaded (I tried 2 different hosts, the same problem exists)
this is all what I get and I don't really know where to start looking :
Fatal error: Class 'Input' not found in /var/www/vhosts/carex.benseno.com.tr/httpdocs/fuel/core/classes/uri.php on line 326
Fatal error: Class 'Input' not found in /var/www/vhosts/carex.benseno.com.tr/httpdocs/fuel/core/classes/error.php on line 273
note: I extend the Class Uri, and add it to the autoloader, and I don't use any namespacing.
if anyone has an Idea that would be very appreciated
edit: Autoloader:
Autoloader::add_classes(array(
// Add classes you want to override here
'Uri' => APPPATH.'classes/extension/uri.php',
));
Note: Removing the class from autolaoding doesn't change anything, Errors are the same, I don't think it's related to the error.
Well, After a long time of debugging, strange enough, setting 'locale' => false,
in config.php file solved the problem.
which as the documentation explains :
Used for setlocale() required on some php installations, set to false
to prevent it from being set. The syntax setting for this can differ
per OS, Ubuntu for example requires a .utf8 (the encoding) suffix.
http://fuelphp.com/docs/general/configuration.html
I am trying to configure cakephp ver 2.6.0 to use redis engine by default. but somehow i am not able to make it work. any help will be highly appreciated.
Things Which i have tried so far..
Configured app/config folder 2 files , core.php and bootstrap.php. , according to the guidelines provided here in this blog configure cake with redis and this blog too Another cake-redis config setup
but i keep on getting errors like.
Fatal error: Uncaught exception 'CacheException' with message 'Cache engine session is not properly configured.' in C:\wamp\www\project\cakephp\cakephp_2.6.0\lib\Cake\Cache\Cache.php on line 181
CacheException: Cache engine session is not properly configured. in C:\wamp\www\project\cakephp\cakephp_2.6.0\lib\Cake\Cache\Cache.php on line 181
Any help will be highly appreciated.
I was having the same exact issue today while trying to setup CakePHP to use Redis as the cache engine.
Coincidentally, I also read the same setup instructions from the two blogs you linked to.
The reason was that I had copied pasted the Configure::write(...) code block from the Another cake-redis config setup blog post as it is and pasted it into the file without first commenting out the Configure::write(...) code block that was already in the core.php file.
I'm assuming that you have already successfully setup Redis on Windows and have installed the PHPRedis extension without any issues.
I am using the instructions from Another cake-redis config setup here.
In your app/Config/core.php file, comment out the following block: (this was starting at line 218 in my core.php)
Configure::write('Session', array(
'defaults' => 'php'
));
Instead, you can put this in: (You can change the values to suit your particular needs)
Configure::write('Session', array(
'defaults' => 'cache',
'timeout' => 100,
'start' => true,
'checkAgent' => false,
'handler' => array(
'config' => 'session'
)
));
After this, change the value of $engine to 'Redis', so it becomes:
$engine = 'Redis';
And then, put this code in, I put this in at the very end of the file: (Again, your values can be different depending on what your setup is)
Cache::config ('session', array (
'Engine' => $engine,
'Prefix' => $prefix . 'cake_session_',
'Duration' => $duration
));
And that's it. You're done! No need to change anything else.
To make sure that Redis is working properly with CakePHP, I ran the RedisEngine Test Suite that comes with CakePHP. You need to have PHPUnit installed for this to work.
It can be accessed via http://your-cakephp-project/test.php
Click on 'Tests' under Core and then click on 'Cache/Engine/RedisEngine'
If everything is working successfully, you should see all the tests pass.
Alternatively, you can use redis-cli at the command prompt to confirm that Redis is storing keys properly.
Once you have logged in by typing redis-cli, type KEYS *
This should give you a list of keys related to your CakePHP setup.
An example would be the "myapp_cake_core_object_map" key.
Hope this helps.
I created a module for social engine, which is zend based, and I added up my.sql file in settings folder, when I install this module, it installs properly but the my.sql file does not run.
I have a entry in the core_modules table. I see a package created in the packages folder, but the my.sql file is being ignored. Can anyone tell me what could be wrong.
In my manifest.php file, I have set the version to be 4.0.0.
After installation the module does not work, as the menuitems are not inserted, once I install them manually into the database it starts working.
Can anyone tell me what could be wrong. I tried renaming the file to my-install.php, my-install-4.0.0-4.0.1.php and change the version in manifest to 4.0.1 and reinstalled it but did not help. It says 0 query excuted everytime.
Thanks in advance!
I have found the problem my self, listing here to help others:
In my manifest file, located at application/modules/HelloworldModule/settings/manifest.php
return array (
'package' =>
array (
'type' => 'module',
'name' => 'helloworld-module',
'version' => '4.0.0',
'path' => 'application/modules/HelloWorldModule',
'title' => 'Hello World',
'description' => 'Say hello to the world!',
'author' => 'Hardik',
The only mistake was in the path, as you can see above, the path has "W" in capital while in real path its in small letter. This was the reason it was not able to find the my.sql file on the specified path, the rest of the module worked fine.
Note: I am on a linux server and the path are case sensitive.