blank page opening after uploading codeigniter code to server - php

I have uploaded Codeigniter code to server but blank page is displayed when opening the URL
I am using codeingniter 2.1.3.
I used MY_Controller.php on application/core/ folder as per specification
I got error in error_log file of codeigniter
"PHP Fatal error: Class 'My_Controller' not found in /home/nesterin/public_html/realstate/application/controllers/administrator/login.php on line 3"
can you tell what i am doing wrong ?

I'm not familiar with codeignighter. But I think if your class name is My_Controller and it's filename is MY_Controller.php autoloader probably won't find the file on a case sensitive file system.

When you upload you need to check these steps:
Change Config file. New versions of CI you can let it blank. CHECK base_url PLEASE! Read documentation
Change database.php and add new data for database. Read Documentation
If you use the MY_Controller, than you need to check if you have the file in core folder and if you extend it correct in Controller too.
Hope that this answer will help you. If you face any problem, comment please!

Related

CodeIgniter 3.1.7 - Class 'MY_Controller' not found error occurred only on my server

I got the following error:
Fatal error: Class 'MY_Controller' not found in
/www/panel/application/controllers/Posts.php on line 3
A PHP Error was encountered Severity: Error
Message: Class 'MY_Controller' not found
Filename: controllers/Posts.php
Line Number: 3
Backtrace:
subclass_prefix config is:
$config['subclass_prefix'] = 'MY_';
MY_Controller.php is placed on application/core with the filename correctly spelled: MY_Controller.php
I didn't have this problem when I was developing the site on localhost. This error only occurred on my server.
I have tried to google for solution but I didn't find anything helpful.
What can it went wrong? Thanks a lot in advance.
It appears that the controller Posts is extending MY_Controller which is a valid approach but one that CodeIgniter has a hard time dealing with because of the way CI searches for class files.
There are many ways of making this work. A good description and discussion of the various methods can be found HERE.
The most simple solution is to explicitly include the MY_Controller file.
include_once(APPPATH.'core/MY_Controller.php');
class Posts extends MY_Controller {
My preference is to inject an autoload function using hooks. If you want to see the details of that let me know. The link provided above also shows this solution.
Check that the filename and the class name are both of the same case: "My" vs "my" vs "MY", and match your config.
Different file systems treat case sensitivity in file names differently, which can cause issues with things working on localhost vs other servers.
Blame me for my pain!
Just in case it helps someone, this is how I solved it - I erroneously put the MY_Controller file in a wrong directory. Putting it inside /application/core FIXED this dreaded error.
I too fell in this labyrinth and wasted precious hours while CI documentation and SO posts screamed at me with the preferred way to auto load it, which is pretty straight forward and simple.

codeigniter error Unable to load the requested language file: language/french/french_lang.php

I am new to codeigniter 3 and I am trying to use the french translation from here https://github.com/bcit-ci/codeigniter3-translations
I've got the folder french and put it inside application/language/ and in my config file I set $config['language'] = 'french';
Now when I try to submit a form I get this error :
Unable to load the requested language file: language/french/form_validation_lang.php
I went then to the autoload file and set $autoload['language'] = array('french');
Now I get another error :
Unable to load the requested language file: language/french/french_lang.php
any help please?
Not sure but check this :
CI form_validation library uses language file for display error message.You are using required valid_email those error message is written inside form_validation_lang.php.
form_validation library loads the language file(form_validation_lang.php) itself whether you load or not.You can open the library file and look at the run function you will see a line $this->CI->lang->load('form_validation');
This file located either inside your system/language/your_language/ or application/language/your_language/.
That error message says you missed the file inside any of the folder.If you download the original CI files it should be inside system/language/english/ folder.If you don't see the file download CI and restore the file there.
Ok I solved the problem
I found that the folder "french" permissions wasn't set correctly to be accessed by the user system of my laptop, so I just changed the permissions of the folder, and by only using $config['language'] = 'french' the errors are shown in french now.
Hope this will help someone!

CodeIgniter: The configuration file ion_auth.php does not exist.

I have been using modules in my project is written with CodeIgniter.
What I have
Folders
-->application
-->cache
-->config
-->config.php (configuration file for auth, I copied the codes to config.php)
-->controllers
-->core
-->errors
-->helpers
-->hooks
-->language
-->libraries
-->auth's libraries files.
-->logs
-->models
-->modules
-->admin
-->controllers
-->auth.php
-->models
-->ion_auth_model.php
-->views
-->auth
-->login.php
-->home
-->third_party
-->views
-->assets
-->system
What the problem is
When I go to localhost/home/auth/login.php, an error message is occurred. On the screen is written
An Error Was Encountered
The configuration file ion_auth.php does not exist.
I guess the problem is about the iounauth configuration file will be moved config folder before setup. I didnt moved it to config folder. Instead of it, I copied all the codes from that file, to the config.php
So how can I solve this problem? I need to see the login screen instead of this error message. I think I should change some lines on auth.php in controller folder. Because I am using config.php instead of ionauth.php for config folder.
I've just had a quick scan of the ion_auth Library and model and the easiest thing to do would be:
Remove $this->load->config('ion_auth', TRUE); from both the library and model.
do a string replace in both the library and model:
FIND: , 'ion_auth') REPLACE WITH: )
I have done a quick scan of the files and I can't see anywhere where this would break anything but just be careful when you're doing it (maybe do it one at a time).
The above to steps should allow you to use the ion_auth config items in your config.php
Please note that I have not tested this.
Hope this helps!
I'm also facing this issue when move my web to linux server, it solved by renaming config/Ion_auth.php to config/ion_auth.php

Codeigniter DB Language extension not working

I'm trying to use this extension
But it gives me the following error when loading the library:
Unable to load the requested class: Language
Also if I write MY_Language instead, it gives me the following error:
Fatal error: Class 'CI_Language' not found in C:\wamp\www\ckphp\application\libraries\MY_Language.php on line 79
I am using WAMP and CI v. 2.2.0
Thanks!
I figured it out myself after some more researching...
Apparently the language class is not even in the library folder, but in core folder, meaning it should be placed in the core application/core folder. Also the name is not CI_Language, but CI_Lang, meaning the file name has to be MY_Lang (if MY_ is your prefix). The last thing to change in the extension is
parent::CI_Language();
to
parent::__construct();
and everything should work fine!
Usage:
$this->lang->load('set', 'language'); // To load a language
$this->lang->line('key'); // to display the text
or simply
lang('key'); // if using the language helper
Hope this will help others in the future!
I made a GIST for latest CodeIgniter 3.1.X including with migration to create the database structure
https://gist.github.com/cyberfly/885b320fdf914ae15f7316b22cc72f32

Error with propel-generate-crud in Symfony 1.0

When I try to generate a CRUD test for a new project I am getting a PHP Warning and a Fatal Error.
The errors relate to files that it cannot find, however, I have checked and the files are definitely there.
The error text is 'require_once(lib/model/map/QuestionMapBuilder.php): failed to open stream: No such file or directory in c:\webroot\askeet\lib\model\om\BaseQuestionPeer.php on line 547'
What details of my project should I check?
I think it's a problem with your include path.
Check it, the require_once() call is looking for lib/model/map/QuestionMapBuilder.php
But your include_path is C:\webroot\askeet\lib
Which, when resolved together into a full path, would look like this
C:\webroot\askeet\lib\lib\model\map\QuestionMapBuilder.php
So, I think your solution is to add C:\webroot\askeet to your include path.
You are generating crud for the Question model class but it doesn't seem to exist. Documentation on using the crud generator
First you must use the schema.yml file to define your database, and run
./symfony propel:build-model
to generate your model files. (this will generate lib\model\map\QuestionMapBuilder.php)
I finally tracked down the issue. In my PHP.ini files, they were setup wit the default UNIX file path settings.
Weirdly nothing had ever been broken by this incorrect configuration. Plus, everything in Symfony had worked up until now.
I have switched to Windows style file_path and all is well again.
Thanks for all the answers!

Categories