The following URL part works as expected on my Windows WAMP machine (running using AMPPS), but fails on the Linux production host:
index.php?r=customchocolates/index
I get the following error:
Unable to resolve the request "customchocolates/index"
On Windows, I followed the naming convention of CustomChocolates in all the relevant files. However, after searching on-line, I changed the following files to:
controller: customChocolatesController.php
model: customChocolates.php
views dir: customChocolates
I've also updated all the class names to the new name, but I'm still getting the error.
Windows = file name case insensitive
Linux = file name case sensitive
Change your route to customChocolates/index
Try to rename customChocolatesController.php to CustomChocolatesController.php, and be sure, that controller class name also CustomChocolatesController.
And rename you route as nkamm says.
Moved my site to my Linux laptop to reproduce the problem. Got the same problem as on production.
I solved it (I don't know why - perhaps someone more knowledgeable and experienced can explain) by doing the following:
renamed controller file and class names to CustomchocolatesController
Removed caseSensitive from URLManager block in config
Renamed views folder to customchocolates
Thanks to #nkamm and #Mihail for their time last night.
Related
One of my routes is returning this error message:
Not Found
The requested resource /jackpots was not found on this server.
When I change the route name to anything else e.g. route-1, it works.
Server is running on http://127.0.0.1:8000/jackpots via artisan serve
How can I resolve this?
Edit 1:
Does not work:
Route::get('jackpots', 'JackpotsController#getIndex');
Works:
Route::get('jackpot', 'JackpotsController#getIndex');
Turns out the problem had nothing to do with anything in the routes/web.php script.
In my public directory, I also had a folder with the same name as a URL endpoint i.e.
Folder structure
public
|__jackpots
web/routes.php
Route::get('jackpots', 'JackpotsController#getIndex');
This somehow confuses the php server (as well as apache) into thinking you're trying to access the public/jackpots folder whose permissions won't allow you to do that.
I renamed the public/jackpots folder and the problem was resolved.
I've created a custom banner module for Magento and I've tested it locally on my Vagrant/VirtualBox setup running an instance of precise32 and everything is working great.
When I pulled the code from GitHub on to a staging server the extension is not working and I'm getting the following error:
PHP Fatal error: Call to a member function getCollection() on a non-object in /var/colourbox/app/code/local/AffinityCloud/ACBanners/Block/Slider.php on line 7, referer: http://colourbox.affinitycloud.co.uk/tub-storage.html
This is while viewing the home page, so I'm not sure why it's referencing http://colourbox.affinitycloud.co.uk/tub-storage.html as the referer as this is a category page.
I've cleared the cache (is disabled anyway) and reindexed. Stil no joy. I've also tried to rename the model classes using lowercase characters and the first character uppercase with no result.
I've added the module code to GitHub below so you can see the code:
https://github.com/garethdaine/acbanners
Any ideas why this would be working locally and not on the staging server? It's as if it can't find the model classes but has no problem fining the Slider.php class.
I'm at a loss as to what to do here.
NOTE: For brevity, I would like to add that I have logged out and back in to the admin, while also deleting the module tables and the reference in core_resource to no avail. It creates the tables fine but I still get the same issues and the module is showing as enabled in the advanced config.
The problem is case sensitivity.
On windows systems the file names are not case sensitive. On Unix they are case sensitive.
So in the ways you configured the module and named the files, when calling Mage::getModel('acbanners/acbanners') the magento autoloader looks for the file
AffinityCloud/ACBanners/Model/Acbanners.php But the real name of your file is AffinityCloud/ACBanners/Model/ACBanners.php
So the file is not found and the class is not loaded and Mage::getModel(...) returns null.
You have 2 options here.
The cleanest and fastest. rename all your classes in the Model folder to start with a capital letter and the rest should be lowercase. Acbanners.php in the example above. You may need to do the same for the files in Block and Helper.
The long version. If you want to keep the file names you need to change Mage::getModel('acbanners/acbanners') to Mage::getModel('acbanners/aCBanners') or Mage::getModel('acbanners/ACBanners'). but I guess this will take a lot of refactoring. You may also need this for blocks and helpers also.
I have my zend framework application all set up - its working fine on my localhost, recently just deployed it to a staging server. For some strange reason one specific controller isn't working at all. Its throwing the following error:
An error occurred
Page not found
Exception information:
Message: Action "index" does not exist and was not trapped in __call()
The controller file and view files are all online, no spelling errors or case errors - all other controllers are working and their actions, however this one specific controller isn't working and none of its actions are. In-fact I have noticed that whatever action I try to call off this controller I get the error station that Action index doesn't exist? Whats going on here.
For instance here's my controller file:
class HolidaysController extends App_Controller_Action {
public function indexAction() {
}
}
By any chance are you developing on a Mac or Windows machine, and deploying to a Linux server? I get tripped up like this sometimes because the standard filesystem on my Mac is not case sensitive, but it is on my Linux servers. So if I mess up in how I capitalize my controller file names, it can go undetected until I deploy to my servers.
If you think this might be the problem, log into your server (SSH or FTP) and check the capitalization of that controller's filename. If that's the issue, it can be a little tricky to fix because if you rename the file on Mac or Windows, the new capitalization doesn't necessarily get picked up when committed to a source control repository and/or uploaded to the server. The trick is to first rename the file to something else, then rename it back with exactly the capitalization you need.
On my WAMP box, I did the following:
Added a file called /application/libraries/Foo.php
Foo.php is a class, and it's name is Foo
In /application/config/autoload.php, I added $autoload['libraries'] = array('foo');
Everything works fine. When I upload to my LAMP box, I get the following error:
Unable to load the requested class: foo
Permission of /application/libraries/Foo.php is 0755. Owner is the same as the rest of the CI files. Taking foo out from autoload makes the problem go away.
Any ideas what might be wrong?
In Windows, capitalization in paths doesn't matter. In Linux it does.
When you autoload, use "Foo" not "foo".
I believe that will do the trick.
I think it works when you take it out of autoloading because codeigniter is smart enough to figure out the capitalization in the path and classes are case independent in php.
I had a similar issue when deploying from OSx on my local to my Linux live site.
It ran fine on OSx, but on Linux I was getting:
An Error Was Encountered
Unable to load the requested class: Ckeditor
The problem was that Linux paths are apparently case-sensitive so I had to rename my library files from "ckeditor.php" to "CKEditor.php".
I also changed my load call to match the capitalization:
$this->load->library('CKEditor');
If you're using a linux server for your application then it is necessary to use lowercase file name and class name to avoid this issue.
Ex.
Filename: csvsample.php
class csvsample {
}
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!