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
Related
I am using Cakephp3 and would like to know if there is a better alternative to relocating the config folder.
The issue rises from the fact that everytime I have to refresh the production app, i copy over the entire app from development to production and reconfigure the required settings in the config folder.
After some iterations of this process, I started to make a backup of the config folder and after copying the app, restore the config folder.
After some time even this started to get tedious, so I ended up hacking the cake files and folders.
I relocated the config folder outside the root directory
Created a symbolic link in the root directory poiting to the config directory outside the root directory.
Updated the ROOT constant in config/paths.php to the real root folder
In webroot/index.php redefined the bootstrap.php require location
So as long as long as I dont update the cakephp core, I can copy over the dev app to the prod app and all the config stays the same.
I would like to know if some one has a simpler approach.
Thanks
After some research and reading carefully the comments in related bootstrap file, I found a solution for, well at least, my problem.
The problem basically was that I had to refresh the database, email, debug settings define in the app.php file, everytime I uploaded the app from my dev server to my prod server.
Reading the comments in the bootstrap file I found the comment which stated:
Load an environment local configuration file.
You can use a file like app_local.php to provide local overrides to your
shared configuration.
So this allows me to redefine the configurations defined in the app.php file. However I wanted this to me more dynamic, so I ended up creating an APP_INSTANCE_NAME constant in the bootstrap.php file of the webroot directory as follows
// /config/bootstrap.php
define('APP_INSTANCE_NAME', strtolower(gethostname()));
and later in the bootstrap file, i did the following:
Configure::load('app_' . APP_INSTANCE_NAME, 'default');
with this change, the configuration that gets loaded is based on the server hostname and I dont have to relocate the config folder. Hope this helps someone with cakephp3
Thanks to jason and greg's comments which motivated me to read the comments more carefully.
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!
I try to create application with back-end and frond-end. The folder structure as follows(only show config file position to explain problem)
+root
|-admin
|-application
|—backend
|—config
|—config.php
|—frontend
|—config
|—config.php
|-system
Using back-end admin panel I try to change config value in both back-end and frond-end config.php value. But I fail to change it in front-end config.php file. I don’t need database based solution for this.
Reading the documentation I got this:
Note: CodeIgniter always tries to load the configuration files for the current environment first. If the file does not exist, the global config file (i.e., the one in application/config/) is loaded. This means you are not obligated to place all of your configuration files in an environment folder − only the files that change per environment.
So based on that information, I think the problem is when you are calling it, maybe a problem with your path.
I am getting a Missing Helper error when I am trying to upload my cake php files to a shared host.
Undefined variable: javascript
Missing Helper File
It is working fine on my local machine.
I have the following directory structure in shared hosting:(using cpanel)
/home/user/
/app
/cake
/vendors
/public _html
/css
/img
/js
.htaccess
index.php
I have also made all the relevant changes to the index.php file and I was getting the full colored cake php intro page.
The strange thing is that it is recognizing the HTML helper and hence i am able to see my web page with full CSS. However, it is giving problems with javascript and other helpers.
I already have an app_controller file with all helpers well defined in $helpers =array().
Why is it giving this error??
As mentioned above, I have made changes to my cake directory structure. So, do I have to make changes to the paths.php file located in the cake/config folder??
I think that cake is not finding the javascript helper because something is messed up with config files. Is it so or there is some other problem??
in /app/app_controller.php, add:
var $helpers = array('Javascript');
your structure doesn't seem like cakephp structure :-(
Guys, I found a simple way to tackle this problem. I certainly cannot call it the solution for the problem. May be a temporary way to make things work.
I simply replaced
<?php echo $javascript->link(array('tabulator')); ?>
with the standard HTML,
<script type="text/javascript" src="/blog/js/tabulator.js"></script>
and it worked!!
I still don't know the problem with javascript helper. All other helpers, Html, Form and Ajax are working fine. I am also using Gravatar for my blog. So, the Gravatar Helper was also giving problems.
The solution to this problem was weird.
I renamed the helper file gravatar.php instead of Gravatar.php. This worked insipte of the fact that helper file name should begin with a capital letter according to cake naming conventions!!
I also had to solve numerous other problems like making changes to the index.php file so that cake can locate the modified directory structure.
Also, had to make changes to .htaccess file for rewriting the base and directing the blog to the new URL.
Man..so much for rapid development!! :O
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!