aparkhomenko / php-cassandra

PHP extension for original DataStax C/C++ Driver for Apache Cassandra
GNU General Public License v2.0
39 stars 6 forks source link

cassandra.so is not being loaded #11

Open mamdouhweb opened 9 years ago

mamdouhweb commented 9 years ago

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525/cassandra.so' - /usr/lib/php5/20100525/cassandra.so: undefined symbol: _ZN3cql12cql_varint_t31convert_to_boost_multiprecisionERN5boost14multiprecision6numberINS2_8backends15cpp_int_backendILj0ELj0ELNS2_16cpp_integer_typeE1ELNS2_18cpp_int_check_typeE0ESaIyEEELNS2_26expression_template_optionE1EEE

This is the error I get after running php -m

aparkhomenko commented 9 years ago

Hi, are you sure that you're link the right libcql version? It's looks like the module was compiled with right include files but when php was running the linked library had wrong version and didn't have need function.

Rootvik commented 9 years ago

Hello, I have got simillar issue: After make command. I did make test and it shows everything is correct. When I ran coomand sudo php -d="extension=modules/cassandra.so" -m it displays cassandra in the list. Now when I am running the example which you have said. I get error in apache error log file that PHP Fatal error: Class 'CqlBuilder' not found in /var/www/html/cassandra/index.php on line 5

If I restart apache server it shows following error: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/cassandra.so' - /usr/lib/php5/20121212/cassandra.so: cannot open shared object file: No such file or directory in Unknown on line 0

Is there anything I am missing? Kindly assist me as I am new to this libraries. p.s. I find issue similar that is why I am adding this here in comment rather then creating new issue.

Many thanks

aparkhomenko commented 9 years ago

Hi, ok I'll try to see what could change and give you some answer later.

Rootvik commented 9 years ago

Thank you so much.

On Fri, Feb 27, 2015 at 1:45 PM, Alexey Parkhomenko < notifications@github.com> wrote:

Hi, ok I'll try to see what could change and give you some answer later.

— Reply to this email directly or view it on GitHub https://github.com/aparkhomenko/php-cassandra/issues/11#issuecomment-76354109 .

aparkhomenko commented 9 years ago

@mamdouhweb did you use this driver when linked php-cassandra module git clone https://github.com/datastax/cpp-driver/ --branch deprecated --single-branch cpp-driver ? I look around and didn't find nothing abnormal, unfortunately. Official Datastax driver use boost. Do you have it?

@Rootvik You should add to your php.ini file right path to php-cassandra module. If you saw cassandra extension when used php -d="extension=modules/cassandra.so" -m that's means all is ok. Flag -d extend *.ini params for php. And as I understand /usr/lib/php5/20121212/cassandra.so it's not right path because you use modules/cassandra.so in command line.

So, please try to look right path where you build the extension.

poluin commented 9 years ago

Hi -

I installed Cassandra and PHP-Driver from Datastax. I wrote a sample PHP Code, and try to run it with PHP it throws an error indicating

PHP Fatal error: Class 'Cassandra' not found in /Users/polu/RND/apache-cassandra-2.0.14/php-driver/ext/cassandra_login.php on line XX.

I am new to PHP - not sure how do i include Cassandra class - can you help

<?php $cluster = Cassandra::cluster() ->build(); $keyspace = 'temperature'; $session = $cluster->connect($keyspace); $result = $session->execute(new Cassandra\SimpleStatement ("SELECT temperature FROM temperature where weatherstation_id=BLR-JPN-01 and event_time > 2013-04-03 07:04:00 and event_time <2013-04-03 07:09:00")) ; foreach ($result as $row) { printf("RowX: \"%s\"" , $row['temperature']);

} printf("Test CASSANDRA"); writeHeaderHTML ();

msinantoktay commented 9 years ago

is this issue fixed ? or is there anybody trying to fix it ?

i have the same problem.

tefloncoder commented 9 years ago

hi, same issue for me as well. Can someone help? I get the error: Class 'cassandra' not found in ....

ghost commented 9 years ago

https://github.com/datastax/php-driver

tefloncoder commented 9 years ago

thanks a lot, made good progress. I have downloaded the required software like CMake etc. Got the following error when running vc_build

fatal: Not a git repository (or any of the parent directories): .git

Error came in this section of the batch file

IF NOT EXIST "!ABSOLUTE_DEPENDENCIES_CPP_DRIVER_SOURCE_DIRECTORY!\include\cassandra.h" ( PUSHD "!ABSOLUTE_BATCH_DIRECTORY!.." > NUL ECHO Update cpp-driver submodule > "!LOG_CPP_DRIVER_BUILD!" ECHO | SET /P=Update cpp-driver submodule ... !GIT! submodule update --init --recursive >> "!LOG_CPP_DRIVER_BUILD!" 2>&1 IF !ERRORLEVEL! EQU 0 ( ECHO done. POPD ) ELSE ( pause ECHO FAILED! ECHO See !LOG_CPP_DRIVER_BUILD! for more details EXIT /B !EXIT_CODE_CLONE_FAILED! )

)

On Sat, 8/22/15, moldcraft notifications@github.com wrote:

Subject: Re: [php-cassandra] cassandra.so is not being loaded (#11) To: "aparkhomenko/php-cassandra" php-cassandra@noreply.github.com Cc: "tefloncoder" krishc@zenstill.com Date: Saturday, August 22, 2015, 8:00 AM

https://github.com/datastax/php-driver

— Reply to this email directly or view it on GitHub.

jfoliveira commented 6 years ago

Hi,

Similar issue here. Any ideas about what's wrong with my installation procedure? Details below.

Environment:

PHP: 7.1 Ubuntu 18.04 LTS (GNU/Linux 4.15.0-1007-aws x86_64)

Error message:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/20160303/cassandra.so' 
- /usr/lib/php/20160303/cassandra.so:
undefined symbol: zend_ce_countable in Unknown on line 0

Actually 20160303/cassandra.so is a symlink that I created as I don't know why the 20160303 folder is being referred by PHP as the cassandra.so file only exists in directory 20170718/cassandra.so

/usr/lib/php/20160303/cassandra.so -> /usr/lib/php/20170718/cassandra.so

Installation script:

Below is the sequence of commands that I used for installing the cassandra extension:

# Removes/uninstall existing versions
dpkg -P cassandra-cpp-driver-dev && \
dpkg -P cassandra-cpp-driver && \
dpkg -P libuv && \
dpkg -P libuv-dev && \
dpkg -P libuv_1.18.0-1

# Install dependencies
add-apt-repository -y ppa:ondrej/php && \
add-apt-repository -y ppa:ondrej/nginx && \
apt-get update && \
apt-get install -y wget && \
apt-get install -y build-essential git libpcre3-dev php7.1-dev && \
apt-get install -y libgmp-dev && \
apt-get install -y libssl-dev

# Download drivers
wget http://downloads.datastax.com/cpp-driver/ubuntu/16.04/dependencies/libuv/v1.18.0/libuv_1.18.0-1_amd64.deb && \
wget http://downloads.datastax.com/cpp-driver/ubuntu/16.04/dependencies/libuv/v1.18.0/libuv-dev_1.18.0-1_amd64.deb && \
wget http://downloads.datastax.com/cpp-driver/ubuntu/16.04/cassandra/v2.8.0/cassandra-cpp-driver_2.8.0-1_amd64.deb && \
wget http://downloads.datastax.com/cpp-driver/ubuntu/16.04/cassandra/v2.8.0/cassandra-cpp-driver-dev_2.8.0-1_amd64.deb

# Build C++ driver
dpkg -i --force-overwrite libuv_1.18.0-1_amd64.deb && \
dpkg -i --force-overwrite libuv-dev_1.18.0-1_amd64.deb && \
dpkg -i cassandra-cpp-driver_2.8.0-1_amd64.deb && \
dpkg -i cassandra-cpp-driver-dev_2.8.0-1_amd64.deb

# Install Cassandra PHP extension
pecl channel-update pecl.php.net && \
pecl install cassandra

# Enable PHP extension - Cassandra
PHP_VERSION=7.1
echo "extension=cassandra.so" >> /etc/php/${PHP_VERSION}/mods-available/cassandra.ini
ln -s /etc/php/${PHP_VERSION}/mods-available/cassandra.ini /etc/php/${PHP_VERSION}/cli/conf.d/30-cassandra.ini

Any ideas on how to fix this?

jfoliveira commented 6 years ago

I fixed the issue below. Actually I have messed up my environment by installing PHP 7.2 first and then downgraded to 7.1. For some reason extensions cassandra.so existent in the 7.2 extension directory, but not in /usr/lib/php/20160303. Symlink-ing to the file did not work. I setup a new Ubuntu 18.04 machine, with only PHP 7.1 and the script I mentioned above worked flawlessly. :)