Support the ongoing development of →
Configuration Views Blade
Last updated 6 months ago.

The first thing concerns me where you state that the code only shows. This makes me think that you need to make sure your php module is being loaded in your httpd file... check this first before anything.

Next, your


is missing an argument, you would need to include the name of the controller

Route::controller('<route>', '<name of restful controller>');

The url you are accessing this route by does not need to specify the 'index.php' file. When you call a route, let's say '/admin', the index file is already called for you, and your logic in the route controller should display the correct view when you call it either a method in your controller (url would be: http://localhost/testlaravel/public/admin, assuming testlaravel is the root of the laravel project):

function showIndex()
    return View::make('admin');

or from your route directly (not best practice):

Route::get('/admin', function()
     return View::make('admin');

Lastly, the httpd.conf looks fine to me.

Last updated 6 months ago.

Do you have short tags enabled in your php config? I'm seeing that your controller's source code is opened with <? instead of <?php.

Last updated 6 months ago.

Your view file should be user.blade.php not just user.php

Last updated 6 months ago.

Thanks for your feedback.

I made three changes:

  1. Routes.php : Changed route definition for TestController

Route::get('/', function()
	return View::make('hello');

Route::get('/users', function()
	$users = User::all();
    return View::make('users')->with('users', $users);	

  1. Changed view from users.php to users.blade.php. It does not contain php opening and closing tags <?php and ?>

    @foreach($users as $user)
        <p>{{ $user->name }}</p>
  1. Added <?php opening tag to TestController
class TestController extends BaseController {

     * Show the profile for the given user.
    public function test()
        return 'Hello World';

I am accessing users and test functions at


Still I am getting following response in both cases:

<!DOCTYPE html>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="robots" content="noindex,nofollow" />
            /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: */

            html { background: #eee; padding: 10px }
            img { border: 0; }
            #sf-resetcontent { width:970px; margin:0 auto; }
                        .sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 }
            .sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; }
            .sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; }
            .sf-reset .clear_fix { display:inline-block; }
            .sf-reset * html .clear_fix { height:1%; }
            .sf-reset .clear_fix { display:block; }
            .sf-reset, .sf-reset .block { margin: auto }
            .sf-reset abbr { border-bottom: 1px dotted #000; cursor: help; }
            .sf-reset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px }
            .sf-reset strong { font-weight:bold; }
            .sf-reset a { color:#6c6159; }
            .sf-reset a img { border:none; }
            .sf-reset a:hover { text-decoration:underline; }
            .sf-reset em { font-style:italic; }
            .sf-reset h1, .sf-reset h2 { font: 20px Georgia, "Times New Roman", Times, serif }
            .sf-reset h2 span { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; }
            .sf-reset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }
            .sf-reset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;
                -webkit-border-bottom-right-radius: 16px;
                -webkit-border-bottom-left-radius: 16px;
                -moz-border-radius-bottomright: 16px;
                -moz-border-radius-bottomleft: 16px;
                border-bottom-right-radius: 16px;
                border-bottom-left-radius: 16px;
                border-bottom:1px solid #ccc;
                border-right:1px solid #ccc;
                border-left:1px solid #ccc;
            .sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px;
                -webkit-border-top-left-radius: 16px;
                -webkit-border-top-right-radius: 16px;
                -moz-border-radius-topleft: 16px;
                -moz-border-radius-topright: 16px;
                border-top-left-radius: 16px;
                border-top-right-radius: 16px;
                border-top:1px solid #ccc;
                border-right:1px solid #ccc;
                border-left:1px solid #ccc;
                overflow: hidden;
                word-wrap: break-word;
            .sf-reset li a { background:none; color:#868686; text-decoration:none; }
            .sf-reset li a:hover { background:none; color:#313131; text-decoration:underline; }
            .sf-reset ol { padding: 10px 0; }
            .sf-reset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px;
                -webkit-border-radius: 10px;
                -moz-border-radius: 10px;
                border-radius: 10px;
                border: 1px solid #ccc;
                    <div id="sf-resetcontent" class="sf-reset">
                <h1>Whoops, looks like something went wrong.</h1>


When I try http://localhost/testlaravel/public, I get correct hello.php rendered with message "You have arrived". That means php is getting loaded properly in httpd.config.

Regards, Suraj

Last updated 6 months ago.

I see that you have a controller for the route '/test' but not a route for '/test' ; and no controller for '/users' route

Consider this format and structure:

Route::controller('/test', 'TestController');

Route::get('/test', '[email protected]');

Let's create this 'TestController' with the example method:

class TestController extends \Basecontroller {
      public function getIndex()
           return View::make('test');
      public function postIndex()
            //store data in db

Laravel will now reference the specified method inside of the controller. Using the controller method allows you to create custom methods/pages. Laravel looks for them when you prepend the method/page name with a HTTP verb.

These verbs include: GET and POST, as opposed to a resource controller that uses basic CRUD operations, and uses the verbs: GET, POST, PUT, and DELETE.

The postIndex() method would then logically handle any post data that comes from 'getIndex()', for example you would set this up in your routes.php by writing:

Route::post('/test', '[email protected]');

Any post originating from getIndex() will then be processed by 'postIndex()' method. You could store data to your database here, or echo back new information to the 'test' view.

Let me know if this helps.

Last updated 6 months ago.

Thanks. The '/test' route issue solved after adding Route::get('/test', '[email protected]') to routes.php

For /users, I have followed QuickStart tutorial as is. It does not mention to create a controller for /users.

However, when I try http://localhost/testlaravel/public/users, I got code of views/layout.php displayed on browser.

I renamed layout.php to layout.blade.php and it displayed the user names from database correctly.

Thanks again.

Last updated 6 months ago.

No problem!

Happy coding.

Last updated 6 months ago.

Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 - All rights reserved.