CQL2/CQL3 Cassandra Error on PHP - php

While executing this code in PHP:
$db_nosql = new PDO('cassandra:host=127.0.0.1;port=9160;cqlversion=3.0.0');
I got a error message:
Fatal error: Uncaught exception 'PDOException' with message
'CQLSTATE[HY000] [2] Cannot execute/prepare CQL2 statement since the
CQL has been set to CQL3(This might mean your client hasn't been
upgraded correctly to use the new CQL3 methods introduced in Cassandra
1.2+).'
in /home/web/site/Test/page.php:202 Stack trace: #0
/home/web/site/Test/page.php(202): PDO->exec('USE mailing') #1 {main}
thrown in /home/web/site/Test/page.php on line 202
I don't know what I am supposed to do in this situation. Does that means that the syntax is incorrect ?
Thank you.

Can try the library. It uses the native protocol and does not require other libraries.

Related

PHP Fatal error: Class 'sfContext' not found

hi I'm using php/symfony ( symfony 1.0 ) and im getting following exception at the very first page
PHP Fatal error: Class 'sfContext' not found
I tried symfony cc at the root and its working but error is still there ,
may be its due to failure in autoloading files and following line from the code gives me the exception
$customerName = sfContext::getInstance()->getUser()->getAttribute('meta.customerName');
I'm assuming it might be a symfony exception
Sorry for the less information , actually I was installing a web based application and thats all printed in the log , anyhow I managed to find the fault with adding some var_dumps on the flow methods ,
missing php-mysqli extension caused the problem and unfortunately it's not handled from the application level so only a symfony level single line exception printed.
Here is the stack trace :
PHP Fatal error: Uncaught Error: Class 'sfContext' not found in /usr/local/rms/evt/uranai/lib/symfony-1.0.11/util/sfCore.class.php:171\nStack trace:\n#0 [internal function]: sfCore::splAutoload('sfContext')\n#1 /usr/local/rms/evt/uranai/lib/symfony-1.0.11/util/sfCore.class.php(171): spl_autoload_call('sfContext')\n#2 [internal function]: sfCore::splAutoload('sfPhpConfigHand...')\n#3 /usr/local/rms/evt/uranai/cache/pc/prod/config/config_config_handlers.yml.php(7): spl_autoload_call('sfPhpConfigHand...')\n#4 /usr/local/rms/evt/uranai/lib/symfony-1.0.11/config/sfConfigCache.class.php(279): require_once('/usr/local/rms/...')\n#5 /usr/local/rms/evt/uranai/lib/symfony-1.0.11/config/sfConfigCache.class.php(60): sfConfigCache->loadConfigHandlers()\n#6 /usr/local/rms/evt/uranai/lib/symfony-1.0.11/config/sfConfigCache.class.php(190): sfConfigCache->callHandler('config/settings...', Array, '/usr/local/rms/...')\n#7 /usr/local/rms/evt/uranai/lib/symfony-1.0.11/symfony.php(87): sfConfigCache->checkConfig('config/settings...')\n#8 /usr/local/rms/evt in /usr/local/rms/evt/uranai/lib/symfony-1.0.11/util/sfCore.class.php on line 171

Fatal error because an Error instance is being passed instead of an expected Exception instance

I just installed xampp with php 7.0.4 and a fresh cakephp 3.2.6.
I did a lot of research and everything I found shows that they are compatible.
However as soon as I go to open the application with a browser, cake replies with an Internal Error.
The only pointer as to what to do is that xampp logs the following in apache error.log:
PHP Fatal error: Uncaught TypeError: Argument 1 passed to Cake\Error\BaseErrorHandler::handleException() must be an instance of Exception, instance of Error given in D:\Xampp\htdocs\cakephp\vendor\cakephp\cakephp\src\Error\BaseErrorHandler.php:153
Stack trace:
#0 [internal function]: Cake\Error\BaseErrorHandler->handleException(Object(Error))
#1 {main} thrown in D:\Xampp\htdocs\cakephp\vendor\cakephp\cakephp\src\Error\BaseErrorHandler.php on line 153
I tried php 5.6 but it still shows the error in the log.
If that's the error that you are encountering, then I'd doubt that you are using CakePHP 3.2.6, as line 153 is in the middle of a comment
https://github.com/cakephp/cakephp/blob/3.2.6/src/Error/BaseErrorHandler.php#L153
PHP7 errors are handled since CakePHP 3.1.5, so check your CakePHP dependency, and make sure it's actually up to date.

PDO extension configuration - I keep getting PDOException "could not find driver" in my PHP application

In a PHP application that I wrote, I keep getting an error that says:
Fatal error: Uncaught exception 'ActiveRecord\DatabaseException' with message 'exception 'PDOException' with message 'could not find driver' in /home/diftx/public_html/dol/sparks/php-activerecord/0.0.1/vendor/php-activerecord/lib/Connection.php:239 Stack trace: #0 /home/diftx/public_html/dol/sparks/php-activerecord/0.0.1/vendor/php-activerecord/lib/Connection.php(239): PDO->__construct('mysql:host=loca...', 'diftx_skcin7', 'thePassword', Array) #1 /home/diftx/public_html/dol/sparks/php-activerecord/0.0.1/vendor/php-activerecord/lib/Connection.php(101): ActiveRecord\Connection->__construct(Object(stdClass)) #2 /home/diftx/public_html/dol/sparks/php-activerecord/0.0.1/vendor/php-activerecord/lib/ConnectionManager.php(33): ActiveRecord\Connection::instance('mysql://diftx_s...') #3 /home/diftx/public_html/dol/sparks/php-activerecord/0.0.1/vendor/php-activerecord/lib/Table.php(103): ActiveRecord\ConnectionManager::get_connection(NULL) #4 /home/diftx/public_html/dol/sparks/php-activerecord/0.0.1/vendor/php-activerecord/lib/Tabl in /home/diftx/public_html/dol/sparks/php-activerecord/0.0.1/vendor/php-activerecord/lib/Connection.php on line 241
Based on this message, I did some research about PDO and can't seem to figure out.
Here is a screenshot from my phpinfo() showing PDO information:
When I log into the server via PuTTY and type "php -m" a list of modules appear. In the list is both entries for PDO and pdo_sqlite.
I am somewhat new to server configuration and I simply cannot seem to figure out what I am doing wrong to set this up. Help!
Just like to answer this (I commented the solution). You do not have the required drivers for PDO to work with MySQL. You need to install them before you can use MySQL with PDO.

Bosh Error Message in Debian server

HI, I have a debian server.
I am using xmpphp library for bot development.
When i create a bot using xmpp file its working fine but when i try to use bosh it generates a fatal error.
Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /var/www/testlib/XMPPHP/BOSH.php:75
Stack trace:
0 /var/www/testlib/XMPPHP/BOSH.php(75): SimpleXMLElement->__construct('')
1 /var/www/testlib/index.php(14): XMPPHP_BOSH->connect('myserver')
2 {main}
thrown in /var/www/testlib/XMPPHP/BOSH.php on line 75
Please help me on this
Thanks
Not sure but could it be related to this known bug:
http://bugs.php.net/bug.php?id=42682

Error message trying to catch a soapfault using the PHP Soap class

For some reason I can't catch the error. I'm following an example in O'Reillys PHP cookbook, so I'm not doing any cowboy coding (yet).
The error is:
SoapFault exception: [SOAP-ENV:Server] SoapFault::SoapFault() [soapfault.soapfault]: Invalid parameters. Invalid fault code. in C:\xampp\htdocs\soap\client_database.php:13 Stack trace: #0 C:\xampp\htdocs\soap\client_database.php(13): SoapClient->__soapCall('select_query', Array) #1 {main}
I found the solution, you can only use certain error codes when throwing an error.
http://www.w3.org/TR/soap12-part1/#faultcodes
As per the standards there are only 5 possible options for a fault code:
VersionMismatch
MustUnderstand
DataEncodingUnknown
Sender
Receiver
Choose the most appropriate to your situation and use that one as a value for $faultCode when throwing a SoapFault exception.
I got other (weird) SOAP errors in php 5.2.0 which where resolved in php 5.2.8
If you're not on the latest version of php I suggest upgrading and see what happens

Categories