Welcome Guest, Not a member yet? Register   Sign In
Database Error Occured
#1

We have a project which initially made in xampp (windows) but should be ran on Linux. I installed CentOS  7 ( 7.3.1611) and used MariaDB as it is default DB. PHP version is 5.4.16. I dumped exact sql script generated from xampp to the server (CentOS) and added same username and pw and gave permission to access project's database. I got plenty of errors such as errors related with .htaccess and i fixed them. Now, I stuck with this database error: 

A Database Error Occurred

Unable to connect to your database server using the provided settings.

Filename: core/CodeIgniter.php

Line Number: 515.

I checked settings on database.php and seemed right. Settings are the following:

$db['default'] = array(
        'dsn'   => '',
        'hostname' => 'localhost',
        'username' => '*****',
        'password' => '******,
        'database' => '******',
        'dbdriver' => 'mysqli',
        'dbprefix' => '',
        'pconnect' => FALSE,
        'db_debug' => (ENVIRONMENT !== 'production'),
        'cache_on' => FALSE,
        'cachedir' => '',
        'char_set' => 'utf8',
        'dbcollat' => 'utf8_general_ci',
        'swap_pre' => '',
        'encrypt' => FALSE,
        'compress' => FALSE,
        'stricton' => FALSE,
        'failover' => array(),
        'save_queries' => TRUE
);

If I changed hostname to its IP address I got HTTP ERROR 500 and also same error if I connect to xampp's mysql using it's IP address. Can someone help me to fix this problem? Is my dbdriver setting correct since the database in my CentOS is MariaDB? Is there a way I could see the exact error instead of giving me HTTP ERROR 500?
Reply
#2

I found the cause of the error. It was on MariaDB server configuration. Now my problem is how to remove index.php in all our project's links. I tried answered post from stockoverflow and other sources but to no avail.
Reply
#3

The following doesn't work:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

Any other way?
Reply
#4

Do you have apache module mod_rewrite enabled on your centos server? this module handles the rewriting
Reply
#5

(This post was last modified: 02-01-2017, 01:35 AM by edeaux.)

(01-31-2017, 06:06 AM)eagle00789 Wrote: Do you have apache module mod_rewrite enabled on your centos server? this module handles the rewriting

Yes, it was enabled. I changed our server from CentOS 7 to CentOS 5.11 and installed PHP 5.3.3. So far everthing works well. The .htaccess settings that worked in our server (CentOS 5.11) are the following:

RewriteEngine On
RewriteBase /~project_WEB/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

I got the settings from http://stackoverflow.com/questions/28258...-directory.

I will install again CentOS 7 and applied the said .htaccess if it worked.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB