I have codeigniter powered application and whenever i tried to log in on local server it doesn't let me in without any error message. But when I login in live server it works fine.
#What might be main causes of this issue.
#My config file and database settings are correct
$config['sess_match_useragent'] = FALSE;
$config['phpass_hash_portable'] = TRUE;
//database settings:
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = 'alumniconnect';
$db['default']['dbdriver'] = 'mysql';
I am using phpass for hashing password and tank_auth for authentication.
Thanks in advance.
Related
I am trying to output the cookies I get from the user, when I open the network section in the Developer Tools,if I open the request I find the cookie in the Request Headers, but when I am output the cookie
$this->input->cookie();
I am getting;
array(0) { }
Session Config
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = FCPATH . 'application/ci_sessions/';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
Cookies Config
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE;
I am using Codeigniter 3.0.0, OS Fedora 27, Server Apache I tried this on different browsers, Chrome and Firefox
Request Headers and Response Headers
Thanks in advance.
What solved my problem was replacing my Session folder with a new one from a newer version of Codeigniter.
System -> libraries -> Sesssion
I have a seriuos problem with codeigniter sessions using database, on Chrome:
when i use chrome developers tool and i refresh the page , the session is destroyed.
This my session config:
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'cisessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
Have you any idea about that ?
are you sure that the session is destroyed? I think that it's just not getting updated as supposed and it creates a new one on every page request. (common Codeigniter's setting issue)
here's my suggestions:
double check your Application/Config/config.php file to ensure that the part of session domain looks like that if you host the site on the main directory:
$config['cookie_prefix'] = "";
$config['cookie_domain'] = "yourdomain.com";
$config['cookie_path'] = "var/sessions/";
$config['cookie_secure'] = FALSE;
and like that if you host the site on a sub-directory:
$config['cookie_prefix'] = "";
$config['cookie_domain'] = "yourdomain.com";
$config['cookie_path'] = "siteSubDirectory/var/sessions/";
$config['cookie_secure'] = FALSE;
and also make sure that the 2 directories are writable by fixing their permissions to 755 or so, and I strongly recommend that you enable database session, it's more secure and will help you find out the real problem by checking the session table. good luck :)
I have an application that works on my local, development server, but when uploaded to the remote, production server I see the following error:
Fatal error: require_once() [function.require]: Failed opening required '/home/madhab/public_html/system/database/drivers/mysql/mysql_driver.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/madhab/public_html/system/database/DB.php on line 140
What's the matter? How can I resolve it?
//my database configuration as
$active_group = 'server';
$active_record = TRUE;
$db['server']['hostname'] = 'madhab-acharya.com.np';
$db['server']['username'] = '***********';
$db['server']['password'] = '***********';
$db['server']['database'] = '***********';
$db['server']['dbdriver'] = 'mysql';
$db['server']['dbprefix'] = '';
$db['server']['pconnect'] = TRUE;
$db['server']['db_debug'] = TRUE;
$db['server']['cache_on'] = FALSE;
$db['server']['cachedir'] = '';
$db['server']['char_set'] = 'utf8';
$db['server']['dbcollat'] = 'utf8_general_ci';
$db['server']['swap_pre'] = '';
$db['server']['autoinit'] = TRUE;
$db['server']['stricton'] = FALSE;
//and my index.php file setting is
$system_path = 'system';
$application_folder = 'application';
$assets_folder = 'assets';
while my application, system, index.php resides on public_html folder in remote server
somebody please help me thro this
Problem is with mysql host.
normally it is like madhab-acharya.mysqlserver.com.np. I think you have give your web site name.
Please check your sql hostiname with your web service provide or you can find it in phpadmin panel.
If this is correct ensure that every file is uploaded correctly. Sometimes I had to do second time when I put site in productions.
I installed CodeIgniter latest version and Modular extension HMVC Wiredesignz HMVC Bitbucket.
It is showing annoying error in my server. If I refresh the same page for 100 times 5-10% of total refresh show this error.
A Database Error Occurred
Unable to connect to your database server using the provided settings.
Filename: /Library/WebServer/Documents/modular/third_party/MX/Loader.php
Line Number: 96
Screenshot of the Error
Code in Autoload Configuration file ./autoload.php.
$autoload['packages'] = array(APPPATH.'third_party');
$autoload['libraries'] = array('database');
Code in database configuration file ./database.php.
$active_group = 'default';
$active_record = TRUE;
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = '*****';
$db['default']['password'] = '*****';
$db['default']['database'] = '*****';
$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';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
Hope I am clear. Thanks in advanced.
Try setting one or both these attributes to FALSE:
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
It was not HMVC issue, when I change the host it is working perfectly. There might be some database server issue or file permission issue with some hosting or your settings.
Phil, Author of HMVC explained here
Trouble with HMVC modular extensions for CodeIgniter
change password of database user
set it simple like mydb.123
and test
in my case it works
I'm using CodeIgniter, and I'm not able to use my database with it. I'm following this tutorial exactly, but when I open in localhost I receive a 404 page.
You need to set up your application/config/database.
Here you need to add your information for your database.
$active_group = "default";
$active_record = TRUE;
$db['default']['hostname'] = "localhost";
$db['default']['username'] = "yourdbusername";
$db['default']['password'] = "password_for_db";
$db['default']['database'] = "name_of_db";
$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";
Have you done it?
If you're getting a 404, it may not be your database connection. Check your routing, and be sure that you are accessing a page that does indeed exist. If you're accessing a controller that loads a view, stop loading the view for now and test the connection directly from the controller - output "YES" if it is, and "NO" if anything else.
If your problem persists, double-check your database-connection configuration. Lastly, I would suggest you follow the documentation rather than another website when you are getting familiar with a framework. You can view the documentation for the Database class at http://codeigniter.com/user_guide/database/index.html
Do you try http://localhost/CodeIgniter/index.php/employee/GetAll ?
Are you using CodeIgniter 2 ?