*edited to be more clearly
I'm deploying CI 2.0.3 with Modular Extensions (HMVC) in two environments, one is Windows -for development- and the other is Linux -for production-. Both environment has identically folders and files structure. Currently I am having a problem.
After integrating the Modular Extensions to CI by following the manual. The first thing I did was moving the default Welcome MVC that comes with CI to Modular Extensions HMVC. Both environment successfully moved and can be viewed on the browser.
But when I create other modules, it worked on Windows environment but not on Linux. On Windows when I call the module the browser shows the page as expected. But on Linux it shows just white blank page. Not even an 404 err page, which means it is not a broken link.
Can anyone tells me what is wrong in the CI?
Directory structure
/application
-/cache
-/config
-/controllers
-/core
--MY_Loader.php
--MY_Router.php
-/errors
-/helpers
-/hooks
-/language
--/english
-/libraries
-/logs
-/models
-/modules
--/csv_game_credit
---/controllers
----csv_game_credit.php
---/models
----csv_game_credit_db.php
---/views
----welcome_message.php
--/welcome
---/controllers
----welcome.php
---/views
----welcome_message.php
-/third_party
--/MX
--Base.php
--Ci.php
--Config.php
--Controller.php
--Lang.php
--Loader.php
--Modules.php
--Router.php
-/views
Welcome controller
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Welcome extends CI_Controller {
public function index()
{
$this->load->view('welcome_message');
}
}
Csv_game_credit controller
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Csv_game_credit extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->model('Csv_game_credit_db');
$this->load->dbutil();
$this->load->helper('file');
}
public function index()
{
$this->load->view('welcome_message');
}
}
Is this has something to do with the Linux's folder permission? I will try to change the folder permission to 777 and update you guys
Thanks before
You need to extend MX_Controller not CI_Controller
If you are using the HMVC extension from wiredesignz you need to verify that you put the MX folder in the application/third_party folder and the MY_Loader.php and MY_Router.php in the application/core folder.
When this has been verified, create the folder modules in the application folder ('application/modules`).
Now, what is a little tricky about this solution is that when you wan't to create a module, the default controller has to be named the same as the module - the default controller name specified in the config doesn't apply here.
This means that if you create a module called `mymodule', you should create a folder/file structure like this:
application/modules/mymodule
- /controllers
- - mymodule.php
- /views
- - whatever.php
In the controller, located at application/modules/mymodule/controllers/mymodule.php you just create a controller as you would normally do:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Mymodule extends CI_Controller {
public function index()
{
$this->load->view('whatever');
}
}
Related
I am getting Target class [App\Http\Controllers\welcome] does not exist error in laravel 6. everything seems okay.
in routes/web.php
Route::get('/','welcome#index');
Welcome.php file everything was working fine on localhost but when I uploaded on the server getting that error.
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Constant_model;
class Welcome extends Controller
{
public function index(){
$snippets = Constant_model::getDataAllWithLimit('snippets',"id",'DESC',10);
$data = array(
'title'=>'Mytitle',
'description'=>'Hello',
'seo_keywords'=>'',
'snippets'=>$snippets
);
return view('welcome',$data);
}
}
Since your controller class is named Welcome, your route parameter should be spelled identically, including capitalization:
Route::get('/','welcome#index');
Should be:
Route::get('/','Welcome#index');
Traditionally, Unix-like operating systems treat file case-sensitively while Microsoft Windows is case-insensitive.
That's why it worked on your local environment (you probably have a Windows machine) but failed on your server (likely running Linux).
I have created login_model.php file my models folder.But When I am executing the function,It gives the error.But it Works fine on local server but after uploading only it gives error.
Please help me out.Thanks In Advance.
The filename is case-sensitive, should be Login_model.php, and should declare class Login_model extends CI_Model again note the capitalization.
Then assuming this file is not in a sub-folder in application/models the model can be loaded via $this->load->model('login_model');
I am using magento and my page is blank
Here is screenshot. Does anybody have idea how to do this . While debugging got this error
Fatal error: Class 'Creativestyle_CheckoutByAmazon_Helper_Data' not found in /home/s9webnno/public_html/angelawatch/app/Mage.php on line 547
You have to look for the folder Creativestyle under the Magento root folder, inside app/code/local or app/code/community
There you have to create the file Data.php inside the folder Creativestyle/CheckoutByAmazon/Helper
In the file Data.php you should put the following code:
class Creativestyle_CheckoutByAmazon_Helper_Data extends Mage_Core_Helper_Abstract
{
}
In your module's Helper folder, create a file named Data.php and paste the following code
class Creativestyle_CheckoutByAmazon_Helper_Data extends Mage_Core_Helper_Abstract
{
}
So I'm trying to troubleshoot why CodeIgniter won't display any output (except for 404's and such). I've checked everything from error logging in php and apache and codeigniter, to the module rewriting. Everything seems to be configured just fine.
I started to dive into the CodeIgniter core files and noticed that it was crashing on the line below that tries to instantiate the requested controller class:
$class = $RTR->fetch_class();
$method = $RTR->fetch_method();
echo 'looking for class: ' . $class . '<br/>';
if(class_exists($class) == false) {
)
{
echo 'class does not exist: ' . $class;
show_404("{$class}/{$method}");
}
}
/*
* ------------------------------------------------------
* Is there a "pre_controller" hook?
* ------------------------------------------------------
*/
$EXT->_call_hook('pre_controller');
echo '<br/>after precontroller';
/*
* ------------------------------------------------------
* Instantiate the requested controller
* ------------------------------------------------------
*/
// Mark a start point so we can benchmark the controller
$BM->mark('controller_execution_time_( '.$class.' / '.$method.' )_start');
echo '<br/>before class init: ' . $class;
$CI = new $class();
echo '<br/>after class init';
This is within the /core/CodeIgniter.php file. Here is the output:
CodeIgniter.php
looking for class: servicecontroller
after precontroller
before class init: servicecontroller
Basically it's telling me that it can find the servicecontroller class, but when it tries to instantiate it, it crashes. php error logging is enabled, and display_errors is on. If I force a php error anywhere near here, I see it on the page, but not this one. Does anyone have any idea why it can't get past this line?
servicecontroller.php is arranged like this:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class servicecontroller extends CI_Controller {
}
Okay, the root of this problem was an error connecting to the database using mysql_connect. For some reason, it would not produce any error whatsoever, nor would "or die("error..."); do anything. This was because we were using php 5.4 on the server, and mysql_connect does not seem to be supported anymore, unless you have mysqlnd installed. The solution was to switch our database driver to 'mysqli', which CodeIgniter luckily has a driver for, and then install php5-mysql with: apt-get install php5-mysql
Hope this helps anyone else.
I have solved my issue.
Open your: config/database.php
Find: $db['default']['dbdriver'] = 'mysqli';
Replace that with: $db['default']['dbdriver'] = 'mysql';
Or, enable the "mysqli" extension in PHP.
Nothing to do in core system folder.
Update system folder to the latest one
Check .htaccess file within the index.php folder
Check your config/route.php file
If in host check mod_rewrite apache module is enabled
I had this problem using Expression Engine, the issue was the database connection -- I am using Vagrant so I had to set the port in the database config file and then it worked.
I’m getting error when trying to autoload ion_auth library
application/config/autoload.php
$autoload['libraries'] = array('database', 'template', 'asset', 'ion_auth/ion_auth');
folder structure:
application/
...
modules/
ion_auth/
...
config/
ion_auth.php
...
tester/
controllers/
tester.php
I try to var_dump($this->ion_auth) on tester.php and get error message:
The configuration file ion_auth.php does not exist.
I try to $this->load->library('ion_auth/ion_auth') from tester.php and remove the ionauth from autoload, It still error. How to solve this?
I download codeigniter from link on codeigniter.com and download Modular Extension from bitbucket
It's not an issue with Modular Extensions. You need to put the config file for Ion Auth into the main application's config folder, not in the Ion Auth directory.
Just move it from application/modules/ion_auth/config/ion_auth.php to application/config/ion_auth.php. That will take care of the config error, but you'll probably need to move the entire Ion Auth library into application/libraries.
I don't use Modular Extensions, but from the looks of your code, I'd venture to guess that CI doesn't know to look in the ion_auth folder for the config folder.
If Modular Extensions has a config option, make sure to set it to look in the extension's folder for a config folder. If it doesn't, you'll need to either tell CI directly about the config folder, or put the ion_auth config file into a recognized config folder.
I'm doing exactly the same as you, HMVC from wiredesignz, CI and Ion_auth and I had the same problem. I solved it loading the config file PRIOR the library, :P, I don't know if this would be your problem, but I also had exactly the same error message. My construct method with Ion_auth looks like
class Auth extends MY_Controller {
function __construct()
{
parent::__construct();
// THIS LINE BEFORE LOAD THE LIBRARY:
$this->load->config('auth/ion_auth', TRUE);
$this->load->library('ion_auth');
$this->load->library('session');
$this->load->library('form_validation');
$this->form_validation->CI = & $this;
$this->load->database();
$this->load->helper('url');
$this->load->helper('cookie');
$this->load->library('email');
$this->load->library('session');
$this->lang->load('auth/ion_auth');
$this->load->model('auth/ion_auth_model');
}