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.
Related
my project ran well in localhost using xampp but in remote server I've got an error when Im trying to upload or update an image,..
warning:
Message: move_uploaded_file(images/1458100947_2.jpg):
failed to open stream: Permission denied
here is the code were the errors located.
$imagename = $this->person->view($this->input->post('id'))->image;
if(file_exists("images/$imagename")) unlink("images/".$imagename);
$fileName = time(). '_' .$_FILES["image"]["name"];
move_uploaded_file($_FILES["image"]["tmp_name"],$output_dir.$fileName); //this line
$targetPath = 'images/' . $fileName;
$config_resize['image_library'] = 'gd2';
$config_resize['create_thumb'] = FALSE;
$config_resize['maintain_ratio'] = TRUE;
// $config_resize['master_dim'] = 'height';
$config_resize['quality'] = "80%";
$config_resize['source_image'] = $targetPath;
$config_resize['height'] = 600;
$config_resize['width'] = 1024;
// $config_resize['thumb_marker'] = '';
$config_resize['new_image'] = 'images/' . $fileName;
$this->image_lib->initialize($config_resize);
$this->image_lib->resize();
$uploaded = TRUE;
I am trying to google on how to set the permission to 777 in codeigniter but no luck.. here is my project link http://mysports.orgfree.com. use this admin account.
username: mak password: mak
to login and click the edit button then upload some image.. the error will show after that.. thank you...
Hello you can give 2 way permission
1) directly give folder permission using this way
chmod("folder name with path", 755);
2)directly give file permission using this way and use this code after move_uploaded_file function
chmod("file name with path", 644);
I was able to fix my permission issue by using SmartFTP to upload the files, because it provides an easy way to set the permission. This resolved my question and my code works now.
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.
I am beginner for CI so don’t have good knowledge.
My problem is:
I am not using any database. All the records are fetched from JSON.
Therefore I don’t think I need to configure database…
As said by CI, it doesn’t necessarily ask for database.
So my database.php configuration is :
$active_group = ‘default’;
$active_record = FALSE;
$db[‘default’][‘hostname’] = ‘’;
$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;
It works in my local system but doesn’t work in live server. I am so surprised.
Then I provided hostname, username, password and dbdriver, it works.
My question is that, is that necessary to provide all the details if I am not using database?
Thank you for your suggestion.
just dont call the Database class dont put it in the autoload.php
CI dont force you to use database
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 ?