I'm on Ubuntu right now trying to connect to Cassandra with PHP. I have installed Datastax php-driver and all of its dependencies but i get this error when trying to run a testfile:
PHP Fatal error: Uncaught Cassandra\Exception\LogicException: Not implemented in /home/philip/Documents/test.php:3
Stack trace:
#0 /home/user/Documents/test.php(3): Cassandra\Cluster\Builder->build()
#1 {main}
thrown in /home/user/Documents/test.php on line 3
The code looks like this:
<?php
// Connect to the cluster and keyspace "killrvideo"
$cluster = Cassandra::cluster()->build();
$keyspace = 'killrvideo';
$session = $cluster->connect($keyspace);
I manage to connect to cassandra using the shell cqlsh and i can see the table i have setup. The php code doesnt seem to work though. Any ideas why?
We have the same issue. This works for me.
Thanks a lot #AlexandruCircus!
git clone https://github.com/datastax/php-driver.git
git reset --hard f50c93da3ea73ad8fcf8b181d0313d437e559256
cd php-driver/ext
./install.sh
well this is not very clear for me but you call this from the same server ?
witch strategy you use ? simples or network topology ?
but something that I'm sure will work with this
$cluster = Cassandra::cluster()->withContactPoints('127.0.0.1')->build();
// or if you call from a different server just replace the ip
Related
I have some problem. I have been looking it for almost a week. I have done include ibm_db2.dll, change php version but not working. When I run the db2 query, it shows Fatal error: Uncaught Error: Call to undefined function db2_connect() in C:\laragon\www\hpc_dev\db2_conn.php:15 Stack trace: #0 C:\laragon\www\hpc_dev\index.php(3): include() #1 {main} thrown in C:\laragon\www\hpc_dev\db2_conn.php on line 15
Currently I am using php version 7.4.12 64bit (ts) using laragon in Windows 10. I also have tested using Xampp and the same problem occur. Below are my codes to connect to ibm db2:
db2_conn.php:
<?php
ini_set("display_errors", 1);
$database = 'DB2';
$user = 'xxx';
$password = 'xxx';
$hostname = 'xx.xx.xx';
$port = 60000;
$conn_string = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=$database;" .
"HOSTNAME=$hostname;PORT=$port;PROTOCOL=TCPIP;UID=$user;PWD=$password;";
$conn = db2_connect($conn_string, '', '');
if ($conn) {
echo "Connection succeeded.";
db2_close($conn);
}
else {
echo "Connection failed.";
}
?>
My code to show data from db2:
<?php
include("db2_conn.php");
$sql = "SELECT * FROM EMPLOYER WHERE EMPR_LOGIN_NAME = 'xxxxx'";
if ($conn)
{
$stmt = db2_exec($conn, $sql);
$row = db2_fetch_assoc($stmt);
echo $row['SECTOR_DESC'];
db2_close($conn);
}
?>
I don't know either the problem comes from db2 extension or others. Please help me.
For information, I have download the ibm db2 extension here: https://github.com/ibmdb/php_ibm_db2
Thanks
Your question omits details of the command-lines and actions you performed.
Most likely you missed a step in the configuration.
Remember to open the laragon terminal and verify that the Db2 driver is loaded:
php -m | grep ibm
should return ibm_db2 if you have correctly configured the correct version of the extension.
If you do not see that the ibm_db2 extension is loaded then any db2_connect will fail until you resolve the missing module.
For information the current laragon_full (November 2020) delivers PHP 7.2 TS, and that works correctly with the php_ibm_db2.dll TS for v7.2.x "out of the box" (which you must first download and configure).
Additionally, if I upgrade the PHP version for laragon to PHP 7.4.12 TS, and subsequently download and configure the matching php_ibm_db2.dll TS for php v7.4.x, then it all "just works" without any issues on Win 10 x64 2020 to connect to Db2-LUW and run queries etc.
It helps to verify that your Db2 client is correctly configured. You can do that independently of PHP. If you are using the clidriver Db2-client (the smallest footprint driver) you can configure the db2dsdriver.cfg XML file and then run db2cli validate -connect -dsn -user ... -passwd ... to verify that the connection works. If you are using either the Db2-runtime-client or the Db2 full client, or a local Db2-server, you can run (in the laragon terminal):
(after configuring your Db2 node directory and Db2 db directory via appropriate configuration commands )::
set DB2CLP=**$$**
db2 connect to $yourdsn user ... using ...
I've got a test suite in yii2 that I would like to run, I have installed composer, codeception, built the test with 'codecept build' and so far so good, everything was smooth as butter until I've issued the command 'codecept run'; it throws an error which by any means I have tried to figured out unfortunately unsuccessfully. I have reinstalled composer, clear the composer cache, rebuilt the project again with codecept build but not success whatsoever.
The error is as follows:
MyApp\tests.functional Tests (4) -----------------------------------------------------------------
- HomeCest: Check open<pre>PHP User Error 'yii\base\ErrorException' with message 'Exception 'yii\base\InvalidParamException' with message 'The file or directory to be published does not exist: /home/user/GIT_MyApp/yii/myapp/vendor/bower/jquery/dist'
in /home/user/GIT_MyApp/yii/vendor/yiisoft/yii2/web/AssetManager.php:453
Stack trace:
#0 /home/user/GIT_MyApp/yii/vendor/yiisoft/yii2/web/AssetBundle.php(185): yii\web\AssetManager->publish('/home/angelo/GI...', Array)
#1 /home/user/GIT_MyApp/yii/vendor/yiisoft/yii2/web/AssetManager.php(268): yii\web\AssetBundle->publish(Object(yii\web\AssetManager))
#2
/home/user/GIT_MyApp/yii/vendor/yiisoft/yii2/web/AssetManager.php(239): yii\web\AssetManager->loadBundle('yii\\web\\JqueryA...', Array, true)
.....
.....
The weirdest thing though, is that the same project runs fine in another machine (CENT OS). Mine is Kubuntu 16.04. Could it be the machine?
Could someone please tell me what is happening and why this error keeps on coming?
You have to install fxp/composer-asset-plugin with composer globally:
composer global require "fxp/composer-asset-plugin:~1.3.1"
Like here: https://github.com/yiisoft/yii2-app-basic/blob/2.0.12/.travis.yml#L20
Deployer version 4.1.0
When running dep deploy test the following error is reported:
PHP Fatal error: Call to undefined function server()
server ftn is defined as follows in config file:
// Configure servers
server('test', 'test.server.com')
->user('user')
->identityFile('~/.ssh/id.pub', '~/.ssh/user', 'password')
->stage("test")
->env('deploy_path', '/var/www/project.com');
This is pretty much the standard as per the Deployer site. Has anyone else experienced this issue? If so how did you resolve it?
SOLUTION
Fixed issue by running the following cmd (Suggested in comments above by Ken)
dep init
Compared the auto-generated deploy.php file to the original. Noted that the following was omitted:
namespace Deployer;
Also noted that ->env has been replaced with ->set
I had the same problem using deployer on a Laravel 5.4 project:
I had installed deployer using composer, when removed it and worked with deployer.pharfile , everything worked fine.
I have been trying to convert an html page to PDF with out any luck, I have tried to use wkhtmltopdf (http://code.google.com/p/wkhtmltopdf/) and the PHP class provided by the same developers (http://code.google.com/p/wkhtmltopdf/wiki/IntegrationWithPhp) although the following command executed correctly in terminal:
wkhtmltopdf http:/www.googl.com test.pdf
I was unable to execute the command in PHP because of the following error:
cannot connect to X server.
Can any one provide me with a step-by-step tutorial in order to be able to convert html/css to PDF file, whether using wkhtmltopdf or any other decent solution.
Thanks in advance
here is the class that i have used http://code.google.com/p/wkhtmltopdf/wiki/IntegrationWithPhp
and below is my code
$html = file_get_contents("test.html");
$pdf = new WKPDF();
$pdf->set_html($html);
$pdf->render();
$pdf->output(WKPDF::$PDF_EMBEDDED,'sample.pdf');
Below is the error:
Fatal error: Uncaught exception 'Exception' with message 'WKPDF didn't return any data.
/usr/bin/wkhtmltopdf: /opt/lampp/lib/libxml2.so.2: no version information available
(required by /usr/lib/libgstreamer-0.10.so.0) No protocol specified wkhtmltopdf: cannot
connect to X server :0 </pre>' in /var/www/c4/components/com_wkhtmltopdf
/wkhtmltopdf.class.php:211 Stack trace: #0 /var/www/c4/components/com_wkhtmltopdf
/wkhtmltopdf.php(68): WKPDF->render() #1 /var/www/c4/components/com_wkhtmltopdf
/wkhtmltopdf.php(50): html2pdf() #2 /var/www/c4/index2.php(114): require_once('/var/ww...')
#3 {main} thrown in /var/www/c4/components/com_wkhtmltopdf/wkhtmltopdf.class.php on line 211
I found the solution, The following error "No protocol specified wkhtmltopdf: cannot
connect to X server :0" was basically caused by on old version of "wkhtmltopdf" which was installed using apt-get. The solution was to download the static binary from the code.google using the following link:
http://code.google.com/p/wkhtmltopdf/downloads/list
and then perform the following actions:
tar -jxvf wkhtmltopdf-0.11.0-static.tar.bz2
sudo aptitude install ia32-libs
Next, you’ll have to make a symbolic link pointing to WKHTMLTOPDF in /usr/bin.
sudo ln -s /full_path/WKHTMLTOPDF /usr/bin/WKHTMLTOPDF
I just wanted to take a look at Mongo-DB. But i just don't get it running. I've installed it with PECL and my phpinfo() tells me that the extension is loaded, but when i try to get a connection with
$mongo = new Mongo();
I get this:
Fatal error: Uncaught exception 'MongoConnectionException' with
message ': Transport endpoint is not connected'
Anybody have the same Problem? ... Or any Idea on this?
Please don't take this the wrong way, but have you actually got the server running? Only it looks like your error relates to a failure to connect and you've made no mention of the server or where it is located (localhost on the default port for example)
any server start method, such as "/etc/init.d/mongodb start" or "service start mongodb" will fail, if a stale lock file still exists. In Ubuntu/Debian this is /var/lib/mongodb/mongod.lock. Look for this and delte it, if it exists and seems to be an old one.
check out whether server is running or not..
/etc/init.d/mongodb start
then go to
root#kannan-desktop:~# mongo
MongoDB shell version: 1.6.3
connecting to: test
>
Don't forget to change the IP in your mongod.conf if it's a new installation.
custom string looks like that
mongodb://username:password#host:port/database
First Change the Default db path by following command
$ sudo mkdir -p /data/db/
$ sudo chown id -u /data/db
and then the final command is..
$ mongod --journal
Do not close terminal until you are working with mongoDB
It works for me...
just write mongod in your terminal and will work well