Welcome Guest, Not a member yet? Register   Sign In
Cannot launch 'Hello World' on local host
#1

[eluser]BeMeCollective[/eluser]
Hello Dear CodeIgniters.

I feel embarrassed to admit this, but after four hours I give up: I cannot get the 'Hello World' application to run.
I have searched these forums and there was a fellow who could not run it in the server, but his problem disappeared magically. My Hello World doesn't work in my localhost.

My site in config.php
$config['base_url'] = "http://localhost/BeMeSite2/";

My blog.php file from the tutorial, obviously:

<?php
class Blog extends Controller {

function index()
{

echo 'Hello World!';
}
}
?>



If I browse into
http://localhost/bemesite2/index.php/blog
or(ending with backslash)
http://localhost/bemesite2/index.php/blog/ (ending with backslash)

I get an IIS standard HTTP 404 - File not found

However, if I set in routes.php
$route['default_controller'] = "blog";

and browse to (note no backslash)
http://localhost/bemesite2/index.php

I DO see "Hello World!"

Can someone please calm my heartburn?

Best regards

Ari
#2

[eluser]rogierb[/eluser]
Hi and welcome.

First of all, I suggest you get rid of all the UppErCase and convert everything to lowercase. There is no telling what IIS might do with it. It schouldn't matter but who knows.

As for
Code:
$route[‘default_controller’] = “blog”;
http://localhost/bemesite2/index.php
This is expected behaviour. It does route to the blog controller so that is working like it should be.

Code:
http://localhost/bemesite2/index.php/blog
//or
http://localhost/bemesite2/index.php/blog/
Should work to. But somehow it doesn't. My guess it has something to do with how IIS translates the index.php/blog/ part.

If it would route to index.php, you would either get an CI 404 or the blog.

So check your IIS setting to see how it handles index.php/somevar (or move to a WAMP setup).
Maybe IIS can only handle GET style parameters by default?
#3

[eluser]BeMeCollective[/eluser]
***SOLVED!***

While reading these forums I saw some people talking about ISAPI_REWRITE, I downloaded it and tried their config editor on the following expression, which was found around these forums again:
RewriteRule /(.*) /index.php\?/$1 [I,L]

Amazingly, the URL ended up similar to this:

http://localhost/bemesite4/index.php?/blog/

Notice the ? after the index.php!

That was the difference. I am working with IIS 5.1

Hope this helps someone trying to run codeigniter on IIS5.1
Just add ? after the index.php

rogierb:
"Maybe IIS can only handle GET style parameters by default?"
I think you are right, thanks for helping.

Best regards

Ari
#4

[eluser]Rahul Anand[/eluser]
check the name of your blog file. is it "Blog.php" or "blog.php"? if its "Blog.php" then try "Blog" at the end of the url and also change this in config file.

Check this out and reply me.

Thanks
Rahul




Theme © iAndrew 2016 - Forum software by © MyBB