codeigniter display error: Unable to locate the model you have specified: - codeigniter

I use latest version of CI, that is 2.1.2.
I upload my demo application in the following location http://www.domainname.com/myfolder/index.php
If i try to open home page, welcome controller is opened correctly. However if I try to open http://www.domainname.com/myfolder/index.php/controllername/functionname page, I get the following error message:
An Error Was Encountered
Unable to locate the model you have specified: backofficeusersmodel
In my config file, I have the following settings:
$config[‘base_url’] = ‘http://www.domainname/myfolder/’;
$config[‘index_page’] = ‘index.php’;
I also tried and
$config[‘base_url’] = ‘http://www.domainname.com/myfolder/application/’;
$config[‘index_page’] = ‘index.php’;
without any success.
However, the model is uploaded and its name is backOfficeUsersModel, not as stated in the error message all lover case.
I would like to mention that I use myModel (uploaded in application/core), and that same strange thing was happening when I upload same application under some free hosting, just there the error was that mymodel could not be located.
I upload same application on different hosting company and there it worked. Also, same application work normally on my localhost.
Anyone had similar experience?

Model files should be in application/models folder and should be named in lower case like backofficeusersmodel. Probably there is a deficiency in these requirements.

Related

Laravel webfox/laravel-xero-oauth2 getting Class "App\Models\XeroAPI\XeroPHP\Models\Accounting\Invoice" not found

So I have installed the webfox/laravel-xero-oauth2 extension via composer and configured my xeroController and the webhook controller as defined in the docs for this (https://github.com/webfox/laravel-xero-oauth2) the connection works and I am able to show that Xero is connected.
I then started work on submitting an invoice and as per the last part of the docs i opened the link (https://github.com/XeroAPI/xero-php-oauth2-app/blob/master/example.php). To facilitate this I used a working non Laravel invoice app from inhouse and progressed well but when i run this on an environment where I can connect to Xero (I am using a staging site here rather than configuring ngrok or some such thing) and i get the error above. The code where this error has happened is as follows:
$xero = resolve(\XeroAPI\XeroPHP\Api\AccountingApi::class);
$xeroTenantId = $xeroCredentials->getTenantId();
$type = XeroAPI\XeroPHP\Models\Accounting\Invoice::TYPE_ACCREC;
$client = $this->client();
Now I searched in the api and found the reference to this in my projects vendor folder vendor/xeroapi/xero-php-oauth2/lib/Models/Accounting/Invoice.php on line 361 it is shown const TYPE_ACCREC = 'ACCREC'; So It seems I'm not referencing this correctly? On the inhouse this is being found with no issue (although the folder structure is not the same as in Laravel so not sure how helpful this is but it is in it's vendor folder and following the exact same path).
What have I missed? I use phpStorm and it is saying that this is an undefined namespace. I have also this message on the line where we connect to Xero but a dd has verified that this works, the error is shown after this line too. I have ran composer dump-autoload and I have also cleared out all caches to rule this out but same error.

Unable to locate the model you have specified - All i did was change servers

I have a codeigniter website, using the latest version of the frame work. I was hosting my website on Azure, and it was working fine - never any issues.
I've just moved all the files to a different server, a linux one - standard normal web hosting type server with cpanel.
My site loads up, however a lot of pages I use that require models, are giving off errors, as if the files do not exist
Unable to locate the model you have specified: UsersModel
Just note : I have read so many articles today, that you need to have uppercase / lowercase and all that stuff, but that's how i already have it setup, it just does not work since changing servers. and it worked perfectly fine yesterday on the Azure server.
Also, when going to the actual file in my address bar, it takes me to the 404 error. not sure if this has anything to do with it?
Did you change your base url in config file ?
All model , controllers, helper ,library name must me capital letter.
If you change server remove index.php from config file where you will get config['index']= ""; and save this.
Still you get error then save base url like domain/project_name/index.php

500 Internal Server Error when logging into Magento front end?

This used to work fine but we've just moved the site from the development area to httpdocs. I've changed all relevant MySQL entries and file paths, but still we're having this error.
In the Apache error log, This is the corresponding error:
client denied by server configuration: /var/www/vhosts/website.com/httpdocs/var/www/vhosts...
It looks like it is getting the wrong path somehow, as the /var/www/vhosts is repeating.
I did try using powergrep to locate where the path is getting set, but it didn't return any results.
Is there a setting which I can specify the exact path?
First of all, check your PHP log, it will give you a detailed info about this error.
Have you checked your permissions?
The folders var and media must be writtable.
And also, could you see correctly the homepage, categories and the error only appears when you log in?
Best regards.

Laravel 4 - can't access images in public folder

I have a strange behaviour from Laravel. I just copied the website to a new hoster. Everything is working quite fine but one thing: I can't access the images in my public folder. If I try to open an image on my own with "domain.com/img/Ausfahrten/42.png i get the following error:
error image loading
The folder structure on my server looks like this:
enter image description here
What method can't laravel find and how can I resolve this? I've already checked file permissions on the server, everything's fine there.
Laravel throw that error when it cannot find the file. Try to access to another directory without Uppercase letter in its path name.

codeigniter modular extensions

I'm trying to implement modular extensions into a codeigniter 2 setup but am having a few problems. I followed the installation instructions on the wiki and everything was working fine. Then I started to play around a bit and try and use it. All I did was create a new module called users with the required folders and added a model class called users_m. I then tried to load this from my welcome module controller. According to the wiki this should be very straightforward. I simply added this line
$this->load->model('users/users_m');
to the constructor of my welcome controller.
Unfortunately at this point I get the white screen of death.
So I tried something else. This time I removed the load model line and added
$this->output->enable_profiler(TRUE);
This time I got the welcome page displayed and I got the profiler, but at the top of the page I got this error:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI::$profiler
Filename: MX/Loader.php
Line Number: 145
I don't know if these two tries are related or not, but there's obviously something not right with my setup. Could someone point me in the right direction?
If you accessing the model from the controller in the same module, you can load it using just:
$this->load->model(‘user_m’);
You only have to do $this->load->model(‘module/model_name’); when your cross loading between modules.
Just to make sure, your model is located here right?
application/modules/users/models/users_m.php
As for the profiler error:
1) Have you done installation step 5 and put the Modular Extensions core files into application/core?
2) Do you have the latest version of HMVC? There have been updates to mx/loader.php in the last couple days.
Ps. great tutorial on HMVC: http://net.tutsplus.com/tutorials/php/hvmc-an-introduction-and-application/
if you have folder structure like:
application/
modules/
users/
models/
users_m.php
then use this to call modelsin you controller
$this->load->model('users/users_m','',TRUE);

Resources