CODEIGNITER How CI could read model name even if it is different - codeigniter

I have a 'Event_Model'. I used it on a controller. I called it as
$this->load->model('Event_model','eventM')
I wrote the code with phpstorm on Window but it is running on a linux VM.
It worked on a local server. I got an error when I had uploaded on a linux production server though.
Why did it happen?
I don't understand how my local server could read it
use COMMON\Models\Event\Event_Comm_Model as Common_Event_Model;
class Event_Model extends Common_Event_Model {
public function __construct() {
parent::__construct();
}
}
The model is like this.

Linux servers and hosted sites are very sensitive to file names. Make sure you respect the case sensitivity.
This can work on your local machine
$this->load->model('Event_model','eventM')
but for a hosted server use instead
$this->load->model('Event_Model','eventM')

Related

GET Parameters cannot be retrieved from the Laravel Controller, after making it live to Linux Server

I am having an issue after making my Laravel Project live on the Server. Any GET parameters cannot be retrieved from the controller in the entire project, whereas it is running fine on my local server and I also tried in different servers, but when I switching it to the Production Server it is not been able to read the URL Parameters.
For Example, If I consider the URL as below:
http://www.example.com/?type=moble&value=recharge
My Controller Function
/***** In the Starting I had declared use Illuminate\Http\Request; *****/
public function index(Request $request)
{
echo $request->type;
echo $request->value;
}
Suppose the above URL pointed to this index function, it is returning NULL in the server.
I sorted the issues out. It was a problem in the htaccess file.

What does isLocal() actually do in Laravel?

I've been looking into Laravel Telescope and it mentioned the ability of being able to run only in one's local environment as opposed to production by including the following code snippet in AppServiceProvider.
public function register()
{
if ($this->app->isLocal()) {
$this->app->register(TelescopeServiceProvider::class);
}
}
This works fine but I am trying to figure out what exactly the isLocal() method does. So far, I have not been able to find much information.
Thanks,
In your .env file you would have a APP_ENV set to local on your development environment and it will be different on other servers. So isLocal just checks if that is set to local or not.
Here is the answer from the repository.
To check for a different env other than local or production use this helper function:
config('app.env') // get the env
for production there is a isProduction() helper function on the app instance.

Why wont my Codeigniter model load on Lamp?

My model is:
/application/models/tester.php
The code inside is:
class Tester extends CI_Model
{
function __construct()
{
parent::__construct();
$this->load->database();
}
}
And here's the usage:
class Hauth extends CI_Controller
{
public function index()
{
$this->load->view('hauth/home');
}
public function login($provider)
{
// Load models
$this->load->model('Tester');
// Load helpers
$this->load->helper('url');
log_message('debug', "controllers.HAuth.login($provider) called");
It works perfectly on my local WAMP server but I get this error on the LAMP production envrionment:
An Error Was Encountered
Unable to locate the model you have specified: Tester
I've looked at a dozen StackOverflow questions that appear to be similar but I've tried all of the solutions posted. As far as I can tell, I've followed the CI manual to the letter. I figured that perhaps file names were an issue WAMP vs LAMP so I confirmed the case of the file names via FTP. Thought it might be a naming conflict, so I renamed them "tester". Again, works perfect on local, but not on live.
I found the problem. Turns out I accidentally used a zip of Codeigniter 3.0-dev. When I moved my application files over to the latest stable version, everything instantly worked.

Magento Custom Controller working on local, throwing 500 error on staging server

I am having quite a strange problem. I have just pushed my local build to our staging server. I have a custom module with custom controllers which, when accessed locally, work perfectly fine. However, when I attempt to access ONE SPECIFIC controller on staging, it throws a 500 server error. All of the other controllers I wrote work except for this custom IndexController.php I wrote. Again, everything works 100% on my local build. I have triple checked all of my .htaccess files, but maybe I’m missing something.
The strangest part of all of this is that it was working on staging two days ago! I have no idea what is causing this.
Does anyone have any suggestions on how I might go about troubleshooting this? Or, by chance, a solution?
1: Clear your cache AND sessions .
2: Check if your module is installed using the free/open-source Module List Module
3 Drop some debugging code in the following method. The var_dumps will tell you which files/classes Magento's routers are looking for with your module, but can't find.
File: app/code/core/Mage/Core/Controller/Varien/Router/Standard.php
protected function _validateControllerClassName($realModule, $controller)
{
$controllerFileName = $this->getControllerFileName($realModule, $controller);
if (!$this->validateControllerFileName($controllerFileName)) {
var_dump($controllerFileName);
return false;
}
$controllerClassName = $this->getControllerClassName($realModule, $controller);
if (!$controllerClassName) {
var_dump($controllerFileName);
return false;
}
// include controller file if needed
if (!$this->_includeControllerClass($controllerFileName, $controllerClassName)) {
var_dump($controllerFileName);
return false;
}
return $controllerClassName;
}

cURL library no longer works with current CodeIgniter?

I would like to know please how to correct the following error, or what an alternative solution would be.
Update 1 - In my php.ini from extension=php_curl.dll is uncommented (I've rebooted the server too), however Curl does not appear anywhere in PHPINFO().
Update 2 - Furthermore, I'm certain I'm looking at the right php.ini because it's the one mentioned inPHPINFO() as Loaded Configuration File.
I'm trying to perform simple cURL calls from within CodeIgniter using Phil Sturgeon's library.
I'm using CodeIgniter 2.1.3.
I get the following error when performing the first example straight from the official README.
Here is my controller class:
<?php
class Test extends CI_Controller {
function __construct() {
parent::__construct();
}
function index() {
$this->load->library('curl');
// Simple call to remote URL
echo $this->curl->simple_get('http://google.com/');
}
}
/* End of file test.php */
/* Location: ./application/controllers/test.php */
Did you first install the php curl extension.
Please visit http://php.net/manual/en/curl.setup.php for instructions on doing this.
Here is a guide for windows http://devilsworkshop.org/tutorial/enabling-curl-on-windowsphpapache-machine/702/
After doing this, make sure you restart your Apache web server
I installed the most recent wampserver 2.2 over my (few months old) wampserver installation (and chose 32bit this time instead of 64bit), and curl seems to be working perfectly now.

Resources