404 after basic installation

404 after basic installation

by Bob Robertson -
Number of replies: 15
Greetings, all. I've been dancing with the installation process for this software for some small amount of time now, and I am thoroughly stumped.
Symptoms: After completing install.php, my browser (Firefox 1.5.0.7) is redirected to index.php in the root directory, which is set to '<domain>/moodle/' . My browser is then redirected to <domain</moodle/admin/index.php, where the request promptly throws up a 404 Document not found. Interestingly, requests for other .php files in the same directory are also rebuffed. I am able to edit and view these invisible files using both Notepad and Word.

I am running IIS 5.0, PHP 4.4.4, and MySQL 5.0.24 essential, as well as Moodle v 1.6.2+.

The IUSR_<machine name> account has read, execute, list, and write powers on all directories in <domain>/moodle. There are no spaces or extra lines after the final ?> in index.php or either of the config.php's. The 'strict_table_'something setting in my.ini has been deleted. vaguely suspect that the 'default document' setting is wonky, but I've not enough experience with any of these technologies to be certain of anything.

Thanks for any ideas,
Bob
Average of ratings: -
In reply to Bob Robertson

Re: 404 after basic installation

by Bob Robertson -
Quick addendum, for what it's worth: I renamed index.php to index.php.old, and replaced it with an index.php that simply called phpinfo(), as a test. I was able to access the test index.php; the permissions are identical, so far as I've seen.
In reply to Bob Robertson

Re: 404 after basic installation

by Matt Molloy -

Hello Bob,

Check your config file and make sure you don't have a trailing slash at the end of your wwwroot. It should be something like:

$CFG->wwwroot = 'http://domain/moodle';

and NOT:

$CFG->wwwroot = 'http://domain/moodle/';

In reply to Matt Molloy

Re: 404 after basic installation

by Bob Robertson -
Clean, unfortunately. A subtle point that I'd not thought to check, though; thank you.

-Bob
In reply to Bob Robertson

Re: 404 after basic installation

by Matt Molloy -

Hello Bob,

I'm thinking, if you put in a test index.php, chances are you called it by typing the url into the browser. The test index.php answers correctly.

When you try access the real index.php by clicking a link, the details in the config file are calling the file, and seem to be doing it from the wrong place. Hence, I suspect some minor fault in the config file.

If you restore the real index.php and type the proper url directly into the browser yourself, it should answer, just as the test one you put in there.

Then, maybe, click on a link to the page, and see what differences there are in the url in the address bar.

It might be of some help, hopefully,

Matt

In reply to Matt Molloy

Re: 404 after basic installation

by Bob Robertson -
No dice. I am unable to access admin/index.php using a browser, whether by clicking a link, or by typing the address directly. Further fodder for confuzzlement: I can get to html pages in the same directory without a problem. If I try to access almost any other php script in the directory, I get redirected to index.php, because the majority of the site doesn't exist. The sole exception that I've found thus far is config.php, which is I think the next step in the installation process?

Thanks for your help with this, Matt.

-Bob
In reply to Bob Robertson

Re: 404 after basic installation

by Matt Molloy -

The installation process creates the config.php and fills it with the details you supply.

If your server answers a phpinfo.php file, it shows you have a php engine running, so, assuming your moodle folder contains all the files it should have, then the php files should be able to answer you.

I can only think of 2 possibilities: the moodle folder is somehow corrupt or incomplete,

or

there is some slight misconfiguration in your config.php file.

Maybe you could post the file here, taking care to mask any usernames and passwords contained therein for database access.

Matt

In reply to Matt Molloy

Re: 404 after basic installation

by Bob Robertson -
There is a config.php in /moodle/admin/ which is distinct from the config.php in /moodle/ . When I access it, I get a fully functional form with several drop-down menus detailing default site language, security options, and the like. The installation page mentions this under 'go to the admin page to continue installation'. Further, I forgot to mention that the various databases were set up correctly. I don't know whether that's relevant or not, but you have my apologies either way.

Contents of /moodle/config.php, edited for security:
<?php  /// Moodle Configuration File
unset($CFG);
$CFG->dbtype    = 'mysql';
$CFG->dbhost    = '10.2.23.5';
$CFG->dbname    = 'moodle';
$CFG->dbuser    = 'moodle';
$CFG->dbpass    = '';
$CFG->dbpersist =  false;
$CFG->prefix    = 'mdl_';
$CFG->wwwroot   = 'http://10.2.23.5/moodle';
$CFG->dirroot   = 'C:\inetpub\wwwroot\moodle';
$CFG->dataroot  = 'C:\inetpub\moodledata';
$CFG->admin     = 'admin';
$CFG->directorypermissions = 00777;  // try 02777 on a server in Safe Mode
$CFG->unicodedb = true;  // Database is utf8
require_once("$CFG->dirroot/lib/setup.php");
// MAKE SURE WHEN YOU EDIT THIS FILE THAT THERE ARE NO SPACES, BLANK LINES,
// RETURNS, OR ANYTHING ELSE AFTER THE TWO CHARACTERS ON THE NEXT LINE.
?>

Although, looking at it, I do notice that require_once() is called on "C:\inetpub\wwwroot\moodle/lib/setup.php", which contains two different slash conventions. I just tried fixing it, and got the same 404; it's been changed back to the wierd version to prevent confusion.

I'm going to try calling /admin/config.php manually and see if that fixes anything.

Many Thanks,
Bob
In reply to Bob Robertson

Re: 404 after basic installation

by Bob Robertson -
Just tried it; no joy. After hitting 'Save Changes', I was redirected to a page saying something to the effect of 'Changes have been saved. <a>Continue</a>' which then presumably redirected me to the site root, and then to /admin/index.php .

Thanks for your help,
Bob
In reply to Bob Robertson

Re: 404 after basic installation

by Jas Sahota -

Make sure there is no blank space after the last php tag.  Even if there is one blank space, delete it can resolve the problem.

Hope this will help

Jas

In reply to Jas Sahota

Re: 404 after basic installation

by Bob Robertson -
A good tip, but I've already checked that in /moodle/config.php, /moodle/admin/config.php and /moodle/admin/index.php; where else should I be looking?

-Bob.
In reply to Bob Robertson

Re: 404 after basic installation

by Bob Robertson -
Possibly interesting: I tried accessing /moodle/lib/setup.php with my browser; it returned
Notice: Fatal: $CFG->wwwroot is not configured! Exiting. in C:\Inetpub\wwwroot\moodle\lib\setup.php on line 84

 
I tried accessing this with word; it worked fine, but I'm unable to check the appropriate line due to word-wrapping. Notepad apparently isn't reading the endline characters correctly, and so renders serveral lines of text all on the same screen line. I've had this problem with several .php files in the installation; is this indicative perhaps of corrupt files?
In reply to Bob Robertson

Re: 404 after basic installation

by Bob Robertson -
Okay, so I tried to install 1.5, just to see if anything interesting would happen. After the initial installation, but not into the database tables setup, I got the following:

Warning: main(config.php) [function.main]: failed to open stream: Permission denied in C:\Inetpub\wwwroot\moodle\index.php on line 15

Fatal error: main() [function.require]: Failed opening required 'config.php' (include_path='.;c:\php4\pear') in C:\Inetpub\wwwroot\moodle\index.php on line 15

My PHP newbie sense informs me that its not being allowed to open a \moodle\index.php, which presumably handles the next step in the installation. I therefore suspect a permissions problem both with this and the previous install attempt; unfortunately I am also an IIS newbie (and MySQL, it's a trifecta!) and apparently don't know how to check these permissions. I've been using right-click->Properties->Security tab, but that just reports that IUSR_ has read, write, and execute privileges. The scripts were also unable to create moodledata or config.php programmatically. I'm using Windows 2000 Pro; how does one go about doing this the correct way?

Thanks,
Bob
In reply to Bob Robertson

Re: 404 after basic installation

by Bob Robertson -
RESOLVED

It turned out to be permissions after all. For future newbies: when the forum posts say to give full access, they mean to actually have "Full control" checked under the security tab.

Thanks everyone for your time and patience.

Many Thanks,
Bob Robertson
In reply to Bob Robertson

Re: 404 after basic installation

by centox centox -
hi bob
congratulations for resolving the problem.

i followed the postings quite a while, because i have got the same problem.
but it seems that the cause is different.
up to now i was not able to solve it on my system.

even your newbe tip didn't help me. everyone has got full control on the web directory.

so, i have no clou anymore.
In reply to Bob Robertson

Re: 404 after basic installation

by centox centox -
Addendum:
I still got the problem but found out some more details.
a test php and the cron.php worked.

So, I tried to localize the problem in the index.php file by changing certain configurations and thus forcing some checks to raise the error message.

this worked up to here: if (!file_exists('../config.php'))
but not here anymore: if (ini_get_bool('session.auto_start'))

I assume the problem is in between...or completely somewhere else.

I appreciate any help (and others too, as i can see in the forum).

regards
centox