Magento helloworld tutorial - php

We're working on Alan Storm's tutorial: Magento Controller Dispatch and Hello World on Magento 1.5.0.0.
at the step:
Clear your config cache, and load the following URL
http://exmaple.com/helloworld/index/index
and it produces a page not found error, as follows:
Whoops, our bad...
The page you requested was not found, and we have a fine guess why.
If you typed the URL directly, please make sure the spelling is correct.
If you clicked on a link to get here, the link is outdated.
Two of us are working on this. One of us on a Linux platform, the second on Mac OS X 10.6.7. The same "page not found" error on both platforms. We both have double-checked each other's tutorial code by comparison to Alan's article. It seems that something is remiss in the tutorial code in that it would not work on two independent platforms.
What is the best way to move ahead with debugging something like this?

First check the module is active, at the very least it should appear in System > Configuration > Advanced > Disable Module's Output or use Alan's Module List.
Next, double check for typos in the controller class and pay particular attention to the case. In the config frontname should be frontName (a capital N is often overlooked).

I had the same problem , Double check your /path/to/magento/app/etc/modules/Module_Name.xml , I had the codePool set to "community" and placed my extension in "local" directory this caused the 404 issue, when I changed the codePool value to "local" everything worked

example.com (or exmaple.com as typo'd in the tutorial) is a placeholder link used in documents. You are supposed to replace it with your own hostname, i.e. if you are developing on a local webserver http://localhost/, like this: http://localhost/helloworld/index/index

Just stumbled over the same problem and found the solution to be that mod_rewrite has to be enabled on the server for the URL given in the tutorial to work. Elsewise, it will work with the following URL as well:
http://exmaple.com/index.php/helloworld/index/index

try by adding "index.php" in your url.
For example: http://example.com/index.php/helloworld/index/index
If you are done with this. Search some article to remove index.php from magento.

I am on magento 1.8 and i fixed my 404 error by doing the following. inside Magentotutorial_Helloworld.xml they tell you to put this code in "local" since i do not have a local folder i put mine into the community folder. Change the code to this and it will work. "community"

Related

TYPO3, realurl not working after change the domain

We have an old TYPO3 site (v4.7) and we moved the site to another domain.
now all the pages give the error: 404 Not Found
when I tried to get the page using URLs containing page id like /index.php?id=2, it works
how can I fix the site to works using real spoken URL /page-name
thanks
First of all you should change the domain record (in the backend, at the root of the domain in "List" view).
Maybe the domain is hard-coded in your realurl-config which is usually at /typo3conf/realurl* (realurl-extension configuration in the extension manager). If you selected "auto-configuration" in realurl's extension configuration and nobody made the mistake to make changes to the file directly, you can delete it and let it regenerate.
Maybe TypoScript settings like config.baseURL or config.absRefPrefix have a say here, too. I suggest to check in the template analyzer (backend: "Template" -> select your domain's root -> template analyzer -> view complete listing) if there is something with the old domain.
Of course, realurl needs to be activated (TypoScript config.tx_realurl_enable = 1) but if you did not change it, that should not have changed.
Then of course clear all caches (preferably via the function in the Install Tool).
If you still have problems, deleting /typo3temp (and recreating it via the InstallTool) might help. And check if there's something useful in the logs, of course (where, depends on ['SYS']['systemLog'] and ['SYS']['systemLogLevel'], probably typo3temp/*.log or your PHP error log).
Good luck with that ole' T3 ;)

Codeigniter : Regular controllers are ok. HMVC controllers don't work (Page not found)

So this is the annoying kind of problem where something works perfectly on your local project, but everything breaks once deployed in production.
In this case, i can access all the pages generated by a regular codeigniter controller (situated in application/controllers). However, once i try accessing a HMVC module, i just get a codeigniter 404 error.
Situation still ok for regular controllers:
So for instance, if i have a regular controller C1 situated in application/controllers/C1.php, which contains the function page(), i can access www.mysite.com/C1/page without an issue.
Problem for accessing HMVC controllers:
However, if i want to access the controller C2 situated in application/modules/C2/controllers/C2.php, through the url www.mysite.com/C2/page, i'll get a 404 error.
And problem accessing regular controller through ajax:
A second issue appears when performing an ajax call, using a path which references a regular CI controller. The path used in the ajax call doesn't seem to be recognized, and i receive a 500 error. However, when calling the same path directly in the URL bar, the correct function seems to be executed. I had solved a similar issue before by applying the solution found in Codeigniter base_url() not working properly for ajax. However, i have not yet identified if this is the same issue.
It feels like a loader issue, but i'm no expert!
Even if it was a loader issue, why would it work on local and not on production?
Have you ever encountered something like this? Do you have an idea on how to tackle this issue?
**Edit 3: ** I removed the 2 previous edits because they are now irrelevant.
After activating the debug mode, and adding some logs, i finally found what i think to be the answer.
Long story short, my local codeigniter version runs on windows, and for some reason, when trying to reach a controller, the case is ignored. So File.php and file.php are considered the same.
My production server however runs linux, so it doesn't consider that 2 different file names refer to the same file. So i ask for file.php, and the server answer "there's no such file", because the file i actually want is File.php.
I need to turn in. I'll propose a proper answer tomorrow after running some more checks.
Thanks,
Loïc.
So the issue was not related to regular controllers versus HMVC controllers. Basically what happens is that my local dev environment is Windows, and for some reason, windows decides that the case doesn't matter when naming a file.
So file.php would be seen as the same name as File.php (notice that the first is lowercase and the second uppercase).
In my code, i was trying to get file.php (lowercase), while the actual file was named File.php and it worked, on windows.
However, in civilized operating systems File.php and file.php are considered 2 different names, and that's why suddenly things where not working in production, even though the code was the same. The controller files just could not be found.
I changed the names of my controller files (put them in lowercase) and things are working fine now.
Thanks everyone for your suggestions.
Loïc.
With HMVC routes need to be like
$route['something'] = "module/controller/function";
$route['something/(:any)'] = "module/controller/function/$1";
Make sure like that also when use controllers intead of welcome.php make sure controller filename like Welcome.php
When using routes if have not remove index.php from controller then url would be
With http://localhost/project/index.php/something
Without http://localhost/project/something

Phalclon route invo/index not found on server

I followed the tutorial at http://docs.phalconphp.com/en/latest/reference/tutorial-invo.html.
Everything wokrs fine but the "home" link, that points to localhost/invo/index/index/
will give an error stating file not found or what ever. Index is defined as it should be in the project and the funny thing is that if I type localhost/invo/foo/bar/(does not exist) I recive the message stating that I am not allowed to watch said module.
Am I missing something in the tutorial? Am I missing something? Or is this an apache problem? I get the same error when tying in /index in tutorial 1 aswell. So it seen that there is a bit problem just with the word "index".
Im running debian 7 by the way if thats somewhat relevant.
This is may not the full solution but apparently you have the same issue as the guy here http://forum.phalconphp.com/discussion/1393/indexcontroller-cause-unmanaged-404-error-on-apache-w-mod-rewrit
You may are right about the index for being special word as it is the default index page name, so you can avoid naming the controller as IndexController you can use something like HomeController.
Hint: try to clone the source code from git to ensure that you get the correct code with the correct .htaccss you may already did that.
git clone https://github.com/phalcon/invo.git

CakePHP working on local but can't get it work on production

I have an issue making my cakephp project work on my shared hosting server.
I followed all the needed steps so it can work on local, and it's working. Once I upload on the server, in a specific domain name, only the homepage works, once I want to call another controller, i get the "404 - File or directory not found." error.
the project is hosted at : fme.tahrijouti.com. the domain redirects to the webroot folder in the cakephp structure.
My controller is : posts. I can make it work if I change the URL by specifying the controller & action, you can see it here.
I have checked and the rewrite module is on.
Can you please help me with that ?
Please have a look on CakePHP default routing. And don't forget to fix all your links.
Your links should have proper addresses. Just look on your Posts's link. These are like this http://fme.tahrijouti.com/index.php/posts/posts/view/2 but it should be http://fme.tahrijouti.com/index.php/posts/view/2. Remember after your host name there exist controller then a function of that controller then argument of that function like this: [host]/[controller]/[function]/[argument1]/[argument2]. Hope it helps. I think you can read cookbook another bit as most things are clear there from my experience.
As I don't have your codes of controller I cannot say more.

CakePHP without htaccess and mod_rewrite - how to overwrite WEB URL PATH

So I installed CakePHP on a IIS box and followed the steps of uncommenting the appropriate lines in core.php to make my URLs work as index.php/controllername/methodname/
My only problem now is that all the convenience functions such as $html->css, $html->link, etc. are pointing to some wacky paths. If I am viewing index.php/pages/home doing $html->link('Test', '/pages/test') produces a link to index.php/pages/pages/test/
How do I fix this?
I had a similar problem with my plugin paths and I posted a ticket.
Try to insert ../../ at the beginning of the path.
$html->css('../../your_style_sheet');
For the links use this syntax:
$html->link('Test', array('controller'=>'pages', 'action'=>'test'));

Categories