I'm writing a plugin for openVBX.
I need to store some stuff in a table I made in the OpenVBX database.
OpenVBX Provides a helper method (PluginData::sqlQuery) to run queries but no way to escape them, so I decided to open a new PDO connection in my plugin page, but I'm getting this error:
Fatal error: Uncaught exception 'PDOException' with message
'SQLSTATE[HY000]: General error: 2006 MySQL server has gone away' in
/home/elitecallcenter/public_html/ivr/plugins/QPage/qpage.php:119
Stack trace: #0
/home/elitecallcenter/public_html/ivr/plugins/QPage/qpage.php(119):
PDOStatement->execute(Array) #1
/home/elitecallcenter/public_html/ivr/OpenVBX/views/page/index.php(7):
include_once('/home/elitecall...') #2
/home/elitecallcenter/public_html/ivr/system/libraries/Loader.php(677):
include('/home/elitecall...') #3
/home/elitecallcenter/public_html/ivr/system/libraries/Loader.php(307):
CI_Loader->_ci_load(Array) #4
/home/elitecallcenter/public_html/ivr/OpenVBX/libraries/Template.php(388):
CI_Loader->view('page/index', Array, true) #5
/home/elitecallcenter/public_html/ivr/OpenVBX/libraries/MY_Controller.php(455):
CI_Template->write_view('content', 'page/index', Array) #6
/home/elitecallcenter/public_html/ivr/OpenVBX/libraries/MY_Controller.php(498):
MY_Controller->template_respond('Phone Apps', 'page/index', Array, 'yu
in /home/elitecallcenter/public_html/ivr/plugins/QPage/qpage.php on
line 119
Line 119 is my execute call for a prepared statement.
How can I resolve this?
How large / heavy is the query? Generally you get MySQL server has gone away as a timeout.
You could try raising 'wait_timeout' in my.cnf to something more suitable or try raising 'max_allowed_packet' to '128M'.
I figured out that it was written in codeigniter, so I'm reading up on that to figure out the best way to do this. In the mean time, I've got a functioning workaround set up that involves making a cURL request to another script in the base directory that is able to connect to the database.
Related
Getting Below Error in PIMCORE demo Site
Senario: product grid adding new objectBricks Column and try to sort by id
Status: 500 | Internal Server Error
URL: /admin/object/grid-proxy/classId/12/folderId/33?xaction=read&_dc=1491992052100
Params:
-> language: en_GB
-> class: Product
Fatal error: Uncaught exception 'Zend_Db_Statement_Mysqli_Exception' with message 'Mysqli prepare error: Column 'o_id' in order clause is ambiguous' in /home/pimcore_ecommercedemo/www/vendor/zendframework/zendframework1/library/Zend/Db/Statement/Mysqli.php:77
Stack trace:
#0 /home/pimcore_ecommercedemo/www/vendor/zendframework/zendframework1/library/Zend/Db/Statement.php(115): Zend_Db_Statement_Mysqli->_prepare('SELECT COUNT(*)...')
#1 /home/pimcore_ecommercedemo/www/vendor/zendframework/zendframework1/library/Zend/Db/Adapter/Mysqli.php(388): Zend_Db_Statement->__construct(Object(Zend_Db_Adapter_Mysqli), 'SELECT COUNT(*)...')
#2 /home/pimcore_ecommercedemo/www/vendor/zendframework/zendframework1/library/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Adapter_Mysqli->prepare('SELECT COUNT(*)...')
#3 /home/pimcore_ecommercedemo/www/vendor/zendframework/zendframework1/library/Zend/Db/Adapter/Abstract.php(828): Zend_Db_Adapter_Abstract->query(Object(Zend_Db_Select), Array)
#4 [internal function]: Zend_Db_Adapter_Abstract->fetchOne in /home/pimcore_ecommercedemo/www/vendor/zendframework/zendframework1/library/Zend/Db/Statement/Mysqli.php on line 77
Related issue on github:
https://github.com/pimcore/pimcore/issues/1439
This sounds like a JOIN problem. When two tables have similar columns, (i.e. o_id), MySQL is not sure which column you mean. You have to specify tablename.o_id in order to get rid of this ambiguity error message.
Please ckeck solution for below link.
Solution : https://github.com/pimcore/pimcore/issues/1439
I never use PDO on my project, especially serialize and unserialize. But I got this error.
Fatal error: Class
'Symfony\Component\HttpKernel\Exception\FlattenException' not found in
/var/www/test/mikroskil/mikroweb/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php
on line 56 Fatal error: Uncaught exception 'PDOException' with message
'You cannot serialize or unserialize PDO instances' in [no active
file]:0 Stack trace: #0 [internal function]: PDO->__sleep() #1
[internal function]: session_write_close() #2 {main} thrown in [no
active file] on line 0
it's so frustrating. Anybody can help me? It appears suddenly when i refresh my page.
Note :
I have an error before.
I use a form with POST method. And then i put a session on it.
After that, i got this error.
failed to start the session: already started by php ($_session is
set).
I tried to fix that error. But suddenly the page is showing this error
Fatal error: Class
'Symfony\Component\HttpKernel\Exception\FlattenException' not found in
/var/www/test/mikroskil/mikroweb/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php
on line 56 Fatal error: Uncaught exception 'PDOException' with message
'You cannot serialize or unserialize PDO instances' in [no active
file]:0 Stack trace: #0 [internal function]: PDO->__sleep() #1
[internal function]: session_write_close() #2 {main} thrown in [no
active file] on line 0
I have recently had this issue and the problem was I was storing my model on session (which has active pdo connection inside) and when the request is done, php automatically try to serialize $_SESSION to store on tmp file.
The main problem is PDO connection can not be serialized. If you encounter this issue, you need to check where do you serialize any object that contains active pdo connection.
I have found this answer.
You just need to clear your Cookies on your browser.
Maybe the previous error has been create a cookies and cannot replace it.
i try to clear all my browser cookies and it successfull !
:)
I had the same error when using Medoo PHP Framework, I realized you cannot encode(serialize) a PDOStatement instances.
In my case I was using PHP json_encode to encode data to be sent to my appliction and part of that data contained the PDOStatement instances - data returned after executing a database operation. I just removed the PDOStatement instances from my data and everything worked okay.
I got this too but reading this question and, especially, zerkms responses helped me locate the problem in my code. Clearing one's cache is not an appropriate response to the problem! Having recently re-vamped my classes to use dependency-injection (?), storing them as session variables is no longer appropriate.
UPDATE: Krumo seems to be outdated, and I discovered Kint, which does everything I wanted out of Krumo.
I started a CI site that uses PHP ActiveRecord. Please note: PHP ActiveRecord is not the same as CI ActiveRecord.
ActiveRecord works great; more than I hoped for.
I then added Krumo, which also works great, sometimes; Krumo works properly unless I run Krumo on an ActiveRecord object.
print_r($this->user); // Works
krumo($this->user); // Does not work
The output for the krumo() call is:
Fatal error: Uncaught exception 'ActiveRecord\UndefinedPropertyException' with message 'Undefined property: User_model->krumo50afd2e8f24af in /Users/ted/Sites/cnc/sparks/php-activerecord/0.0.2/vendor/php-activerecord/lib/Model.php on line 514' in /Users/ted/Sites/cnc/sparks/php-activerecord/0.0.2/vendor/php-activerecord/lib/Model.php:514 Stack trace: #0 /Users/ted/Sites/cnc/sparks/php-activerecord/0.0.2/vendor/php-activerecord/lib/Model.php(333): ActiveRecord\Model->read_attribute('krumo50afd2e8f2...') #1 /Users/ted/Sites/cnc/application/libraries/krumo/Krumo.php(951): ActiveRecord\Model->__get('krumo50afd2e8f2...') #2 /Users/ted/Sites/cnc/application/libraries/krumo/Krumo.php(1104): krumo::_vars(Object(User_model)) #3 /Users/ted/Sites/cnc/application/libraries/krumo/Krumo.php(789): krumo::_object(Object(User_model), '...') #4 /Users/ted/Sites/cnc/application/libraries/krumo/Krumo.php(584): krumo::_dump(Object(User_model)) #5 [internal function]: krumo::dump(Object(User_model)) #6 /Users/ted/Sites/cnc/application/librarie in /Users/ted/Sites/cnc/sparks/php-activerecord/0.0.2/vendor/php-activerecord/lib/Model.php on line 514
It would be wonderful if I could get these two to work together. Anyone have any ideas?
Just went through description, looks like you can just use xdebug it would nicely color output your regular var_dump;
Looks also like krumo is outdated and unsupported. I would not use such a library
Guys I need little bit help with PHP Fatal error. Whenever a new session is getting created a PHP Fatal error occurs. This error never happens throughout the session apart from when session first starts. The error is:
Uncaught exception 'Exception' with message 'Serialization of 'SimpleXMLElement'
is not allowed' in /var/www/downloadanymp3.com/index.php:240
Stack trace:
#0 /var/www/downloadanymp3.com/index.php(240): session_commit()
#1 {main}
Next exception 'Exception' with message 'Serialization of 'SimpleXMLElement'
is not allowed' in /var/www/downloadanymp3.com/index.php:240
Stack trace:
#0 /var/www/downloadanymp3.com/index.php(0): session_commit()
#1 {main}
thrown in /var/www/downloadanymp3.com/index.php on line 240, referer:
http://dev.downloadanymp3.com/index.php?searchType=VIDEOTITLE
And one more thing, on index.php the very last line is session_commit();
You're attempting to put a SimpleXML element inside of your session -- Simple XML doesn't allow for serialization like that. If you need to, you can store the XML string in your session, then deserilize that back through SimpleXML if you need it again. Or even better, convert your XML into an array and store that... I personally don't understand why people use XML as a memory storage object anyway.
Sorry about posting the whole error. Basically I have two functions that are running on the soap server and work great. I've added a third function 'getk' that does nothing more complicated that the others. Accepts two parameters and returns an array. However when calling this function client side I get the following error.
Fatal error: Uncaught SoapFault exception:
[SOAP-ENV:Server] Function name must be a string in /home/od2u/public_html/wp-content/plugins/link-monitor/link-monitor.php:33
Stack trace: #0 [internal function]: SoapClient->__call('getk', Array)
#1 /home/od2u/public_html/wp-content/plugins/link-monitor/link-monitor.php(33): SoapClient->getk('3', 'wpmu1')
#2 /home/od2u/public_html/wp-content/themes/twentyten/header.php(18): wsfKeywords('3', 'wpmu1')
#3 /home/od2u/public_html/wp-includes/theme.php(1086): require_once('/home/od2u/publ...')
#4 /home/od2u/public_html/wp-includes/theme.php(1062): load_template('/home/od2u/publ...', true)
#5 /home/od2u/public_html/wp-includes/general-template.php(34): locate_template(Array, true)
#6 /home/od2u/public_html/wp-content/themes/twentyten/index.php(16): get_header()
#7 /home/od2u/public_html/wp-includes/template-loader.php(43): include('/home/od2u/publ...')
#8 /home/od2u/public_html/wp-blog-header.php(16): require_once('/home/od2u/publ...')
#9 /home/od2u/public_html/index.php(17): require( in /home/od2u/public_html/wp-content/plugins/link-monitor/link-monitor.php on line 33
I have looked everywhere for advice on how to sort this. The functions does exist, it isn't anything silly like a dollar sign or using the wrong type of parenthesis.
I have also cleared and disabled caching of the WSDL server and client side.
Client side call:
$c->getk($site, $server);
$c is the soap client and getk is the function name.
Function server side:
function getk($website, $server)
{
$ret_array('blah', 'blah2', 'blah3');
return $ret_array;
}
And this is added to the soap server using:
$server->addFunction(array("getk", "getLinks", "getDirectLinks"));
Hope you guys can help :)
I think, the problem is in
$ret_array('blah', 'blah2', 'blah3');
Interpreter try to resolve this as function call, but can't find variable $ret_array
I had the same error and after some deeper examination, the problem appeared to be on the side of the Soap-server.
The called routine (in this example the getk() function) produced a fatal error which resulted in the Soap-server not giving a proper response that could be interpreted by the Soap-client.
If someone has the same error, please check the errorlogs of the Soap-server if possible. You will propably find that the called function produces a fatal error and is "thus" not returning any xml.