cakephp session error in cli - php

I am new to CakePHP framework (more of the Yii guy), so my question might look stupid to someone, however I am stuck with this problem all day. I am trying to create console command to execute in shell, however there is something wrong with Session initialization (?) I constantly get error:
PHP Notice: Undefined index: cookie in E:\htdocs\project\lib\Cake\Model\Datasource\CakeSession.php on line 485
PHP Notice: Undefined index: timeout in E:\htdocs\project\lib\Cake\Model\Datasource\CakeSession.php on line 491
PHP Warning: ini_set(): session.name cannot be a numeric or empty '' in E:\htdocs\project\lib\Cake\Model\Datasource\CakeSession.php on line 500
PHP Fatal error: Uncaught exception 'CakeSessionException' with message 'Unable to configure the session, setting session.name failed.' in E:\htdocs\project\lib\Cake\Model\Datasource\CakeSession.php:501
Why cakephp doesn't load core.php config values? In my config I set:
Configure::write('Session', array(
'defaults' => 'php'
));
Configure::write('Session.cookie', 'PROJECT');
Configure::write('Session.timeout', '28800');
CakePHP version 2.4.7

Ok, so if anyone will come to this problem, there is thing to notice. In windows you can't run cake command... Well you can, but notice line in cake.bat file:
:: In order for this script to work as intended, the cake\console\ folder must be in your PATH
or run php cake.php...

Related

Undefined index: Magento\Framework\App\State with NewRelic module in Magento 2.2.6

I have 2 modules that uses Plugins for Magento\Framework\App\State::afterSetAreaCode
Whenever both of the modules are enabled Magento throws:
1 exception(s):
Exception #0 (Exception): Notice: Undefined index:
Magento\Framework\App\State in /vendor/magento/framework/Interception/PluginList/PluginList.php on line 250
I've followed the code and came to conclusion that the fault seems to be a Magento\NewRelicReporting\Plugin\StatePlugin::afterSetAreaCode. This modules and method is calling retrieving some configuration values.
Somehow, retrieving the values load additional configuration files and resets Magento\Framework\Interception\PluginList\PluginList::_pluginInstances list which then returns error when next plugin in List in Magento\Framework\Interception\Interceptor tries to call getPlugin method.
This seems to happen only when cache is clear, once it's populated the site seems to work, but obviously it's not going to work correctly.
Has anyone ever encountered such issues?

PHP scripts not working after migrating to PHP7

After migrating to PHP7.2 from PHP5.5 , my PHP scripts are not getting executed however phpinfo() is loading fine . I have installed php from source code .
I have enabled display_errors setting and it showing the following messages
[03-Oct-2018 16:32:12 UTC] PHP Warning: Creating default object from empty value in config.php on line 163
[03-Oct-2018 16:32:12 UTC] PHP Notice: Array to string conversion in get.php on line 25
[03-Oct-2018 16:32:12 UTC] PHP Notice: Undefined property: stdClass::$Array in get.php on line 25
But these are warnings and notices .
Am I missing some configuration to make the code work ?
On the first error in config.php file, you probably should instantiate a new stdClass() like the example below:
$var = new stdClass()
and then assign a value to its properties.
On the second error, you must have assigned the var as an array and then trying to echo that var
Without seeing the code I think its all the help I could give you

Kohana project doesn't work after moving to different server

Recently I had to work with Kohana 3.3.1 Framework project (which works). I moved it to my computers localhost, and it doesn't work there. I have set up the mysqli server, tried it on apache and nginx and both give me the same error
ErrorException [ Fatal Error ]: Call to undefined function __()
SYSPATH/classes/Kohana/Kohana/Exception.php [ 53 ]
53 $message = __($message, $variables);
{
Fatal error: Call to undefined function __() in /usr/share/nginx/www/system/views/kohana/error.php on line 64
Have I forgotten something? I have also tried giving it 777 permission, and still the same error.
Please check filenames. Probably during send to server it's change to lowercase. Unix like servers knows difference.
Or check is all files are present on server.
This error is caused beacuse you don't have system/classes/Kohana/I18n.php file.
Or check besedir jail.

XAMPP / MySQL / Undefined function mysql_connect()

I am having a problem with a small class project. I have installed XAMPP, created the table that I need, loaded my *.sql database in it, but my project can't run because of some PHP issues I guess.
I had the $_SESSION problem, which I found a solution to, but then...
I am getting the famous:
Fatal error: Call to undefined function mysql_connect() in C:\xampp\htdocs\gabi\telk\DbSql.inc.php on line 11
But I can't bypass the problem. I have read other threads on this problem here but neither of them solves the problem for me.
Here is my code that is inside the DbSql.inc.php :
http://codepad.org/ToGmPB26
Check in your php.ini file if you have the line:
extension=php_mysql.dll
And it's not commented (with the ; in the line start)

Zend session_start gives Fatal error: Exception thrown without a stack frame in Unknown on line 0

When running a Zend application locally I get Fatal error: Exception thrown without a stack frame in Unknown on line 0, i traced that error to a line $startedCleanly = session_start();
I can't get through it, when I restart the server and reload the page I do not get the error, but on every other reload I get it, I looked into a php/tmp dir too see if there are any files, and as I see they aren't there. I think that session isn't written but when I try just a simple test.php file with session_start(); line, without zend framework, I see that there is a file created in that dir.
I really don't know where to go next.
Happens when your destructor or error handler throws an exception. That can happen for multiple reasons depending on your exact setup and method for session storage you're using. For example the session directory is not writeable or does not exist, database is not accessible or fields are invalid, redis does not respond, etc.
So, check your settings and look for something that would prevent saving the session data.
More elaborate description can be found here.
I know this post is old, but I've just figured out that I was getting "Fatal error: Exception thrown without a stack frame in Unknown on line 0" because my 'modified' and 'lifetime' columns were of type 'timestamp without time zone' when they should have been 'integer' (I'm using Postgres 9 BTW)
Hope this helps someone.
The problem could also be a disk full problem !!!

Categories