Welcome Guest, Not a member yet? Register   Sign In
Subdomains and Codeigniter
#11

[eluser]JanDoToDo[/eluser]
I removed the htaccess - no success. config file is set:

$config['root_url'] = 'http://' . $_SERVER['HTTP_HOST'] . '/';
$config['base_url'] = '/';
$config['images_url']= '/assets/images/';
$config['scripts_url'] = '/assets/scripts/';
$config['css_url'] = '/assets/styles/';

database all vars are set according to server (localhost, user, pass db name)

The CodeIgniter is installed at sub.domain.com where actual location is ( /home/public_html/sub/(system, application, index.php etc) )
htacess as above.

Server information:
Apache version 2.2.11 (Unix)
PHP version 5.2.9
MySQL version 5.0.85-community

And the error is just

A Database Error Occurred
Unable to connect to your database server using the provided settings.

There is no other CI installation (incl in the main domain)

Does SOMEONE have any other ideas apart from what has been talked about ?! pleeeeeeeeeeeeeeeeeease!!
#12

[eluser]Kip zonder Kop[/eluser]
[quote author="JanDoToDo" date="1261985652"]I removed the htaccess - no success. config file is set:

$config['root_url'] = 'http://' . $_SERVER['HTTP_HOST'] . '/';
$config['base_url'] = '/';
$config['images_url']= '/assets/images/';
$config['scripts_url'] = '/assets/scripts/';
$config['css_url'] = '/assets/styles/';

[/quote]

I would have expected base_url to be something like http://sub.domain.com/
It's time to show us your database.php from the application/config directory. We don't want to know username/passwords but show us your hostname.
#13

[eluser]JanDoToDo[/eluser]
$db['default']['hostname'] = "localhost";
$db['default']['username'] = "xxx";
$db['default']['password'] = "xxx";
$db['default']['database'] = "squaresa_lintel";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";
#14

[eluser]Kip zonder Kop[/eluser]
[quote author="JanDoToDo" date="1262021712"]$db['default']['hostname'] = "localhost";
$db['default']['username'] = "xxx";
$db['default']['password'] = "xxx";
$db['default']['database'] = "squaresa_lintel";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";[/quote]

Where is you database being served by MySQL? On sub.domain.com or on www.domain.com. If the latter, I would change $db['default']['hostname'] = "localhost"; to $db['default']['hostname'] = "www.domain.com";
#15

[eluser]JanDoToDo[/eluser]
Changing that also didnt help. I wish the error was more informative!

Many thanks for your rersponse though. Any more ideas? I spoke to my host about what you just mentioned and they said the subdomain should still have a hostname of localhost.
#16

[eluser]rogierb[/eluser]
Do you have acces to phpmyadmin? If you do, check what privileges the user has.
You can check:
* logging in with the user
* logging in with a root user and checking what host, username, pwd and such
* logging in with a root user and checking privileges for the user.
#17

[eluser]JanDoToDo[/eluser]
The user has full priviledges and have tested with a number of people. I was just alternating all of the settings and I just found that it works if i change "pconnect" to false instead of true. Maybe someone could explain what the significance of this is or direct me to some literature? Smile Also, It only loaded the default controller even if i had a URI segment (1) of a different controller. I had to change the URI protocol to REQUEST_URI before it would work. Im only a CI noobie so dont really understand these settings!

Many thanks if any explanation could be given and also for the comments Smile
#18

[eluser]rogierb[/eluser]
The uri protocol depends on your webserver. Normally 'auto' would do but on some server setups another protocol has to be used.
This all has to do with how the Router class reads the $_SERVER variable.

As for 'pconnect', this has to do with how php connects with your database. Assuming you run mysql, if you set pconnect to true CI realises a persistent database connection(mysql_pconnect). The connection will not be severed after the script has finished. Hence the persistent part.

If you set pconnect to false, CI will connect using mysql_connect and a 'new' conenction is setup everytime someone visits a page.
#19

[eluser]JanDoToDo[/eluser]
So in that case is it possible that the server doesnt allow persistent database connections? Would that be a possible reason for it not working when pconnect is set to true or is that not possible?
#20

[eluser]rogierb[/eluser]
That would be my guess.
You can ask you host if a persistent connection is disabled.




Theme © iAndrew 2016 - Forum software by © MyBB