Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

author
message
[Level:0]ptitco

# Post subject:Re: Cannot connect to database

profile

registered: 04/19/2013

IP: *.76.201.116

I also downloaded Query Browser and connected okay to the database and changed the connection in the imap_redbean.php file port to 33000 as it was in Query Manager and I'm still getting the same error.

I also verified that php is running using aptitude.

Quote
[Level:8]CUBRID

# Post subject:Re: Cannot connect to database

profile

registered: 03/28/2010

IP: *.181.249.254

Hi,

Redbean uses the PDO driver. We managed to reproduce your problem and found the following solution:

1. Install php-pear (required for pecl command):

sudo apt-get install php-pear

2. Install cubrid pdo driver:

sudo pecl install pdo-cubrid-8.4.3.0001

3. Add the following 2 lines to php.ini (If you use php5-cli, then the path should be /etc/php5/cli/php.ini):

[PDO_CUBRID]
extension=pdo_cubrid.so

After this, rerun the original command and the connection should be successful.

If you encounter any problems, let us know.

Regards,

The CUBRID Team

Quote
[Level:0]ptitco

# Post subject:Re: Cannot connect to database

profile

registered: 04/19/2013

IP: *.76.201.116

Hello and THANK YOU so much.  I really want to get this working, however I"m getting the same error:  I have started Apache and Cubrid Manager is running on port 33000 which I have in the imap_redbean.php file.  Can you upload your imap_redbean.php and rb.php file possibly?  I cut and pasted it from the instructions but maybe I have missed something???  I have spent hours on it so far and I'm determined not to give up!  Please help if you can with below errors...

chris@ubuntu:~/Documents$ php5 ./imap_redbean.php

PHP Fatal error:  Uncaught exception 'PDOException' with message 'Could not connect to database.' in /home/chris/Documents/rb.php:194

Stack trace:

#0 /home/chris/Documents/rb.php(241): RedBean_Driver_PDO->connect()

#1 /home/chris/Documents/rb.php(274): RedBean_Driver_PDO->runQuery('SELECT * FROM `...', Array)

#2 /home/chris/Documents/rb.php(1406): RedBean_Driver_PDO->GetAll('SELECT * FROM `...', Array)

#3 /home/chris/Documents/rb.php(1913): RedBean_Adapter_DBAdapter->get('SELECT * FROM `...', Array)

#4 /home/chris/Documents/rb.php(3520): RedBean_QueryWriter_AQueryWriter->selectRecord('email', Array, Array, false, false, false)

#5 /home/chris/Documents/rb.php(5405): RedBean_OODB->find('email', Array, Array)

#6 /home/chris/Documents/rb.php(5454): RedBean_Finder->find('email', ' messageID = :m...', Array)

#7 /home/chris/Documents/rb.php(5946): RedBean_Finder->findOne('email', ' messageID = :m...', Array)

#8 /home/chris/Documents/imap_redbean.php(39): RedBean_Facade::findOne('email', ' messageID = :m...', Array)

#9 {main}

  thrown in /home/chris/Documents/rb.php on line 194

chris@ubuntu:~/Documents$ 

Quote
[Level:0]ptitco

# Post subject:Re: Cannot connect to database

profile

registered: 04/19/2013

IP: *.76.201.116

I also installed php5-mysql and restarted apache.  imap_redbean.php says it's using port 30000.  Would that matter?  I can connect on either port 33000 or 30000 through Query Browser...

Quote
[Level:8]CUBRID

# Post subject:Re: Cannot connect to database

profile

registered: 03/28/2010

IP: *.12.177.230

In order to resolve your issue, we must first be sure that cubrid pdo driver is loaded by php5. Since you can connect through CUBRID Query Browser, I am sure that the database is running, so the only possible reason is that the driver is not found.

We tested on Ubuntu 12.04 32 bit. Is this the same as your version?

Here: http://www.cubrid.org/cubrid_pdo_driver you can see several examples on how to test the cubrid pdo driver. The first one is the most important. Please try this code in a php file:

<?php
  echo 'PDO Drivers available:
';
  foreach(PDO::getAvailableDrivers() as $driver)
  {
   if($driver == "cubrid") {
     echo " - Driver: <b>".$driver.'</b>
';
   } else {
     echo " - Driver: ".$driver.'
';
   }
  }    
?>

This code returns Driver:<b>cubrid</b> if the driver is found. Another test is to run:

php5 -m

from command line. This command should return among other modules pdo_cubrid also.

After we find out if the cubrid driver is loaded correctly, then we can see if another issue leads to your problem. We encountered the same error (Could not connect to database) when the pdo driver was not loaded. Also, do you have a pdo_cubrid.so file on your system (you can search for it using locate command) ?

Quote
[Level:0]ptitco

# Post subject:Re: Cannot connect to database

profile

registered: 04/19/2013

IP: *.76.201.116

Hello and thank you.  This is what I found:

I ran your php test code on localhost and it returned and said "PDO Drivers Available:  Driver MySQL

So I'm guessing that since it didn't find Cubrid driver that something is wrong?

Also, cubrid.so file in usr/lib/php5/20090626+lfs

php5 -m file tells me a list of things

[php modules]
CUBRID
imap
PDO
PDO_mysql

I did read some documentation that said with LAMP I could install the mysql drivers and it would install pdo but that did not help.

I tried to install Pear as instructed earlier and set the Cubrid directory to /opt/Cubrid install and there were some errors upon installation. 

 

 

Quote
[Level:0]ptitco

# Post subject:Re: Cannot connect to database

profile

registered: 04/19/2013

IP: *.76.201.116

Also I tried installing Cubrid PDO driver as above and I think the filename is incorrect?  I tried it without the dash like this:

"sudo pecl install pdo-cubrid-8.4.3.0001"  It didn't like the dash after pdo so left it out and it seemed like it loaded something.  Here is the error file

 

chris@ubuntu:~/Documents$ sudo pecl install pdo-cubrid

parsePackageName(): "cubrid" is neither a valid version nor a valid state in "pdo-cubrid"

invalid package name/package file "pdo-cubrid"

install failed

chris@ubuntu:~/Documents$ sudo pecl install pdo-cubrid-8.4.3.0001

parsePackageName(): only one version/state delimiter "-" is allowed in "pdo-cubrid-8.4.3.0001"

invalid package name/package file "pdo-cubrid-8.4.3.0001"

install failed

chris@ubuntu:~/Documents$ sudo pecl install pdo cubrid-8.4.3.0001

Ignoring installed package pecl/cubrid

WARNING: "pecl/PDO" is deprecated in favor of "channel://http://svn.php.net/viewvc/php/php-src/trunk/ext/pdo//ext/PDO"

downloading PDO-1.0.3.tgz ...

Starting to download PDO-1.0.3.tgz (52,613 bytes)

.............done: 52,613 bytes

12 source files, building

running: phpize

Configuring for:

PHP Api Version:         20090626

Zend Module Api No:      20090626

Zend Extension Api No:   220090626

building in /tmp/pear/temp/pear-build-rootCH7GJb/PDO-1.0.3

running: /tmp/pear/temp/PDO/configure

checking for grep that handles long lines and -e... /bin/grep

checking for egrep... /bin/grep -E

checking for a sed that does not truncate output... /bin/sed

checking for cc... cc

checking whether the C compiler works... yes

checking for C compiler default output file name... a.out

checking for suffix of executables...

checking whether we are cross compiling... no

checking for suffix of object files... o

checking whether we are using the GNU C compiler... yes

checking whether cc accepts -g... yes

checking for cc option to accept ISO C89... none needed

checking how to run the C preprocessor... cc -E

checking for icc... no

checking for suncc... no

checking whether cc understands -c and -o together... yes

checking for system library directory... lib

checking if compiler supports -R... no

checking if compiler supports -Wl,-rpath,... yes

checking build system type... i686-pc-linux-gnu

checking host system type... i686-pc-linux-gnu

checking target system type... i686-pc-linux-gnu

checking for PHP prefix... /usr

checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64

checking for PHP extension directory... /usr/lib/php5/20090626+lfs

checking for PHP installed headers prefix... /usr/include/php5

checking if debug is enabled... no

checking if zts is enabled... no

checking for re2c... no

configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.

checking for gawk... no

checking for nawk... nawk

checking if nawk is broken... no

checking whether to enable PDO support... yes, shared

checking how to print strings... printf

checking for a sed that does not truncate output... (cached) /bin/sed

checking for fgrep... /bin/grep -F

checking for ld used by cc... /usr/bin/ld

checking if the linker (/usr/bin/ld) is GNU ld... yes

checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B

checking the name lister (/usr/bin/nm -B) interface... BSD nm

checking whether ln -s works... yes

checking the maximum length of command line arguments... 1572864

checking whether the shell understands some XSI constructs... yes

checking whether the shell understands "+="... yes

checking how to convert i686-pc-linux-gnu file names to i686-pc-linux-gnu format... func_convert_file_noop

checking how to convert i686-pc-linux-gnu file names to toolchain format... func_convert_file_noop

checking for /usr/bin/ld option to reload object files... -r

checking for objdump... objdump

checking how to recognize dependent libraries... pass_all

checking for dlltool... no

checking how to associate runtime and link libraries... printf %s

checking for ar... ar

checking for archiver @FILE support... @

checking for strip... strip

checking for ranlib... ranlib

checking for gawk... (cached) nawk

checking command to parse /usr/bin/nm -B output from cc object... ok

checking for sysroot... no

checking for mt... mt

checking if mt is a manifest tool... no

checking for ANSI C header files... yes

checking for sys/types.h... yes

checking for sys/stat.h... yes

checking for stdlib.h... yes

checking for string.h... yes

checking for memory.h... yes

checking for strings.h... yes

checking for inttypes.h... yes

checking for stdint.h... yes

checking for unistd.h... yes

checking for dlfcn.h... yes

checking for objdir... .libs

checking if cc supports -fno-rtti -fno-exceptions... no

checking for cc option to produce PIC... -fPIC -DPIC

checking if cc PIC flag -fPIC -DPIC works... yes

checking if cc static flag -static works... yes

checking if cc supports -c -o file.o... yes

checking if cc supports -c -o file.o... (cached) yes

checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes

checking whether -lc should be explicitly linked in... no

checking dynamic linker characteristics... GNU/Linux ld.so

checking how to hardcode library paths into programs... immediate

checking whether stripping libraries is possible... yes

checking if libtool supports shared libraries... yes

checking whether to build shared libraries... yes

checking whether to build static libraries... no

configure: creating ./config.status

config.status: creating config.h

config.status: executing libtool commands

running: make

/bin/bash /tmp/pear/temp/pear-build-rootCH7GJb/PDO-1.0.3/libtool --mode=compile cc  -I. -I/tmp/pear/temp/PDO -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootCH7GJb/PDO-1.0.3/include -I/tmp/pear/temp/pear-build-rootCH7GJb/PDO-1.0.3/main -I/tmp/pear/temp/PDO -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/PDO/pdo.c -o pdo.lo

libtool: compile:  cc -I. -I/tmp/pear/temp/PDO -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootCH7GJb/PDO-1.0.3/include -I/tmp/pear/temp/pear-build-rootCH7GJb/PDO-1.0.3/main -I/tmp/pear/temp/PDO -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/PDO/pdo.c  -fPIC -DPIC -o .libs/pdo.o

/bin/bash /tmp/pear/temp/pear-build-rootCH7GJb/PDO-1.0.3/libtool --mode=compile cc  -I. -I/tmp/pear/temp/PDO -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootCH7GJb/PDO-1.0.3/include -I/tmp/pear/temp/pear-build-rootCH7GJb/PDO-1.0.3/main -I/tmp/pear/temp/PDO -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/PDO/pdo_dbh.c -o pdo_dbh.lo

libtool: compile:  cc -I. -I/tmp/pear/temp/PDO -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootCH7GJb/PDO-1.0.3/include -I/tmp/pear/temp/pear-build-rootCH7GJb/PDO-1.0.3/main -I/tmp/pear/temp/PDO -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/PDO/pdo_dbh.c  -fPIC -DPIC -o .libs/pdo_dbh.o

/tmp/pear/temp/PDO/pdo_dbh.c: In function 'pdo_stmt_instantiate':

/tmp/pear/temp/PDO/pdo_dbh.c:410:8: error: 'zval' has no member named 'refcount'

/tmp/pear/temp/PDO/pdo_dbh.c:411:8: error: 'zval' has no member named 'is_ref'

/tmp/pear/temp/PDO/pdo_dbh.c: In function 'pdo_stmt_construct':

/tmp/pear/temp/PDO/pdo_dbh.c:435:6: error: 'zend_fcall_info' has no member named 'object_pp'

/tmp/pear/temp/PDO/pdo_dbh.c:458:6: error: 'zend_fcall_info_cache' has no member named 'object_pp'

/tmp/pear/temp/PDO/pdo_dbh.c: In function 'zim_PDO_setAttribute':

/tmp/pear/temp/PDO/pdo_dbh.c:752:12: error: 'zval' has no member named 'refcount'

/tmp/pear/temp/PDO/pdo_dbh.c: In function 'zim_PDO_getAttribute':

/tmp/pear/temp/PDO/pdo_dbh.c:818:28: error: 'zval' has no member named 'refcount'

/tmp/pear/temp/PDO/pdo_dbh.c: In function 'pdo_hash_methods':

/tmp/pear/temp/PDO/pdo_dbh.c:1122:24: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]

/tmp/pear/temp/PDO/pdo_dbh.c:1126:20: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]

make: *** [pdo_dbh.lo] Error 1

ERROR: `make' failed

chris@ubuntu:~/Documents$ 

Quote
[Level:3]Esen Sagynov

# Post subject:Re: Cannot connect to database

profile

registered: 05/31/2011

IP: *.91.139.82

Hello ptitco,

The command to install CUBRID PDO driver you've tried above is incorrect. Your code tries to install the PDO extention, not CUBRID PDO driver.

According to CUBRID PDO driver installation instructions the package name uses the underscrore followed by a package version as follows:

sudo pecl install pdo_cubrid-8.4.3.0001

I've just tried and it works seamlessly.

Please try this  command and let me know if you have any issues. I will be glad to help you.

Quote
[Level:0]ptitco

# Post subject:Re: Cannot connect to database

profile

registered: 04/19/2013

IP: *.76.201.116

Hello!  YES!  That seemed to work!  I got it to read all my gmail message ID's in the inbox.

In the messageID it is a very long string of characters and not the actual email address.  Is there a way to fix that?

Quote
[Level:3]Esen Sagynov

# Post subject:Re: Cannot connect to database

profile

registered: 05/31/2011

IP: *.91.139.82

messageID is not an email address. It is an ID the service provider sets to an email message.

As you can notice the tutorial has the following block:

/* for every email... */
foreach($emails as $email_number)
{
     /*  get information specific to this email
          returns an array with the following properies:
          subject, from, to, date, message_id, references,
          in_reply_to, size, uid, msgno, recent, flagged, answered,
          deleted, seen, draft, and udate.
     */
     $overview = imap_fetch_overview($inbox, $email_number);
     $email_overview = &$overview[0];
 
     /*********************************************************
      ********** HERE COMES THE REDBEAN ************************
      *********************************************************/
 }

You can see that it calls PHP's imap_fetch_overview($inbox, $email_number) function. Check its documentation in PHP manual. To get email address, you will need to set from or to fields to a bean.

$bean->from = $email_overview->from;

Then you will get an email.

Once again, check the PHP documentation. There are many more properties of an email that you can access.

Quote
[Level:0]ptitco

# Post subject:Re: Cannot connect to database

profile

registered: 04/19/2013

IP: *.76.201.116

That's great.  Yes I got it to work.  Thanks for the example I appreciate it.  I just added the new bean to the imap_redbean.php file and it captured the email address..

Thanks again for getting this to work with me.  I didn't know much about Cubrid and redbean but it is awesome and I'm going to try to learn more about it.  Thanks so much for your great support!!

Quote
[Level:3]Esen Sagynov

# Post subject:Re: Cannot connect to database

profile

registered: 05/31/2011

IP: *.91.139.82

I'm glad it worked out well for you! Let me know if you have any other questions.

Quote




You are either using a very old browser or a browser that is not supported.
In order to browse cubrid.org you need to have one of the following browsers:



Internet Explorer: Mozilla Firefox: Google Chrome: