php - Accessing an Amazon RDS MySQL database from CodeIgniter leads a blank display -


this related this previous question. i'm making new question because @ point believe it's database access issue.

essentially, i've switched database mysql sever amazon rds mysql server, due server migration. summarize, i'm attempting migrate php site based on codeigniter (version 1.7.2) new server has amazonlinux os. previous server ubuntu, running php 5.3.3-1ubuntu9.5 on apache2. php version on new amazonlinux server 5.3.29, running on httpd.

the problem is, when try access url in new server, blank display. code stopping in system/core/codeigniter.php @ line:

$ci = new $class(); 

the last line of application log this:

debug - 2015-04-25 17:17:58 --> database driver class initialized 

so, it's happening around database. i've read blank display if it's database issue due "@" being used database-related messages.

these settings in database.php:

$active_group = "default"; $active_record = true; $db['default']['hostname'] = "xxxxx.xxxxxxxx.us-east-1.rds.amazonaws.com"; $db['default']['username'] = "xxxxx"; $db['default']['password'] = "xxxxx"; $db['default']['database'] = "xxxxx"; $db['default']['dbdriver'] = "mysql"; $db['default']['port'] = 3306; $db['default']['dbprefix'] = ""; $db['default']['pconnect'] = true; $db['default']['db_debug'] = "true"; // $db['default']['cache_on'] = false; $db['default']['cache_on'] = false; $db['default']['cachedir'] = "/opt/xxxxx/cachedb/"; $db['default']['char_set'] = "utf8"; $db['default']['dbcollat'] = "utf8_general_ci"; 

i tried without port specified (as it's set on current production site) port specified @ end of url:

$db['default']['hostname'] = "xxxxx.xxxxxxxx.us-east-1.rds.amazonaws.com:3306"; 

but i'm still getting blank display.

we have java/tomcat application running on same server able access rds database, using same url, name , password, doesn't appear issue of security groups.

any thoughts on problem might be? , if how solve?

edit 1: i've tracked down problem - not surprisingly, it's database driver. fails when calling function: system/database/drivers/mysqli/mysqli_driver.php: function db_pconnect()

the question is, can copy in more recent driver older version of codeignitor , miraculously work? i'll try experiment tomorrow. otherwise, might looking @ upgrade. grim, should theoretically work, since have up-to-date driver. right?

the problem turned out database access issue. specifically, version of php on new server turned out not support deprecated calls php-mysql apis (e.g. @mysql_pconnect or @mysql_connect)

the solution to

1) download mysql library supports legacy calls. in case of amazonlinux, accomplished follows:

sudo yum install php-mysql 

2) find library downloaded e.g.

find / -name mysql.so 

this may have been shown in install well, way find anytime. ymmv, in case, library name was:

/usr/lib64/php-zts/modules/mysql.so 

3) change php.ini (as shown in phpinfo when called php page on httpd/apached server) follows:

a) change "extension_dir" show mysql.so installed:

extension_dir = "/usr/lib64/php-zts/modules"  

b) add following lines:

extension=mysqli.so extension=mysql.so extension=pdo_mysql.so 

reboot apache , should go.

note: specific legacy call not supported, part of of version of codeignitor i'm working with, this:

   return @mysql_pconnect($this->hostname, $this->username, $this-// etc.  

the php error log showed error:

 php fatal error:  call undefined function mysql_connect() in xxx.php on line xx 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -