• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Localhost Install Driving Me Crazy

Hi Guys,

Sorry to be a pain but i am pulling my hair out trying to get a local install of a codeigniter site working on my pc.

I have installed WAMP. It works fine. I have enabled the Apache rewrite_module.

I have installed the latest version of CodeIgniter into the www folder of wamp. CodeIgniter works and loads the expected welcome view.

I then did a dump of the mysql database of the online codeigniter site i'm trying to play with. the database is called ece_db. I created this on my localhost and loaded in the data.

I then ftp'd the codeigniter site from the web (which works fine online) to my pc. I saved it in the folder wamp/www/ece/

I then edited the www/ece/application/config/config.php file to say

$config['base_url'] = 'http://localhost/ece/';

I then edited the www/ece/application/config/database.php file to say:

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = '';
$db['default']['password'] = '';
$db['default']['database'] = 'ece_db';
$db['default']['dbdriver'] = 'mysql';

Finally, I changed the www/ece/.htaccess file to have:

<IfModule mod_rewrite.c>
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

#RewriteEngine On
#RewriteCond %{HTTP_HOST} !^localhost/ece/$ [NC]
#RewriteRule ^(.*)$ http://localhost/ece/$1 [R=301,L]

I don't know what else there is to change. However when i point my browser to http://localhost/ece/ i get a 500 internal server error. I can't work out why!! Driving me crazy.

Can anyone advise whether a) i've done anything wrong and/or b) suggest other files or areas that may be the problem to help me troubleshoot??



Try setting your base_url:
$config['base_url'] = '';

Rename your .htaccess file and see if it works without it.

Also you can try different :

$config['uri_protocol'] = 'AUTO';

As suggested, i set $config['base_url'] = ''; and $config['uri_protocol'] = 'AUTO'; was already AUTO.

I then renamed the .htaccess file to something meaningless

Now i just get a blank white page...

what does that mean?

Try doing a view page source and see if there are any wierd characters, also make sure your editor is set to not use the BOM.

As far as the uri_protocol try different one beside AUTO.

Sorry - i didn't have the services running - hence the blank page.

Instead, now it displays an database error:

A Database Error Occurred
Unable to select the specified database: ece_db

Filename: J:\wamp\www\ece\system\database\DB_driver.php

Line Number: 140

Don't know why...?

Did you start the MySQL Service? You need to start the MySQL Service for the database to work. I use Xampp not WAMP.

If the service is running then it may not be configured correct for the port etc;

Yep the MySQL service is fine.

It seems to be unable to select the db but the db name is correct and matches what's in the config file.

Any idea how i would change port configuration or even check if it is correct?

thanks for your help

After looking in the php.ini file it appears that the mysql default port is 3306

You can try to connect using a pure MySQL script in a new file.
$db_conn = mysqli_connect("localhost", "User_name", "password", "database_name");
// Evaluate the connection
if (mysqli_connect_errno())
    echo mysqli_connect_error();
    echo "Successful database connection, happy coding!!!";

Excellent - thanks so much. that code brought up a mysql error saying it was an ID issue. I put the username as root with no password and it worked. thanks so much - everything is fine now. Smile

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.