Concrete setup cannot find my database?

Permalink
New to c5, i have been producing sites for the last 5 years with CMS software developed by a PHP programmer. The package is great but i have all my eggs in one basket and the support of one person?!?

Having spent almost a month looking at all the other CMS system on offer I decided that the emense positive feedback that is on the internet regarding C5 points to one fact - try it!

Everything so far is working except i cannot get the sepup screen to connect with the database. First off i had and underscore in the db name so i removed that, then in a post on this site i found a similar problem:

"If you have special characters such as /:?_ in your dsn, then you need to rawurlencode them first:

$dsn2=rawurlencode("sybase_ase")."://user:[email protected]/path?query";


So I removed the underscores from my database name and concrete5 connected no problem".

As my webhost has created a host name of 'localhost:/tmp/mysql5.sock' (: in the name) is the above code the possible answer to my problems? if so how and where do i use it. (All tick boxes in the setup screen are green)

Excited about getting started with C5. Thank you in advance.

View Replies:
ryan replied on at Permalink Reply
ryan
Underscores are fine in the database names, I wouldn't worry about that.

just use: "localhost" for the host and keep your password letters and numbers no ?!@*&%$# etc..
sappo replied on at Permalink Reply
Hi Ryan, thanks for the very prompt reply. I started from the beginning again, created a new database, kept the simple password and used 'Localhost' as the server name. Still wont connect? The spec of the server meets all requirements, the only thing i had to add was an .htaccess file (in the root) to tell the site to use PHP5 and not 4.

Is now the time to suffer the support phone line of my ISP? Very frustraiting when you get all the green lights but it wont connect!
ryan replied on at Permalink Reply
ryan
Have you tried a test page using:

mysql_connect()
or something real simple, just to verify your host/db/u/p do actually work?

Also, in your post I saw that you said 'Localhost' not 'localhost' don't think that matters, but thought I'd mention that.

if you're still having issues post a phpinfo file so folks can take a look at your php setting although this stuff should just work y'know.
sappo replied on at Permalink Reply
OK, just uploaded a PHP file to manualy test the connection. Would not work with 'localhost' but did connect OK using 'localhost:/tmp/mysql5.sock'

Script used:
<?php
mysql_connect("localhost:/tmp/mysql5.sock", "dbo301003743", "xxxxxx") or die(mysql_error());
echo "Connected to MySQL<br />";
mysql_select_db("db301003743") or die(mysql_error());
echo "Connected to Database";
?>


Message returned:
Connected to MySQL
Connected to Database

I am a designer with no programming experience here. Starting to get out of my depth a little. Found a tutorial on the internet for the above script. I will have to find out what this phpinfo file is??

Thanks again Ryan
sappo replied on at Permalink Reply
I have uploaded a phpinfo file herehttp://dev5.evolve365.com/info.php... to you can see all info.

Hope i can get this resolved?? Thanks in advance.
ryan replied on at Permalink Reply
ryan
Here's some info
Concrete uses the adodb library, docs are here
http://phplens.com/lens/adodb/docs-adodb.htm...

The datasource identifier is in this format
<?php
$dsn = 'mysql://user:[email protected]/database'; 
?>


The code that makes the database connection is here:
[site root]/concrete/libraries/loader.php
around line 164

I'm assuming that your strait db connection doesn't work if you don't specify the mysql socket as /tmp/mysql5.sock

You may want to change dsn in loader.php to be rawurlencoded like this:
<?php
if ($server == null && defined('DB_SERVER')) {   
   $dsn = DB_TYPE . '://' . DB_USERNAME . ':' . rawurlencode(DB_PASSWORD) . '@' . rawurlencode(DB_SERVER) . '/' . DB_DATABASE;
} else if ($server) {
   $dsn = DB_TYPE . '://' . $username . ':' . rawurlencode($password) . '@' . rawurlencode($server) . '/' . $database;
}
?>


It's probably not connecting because it's expecting a database name to follow the "/" char that's defining the socket in your connection string.

If modifying that loader file is over your head, let me know & I'll post a modified loader.php file for you.
sappo replied on at Permalink Reply
Hi Ryan, Thanks again for your help. If you could post a modified loader.php file i would be extreamly grateful. I only started looking at PHP a week ago?? Need to buy a book to start getting my head round some of this, even if it is to just understand the help i get from the forum. Just amended my direct connection PHP file to remove the data after localhost and get the following error:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user: [email protected]' (Using password: YES) in /homepages/20/d134205747/htdocs/concrete5_test/test3.php on line 8
Access denied for user: [email protected]' (Using password: YES)

Can't beleive the support i am getting and i haven't even bought any of your lovely plugins yet!! Cheers
ryan replied on at Permalink Reply 1 Attachment
ryan
Here's the file, I tested it locally and it didn't break anything.

Try renaming your existing loader.php to loader-bak.php or something, then copy this file to:
/concrete/libraries/loader.php

Thanks for the compliment... It'll feel a little more like good support if it actually works ;-)
ryan replied on at Permalink Reply 1 Attachment
ryan
Here's the file, I tested it locally and it didn't break anything.

Try renaming your existing loader.php to loader-bak.php or something, then copy this file to:
/concrete/libraries/loader.php

Thanks for the compliment... It'll feel a little more like good support if it actually works ;-)
sappo replied on at Permalink Reply
Ryan, you are a star. The revised loader file worked a treat. I can now start playing.... which c5 Add-on shall i start with??? Superfish looks pretty damn good. I will give c5 some possitive feedback once i have learn't a bit more. As a bit of a cheak, can you recommend a good beginners book on PHP. I don't want to master it, just have a greater understanding to help build my themes etc. Thanks again.