neginf Posted May 2, 2013 Share Posted May 2, 2013 Below is a try at hello world. 1. What url do I use to try to run it? (I'm getting 404 file not found errors) 2. Is this an ok way to do hello world? This is c:\inetpub\wwwroot\cakephp\app\models\try2.php<?php class Try2 extends AppModel { }?>This is c:\inetpub\wwwroot\cakephp\app\controllers\try2s_controller.php<?php class Try2sController extends AppController { function try2s() { $test='hello world'; $this->set('test',$test); }}?>This is c:\inetpub\wwwroot\cakephp\app\views\try2s\try2s.ctp<pre> <?php print_r($test)?></pre> Quote Link to comment https://forums.phpfreaks.com/topic/277554-how-to-run-hello-world/ Share on other sites More sharing options...
jazzman1 Posted May 2, 2013 Share Posted May 2, 2013 (edited) What version of cake is used for? Try to change the try2s_controller.php to Try2sController.php file and the view from try2s to Try2s directory. app/Controller/Try2sController.php class Try2sController extends AppController { function try2s() { $test='hello world'; $this->set('test',$test); } } app/View/Try2s/try2s.ctp <?php pr($test); ?> app/Model/Try2.php class Try2 extends AppModel { } Your name's convention is not very clear but that one should work. EDIT: The path of the url should be something like: http://localhost/cakephp/try2s/try2s Edited May 2, 2013 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/277554-how-to-run-hello-world/#findComment-1427820 Share on other sites More sharing options...
neginf Posted May 2, 2013 Author Share Posted May 2, 2013 Thank you for writing. 1.3.2 is the version. Made those changes you suggested and having the same problem of error 404. It says requested url is http://localhost:80/cakephp/app/webroot/Try2s/try2s and physical path is c:\inetpub\wwwroot\cakephp\app\webroot\try2s\try2s. I can get the default page for cakephp from http://localhost/cakephp. Quote Link to comment https://forums.phpfreaks.com/topic/277554-how-to-run-hello-world/#findComment-1427833 Share on other sites More sharing options...
jazzman1 Posted May 2, 2013 Share Posted May 2, 2013 Does your localhost run on an apache server or something else? If you are using an apache server, could you show us the http.conf file. Quote Link to comment https://forums.phpfreaks.com/topic/277554-how-to-run-hello-world/#findComment-1427838 Share on other sites More sharing options...
neginf Posted May 3, 2013 Author Share Posted May 3, 2013 Windows 6.1. Changed routes.php like in the CakePHP cookbook getting started section. Now getting warnings about access denied for my_sql_connect(), supplied argument not valid for my_sql_select_db(), my_sql_get_server_info(), my_sql_query(), cannot modify header information. Does having a model there mean that a table with the name as the plural of the model name has to be there also? and error about missing database table try2s for model Try2 was not found. When I take database.php and change it back to database.php.default, get warnings about not finding database.php and error about non existent data source default core/cake/libs/model/connection_manager.php. Quote Link to comment https://forums.phpfreaks.com/topic/277554-how-to-run-hello-world/#findComment-1427859 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.