Installation help

 
 
Picture of Christine Schneider
cannot find $CFG->dirroot path
 

after installation with complete config.php and database /moodle/user/editadvanced.php produces only a blanc page. It is not possible to edit admin or a new user.

Also moodle/user/editadvanced_form.php gives out the following

Warning: require_once() [function.require-once]: open_basedir restriction in effect. File(/lib/formslib.php) is not within the allowed path(s): (/var/www/web31/html/:/var/www/web31/phptmp/:/var/www/web31/files/:/var/www/web31/atd/:/usr/share/php/:/var/www/localhost/htdocs/horde/:/var/www/localhost/htdocs/horde/config/..) in /var/www/web31/html/moodle/user/editadvanced_form.php on line 3

Warning: require_once(/lib/formslib.php) [function.require-once]: failed to open stream: Operation not permitted in /var/www/web31/html/moodle/user/editadvanced_form.php on line 3

Fatal error: require_once() [function.require]: Failed opening required '/lib/formslib.php' (include_path='.:/usr/share/php/:/var/www/localhost/htdocs/horde/:/var/www/localhost/htdocs/horde/config/..') in /var/www/web31/html/moodle/user/editadvanced_form.php on line 3

The hoster says that pear is right but the problem is caused by require_once($CFG->dirroot.'/lib/formslib.php'); not finding the path to $CFG->dirroot.

Thank you for any hint!

 
Average of ratings: -
Capt. Moodle
Re: cannot find $CFG->dirroot path
Group DevelopersGroup Moodle HQGroup Testers
Christine - First question is which version of Moodle? My next step would be to verify that you actually have the formslib.php file in the /var/www/web31/html/moodle/lib folder. Then I would want to verify that the /var/www/web31/html/moodle/config.php file contains the line:

$CFG->dirroot = '/var/www/web31/html/moodle';

Let me know if that helps or not. Peace - Anthony
 
Average of ratings: -
Picture of Christine Schneider
Re: cannot find $CFG->dirroot path
 

Hi Anthony,

thank you for hearing me.

It is Moodle Version 1.9 - stable. Is it too new?

There is the line $CFG->dirroot   = '/var/www/web31/html/moodle'; in the config.php,

there also is the formslib.php file in the /var/www/web31/html/moodle/lib folder. But calling formslib.php in the browser, there comes the following:

Warning: require_once(HTML/QuickForm.php) [function.require-once]: failed to open stream: No such file or directory in /var/www/web31/html/moodle/lib/formslib.php on line 28

Fatal error: require_once() [function.require]: Failed opening required 'HTML/QuickForm.php' (include_path='.:/usr/share/php/:/var/www/localhost/htdocs/horde/:/var/www/localhost/htdocs/horde/config/..') in /var/www/web31/html/moodle/lib/formslib.php on line 28

Is that a hint?

Thank you! c

 
Average of ratings: -
Capt. Moodle
Re: cannot find $CFG->dirroot path
Group DevelopersGroup Moodle HQGroup Testers
Christine - Moodle 1.9 should not be too new to work. It looks like you are trying to call this /lib/formslib.php page directly. However, this file contains functions used for creating forms and is not intended to be called directly. If you login to Moodle and functions from that file are needed it will be usable. Does that make sense? Same with /user/editadvanced_form.php - it is not meant to be viewed directly but to be used by other files. In any case, getting back to what got you started down this mess was a blank page. Try going to administration and turn debugging on to all (NOT developer). Then go back to the page that was coming up blank and let me know what error message you get. We should be able to trace down your problem from there.Peace - Anthony
 
Average of ratings: -
Picture of Mauno Korpelainen
Re: cannot find $CFG->dirroot path
Group Particularly helpful Moodlers

Maybe the problem is in php settings - the first warning "open_basedir restriction in effect" could mean that value of open_basedir should be changed or commented by host (or custom php.ini)

There might be some other restrictions in php info too...

 
Average of ratings: -
Picture of Christine Schneider
Re: cannot find $CFG->dirroot path
 
Hi Mauno, thank you for answering to my problem. What php settings do you mean exactly? I discussed the problem with the admin of my host. I also sent him the php setting from the moodle documentation. He is fit in php but does not see the problem. chr
 
Average of ratings: -
Picture of Mauno Korpelainen
Re: cannot find $CFG->dirroot path
Group Particularly helpful Moodlers

open_basedir

Edit: (some info from php.net)

open_basedir limits the files that can be opened by PHP to the specified directory-tree, including the file itself.

When a script tries to open a file with, for example, fopen() or gzopen(), the location of the file is checked. When the file is outside the specified directory-tree, PHP will refuse to open it. All symbolic links are resolved, so it's not possible to avoid this restriction with a symlink. If the file doesn't exist then the symlink couldn't be resolved and the filename is compared to (a resolved) open_basedir .

The special value . indicates that the working directory of the script will be used as the base-directory. This is, however, a little dangerous as the working directory of the script can easily be changed with chdir().

In httpd.conf, open_basedir can be turned off (e.g. for some virtual hosts) the same way as any other configuration directive with "php_admin_value open_basedir none".

Under Windows, separate the directories with a semicolon. On all other systems, separate the directories with a colon. As an Apache module, open_basedir paths from parent directories are now automatically inherited.

The restriction specified with open_basedir is actually a prefix, not a directory name. This means that "open_basedir = /dir/incl" also allows access to "/dir/include" and "/dir/incls" if they exist. When you want to restrict access to only the specified directory, end with a slash. For example: "open_basedir = /dir/incl/"

The default is to allow all files to be opened (value is null)

 
Average of ratings: -
Picture of Mauno Korpelainen
Re: cannot find $CFG->dirroot path
Group Particularly helpful Moodlers

I think your host should change in open_basedir

/var/www/web31/html/

to

/var/www/web31/html

to let you use all files in subfolders of /var/www/web31/html/

(if they really must use open_basedir restriction)

Edit: ...you may also need to drop tables from database and delete all files and folders from moodledata folder to start installing moodle from the beginning (if no administrator account has been created).

 
Average of ratings: -
Picture of Christine Schneider
Re: cannot find $CFG->dirroot path
 

of course I should not call this files directly, but the blank page links to this files whith this $CFG->dirroot path.

First time the blank page appeared in the install routine after the successful database setup - exactly at the point, where the admin should be defined. After ignoring this a login with default password is possible. But changing password or creating new user causes blank page again. chr

 
Average of ratings: -
Picture of Christine Schneider
Re: cannot find $CFG->dirroot path
 

Solution found!

The essential error message is

Warning: require_once(HTML/QuickForm.php) [function.require-once]: failed to open stream: No such file or directory in /var/www/web31/html/moodle/lib/formslib.php on line 28

The server prefers the installed pear and not the one delivered with moodle, but the installed one does not contain all required. So

/var/www/web31/html/moodle/lib/pear/

must be added to the include_path.

But which user should know that? It is not mentioned in the Doc-Requirements. I wonder nobody else seem to have my problems...

Thank you all! Special thanks to the Admin of my VServer Actorix in Germany!

Chr

 
Average of ratings: -
Arasp Kazemian
Re: cannot find $CFG->dirroot path
 
Hello,

I have the same problem as yours. Can you explain me exactly what I should do?
What file should I edit exactly?

Please give me more clear information about your post.
 
Average of ratings: -
Picture of Richard Enison
Re: cannot find $CFG->dirroot path
 
FK,

CS is no longer enrolled. But I know exactly what she was talking about. I had noticed the discrepancy between the two PEAR paths myself and wondered why it wasn't documented. I guess I assumed it must not be that critical. It now appears that it is!

Anyway, the answer is that it depends on whether you have your own server, or are using a commercial web host. The include_path is defined in the active php.ini file, so that would be the file to edit if you have your own server. If you are sharing a server then you probably don't have direct access to that file. In that case you need to ask tech support for your host
  1. whether they allow you to create custom php.ini files;
  2. whether you can change the include_path setting that way;
  3. how to create and deploy such files;
  4. if not, and if the webserver is Apache, whether they allow you to use .htaccess file(s);
  5. whether you can use a php_value directive in an .htaccess file to set include_path;
  6. or whether they need to make the change for you;
  7. if so, but they are not willing to, CHANGE HOSTS!
RLE
 
Average of ratings: -
Arasp Kazemian
Re: cannot find $CFG->dirroot path
 
well, I have my own server. with Cpanel and whm.

can you tell me what I should do?

I guess it is better to mention that my website was working very fine, but all of a sudden this problem appeared after almost 6 month of working fine !

I was going to enable LADP and I updated apache (I guess this might be the reason)

Now can You tell me what I should do.
 
Average of ratings: -
Arasp Kazemian
Re: cannot find $CFG->dirroot path
 
ok,

I successfully changed the php.ini file and I changed the include_path (I changed php to pear)

but the problem is not yet solved,

if you go to www.ezaban.net and try to create a new account,

it will show this error:


Warning: require_once(HTML/QuickForm.php) [function.require-once]: failed to open stream: No such file or directory in /home/ezabann/public_html/lib/formslib.php on line 25

Fatal error: require_once() [function.require]: Failed opening required 'HTML/QuickForm.php' (include_path='.:/usr/lib/php:/usr/local/lib/php:/home/ezabann/php') in /home/ezabann/public_html/lib/formslib.php on line 25
 
Average of ratings: -
Arasp Kazemian
Re: cannot find $CFG->dirroot path
 
This was exactly what I had in php.ini of the whole server:

.:/usr/lib/php:/usr/local/lib/php

and I changed it to:

.:/usr/lib/pear:/usr/local/lib/pear

But it did not change anything. I hope I got something wrong.

P.S I cannot install new and fresh moodle on another domain in my server. (at the time it goes to editadvance or sth like, I will face an empty page.

another old version of moodle at www.ezaban.com/uni has the problem with editing profile of the users and creating new account. but I can see the list of users.

in www.ezaban.net (which is suffering the big problem) :
I cannot create new accout.
I cannot watch the list of users.
I cannot edit my own profile too.

I hope these information give you an idea about my problem and its possible solution.

Thanks,
 
Average of ratings: -
Picture of Richard Enison
Re: cannot find $CFG->dirroot path
 
FK,
  1. This is very unusual. I have never before encountered someone who had cPanel on his/her own server. Do I understand you correctly: you own the machine, and you put cPanel on it? Usually cPanel (or something similar, like Plesk, Webmin, etc.) is a service offered by commercial web hosts to their clients so they can access their web sites. People don't need anything like that on their own servers because they have full access to them anyway; unless for some reason they are geographically distant from them part of the time, I suppose. I do recall a client of mine a couple of years ago who had his own server and he put Webmin on it so contracting programmers like me could access his websites remotely.
  2. I was not familiar with whm, so I looked it up at http://www.acronymfinder.com. Apparently it stands for Web Host Manager, and when I clicked on it, I was referred to an article on cPanel at the Free Dictionary Encyclopaedia! It pretty much confirmed what I said about it:

    cPanel ("Control Panel") is a graphical web-based web-hosting control panel, designed to make administration of websites easy. cPanel handles all aspects of website administration in its interface. The software, which is proprietary and distributed by cPanel Inc., is designed for use by commercial web hosting services, so the company does not offer a reduced-cost personal use license; however, owners of non-profit organisations such as educational institutions and charities can request a license at a reduced cost. Reduced prices are frequently available from dedicated-server companies, who install it along with the operating system.
  3. You say you changed php to pear in the include_path in your php.ini file, which is not exactly the change I had in mind, but the error msg. does not bear this out. It shows the include_path as '.:/usr/lib/php:/usr/local/lib/php:/home/ezabann/php'. The word pear does not occur in that anywhere. I can only conclude that the php.ini file you edited was not the active one.

    With php4, there needs to be a php.ini file in every directory that has php files in it. But with php5 and higher, there is only one active php.ini file at a time, although there may be many php.ini files on your computer. Run a phpinfo to find out where it is. Look in the left hand column near the top for Configuration File (php.ini) Path. This should give you the location of the active file, although if there is also an entry for Loaded php.ini file, it could be either one of them. So try one, try the other, see which one it responds to. It couldn't hurt to edit both.
  4. The include_path for your PHP installation, as shown in the error msg., consists of four pathnames separated by colons. The first of these is just a dot, which represents the current working directory. Your main Moodle directory, which is what the value of $CFG->dirroot should be, is, according to the error msg., /home/ezabann/public_html. So what you need to add to your include_path setting in the active php.ini file (after a colon, of course), is /home/ezabann/public_html/lib/pear.
  5. As for the other problems you report: lets take care of one at a time. Who knows, maybe some or all of them will go away after you fix this one. It's been known to happen.
RLE
 
Average of ratings: -
Arasp Kazemian
Re: cannot find $CFG->dirroot path
 
Hi again,

thanks for your support.

Well, as you know WHM (Web Host Manager) is a graphical interface to deal with the server and cpanel (Contol Panel) is what we could give to our customers. (However, I am not a webhosting provider myself, I use this dedicated server for personal uses)

1- the dir root in the config is exactly this: $CFG->dirroot = '/home/ezabann/public_html';

2. As you see there is no dot after public_html. I just change php to pear in php.ini . I am not sure what we see that dot in the error message.

3- It is strange for myself too that why because of changing the php.ini we still do not see the change in error message.

4- I changed the php.ini file with SSH to the server and I checked it on WHM too. The php was changed to pear.

Now I try again to see if I did something wrong or not.

By the way: here is the php info if you wanna check it: http://www.ezaban.net/info.php
 
Average of ratings: -
Arasp Kazemian
Re: cannot find $CFG->dirroot path
 
well, I found that

the local value of Include_path is .:/usr/lib/php:/usr/local/lib/php:/home/ezabann/php


the master value of include_path is what I change in php.ini :

.:/usr/lib/pear:/usr/local/lib/pear


so can you tell me how am I gonna change the php.ini of a local domain. the info.php was uploaded in public_html of the www.ezaban.net which has the main problem.


 
Average of ratings: -
Arasp Kazemian
Re: cannot find $CFG->dirroot path
 
I recompiled the apache server with PHP 5.2.5 without pear.

Nothing changed.
The error is still the same as before.

Please somebody help me out.
 
Average of ratings: -
Picture of Pablo Cecere
Re: cannot find $CFG->dirroot path
 

still having this $CFG problem?

the problem is for sure in config.php file that is in the moodle root dir.

edit that file, and paste a copy of it here.

I will tell you how to fix it. That same thing happened to me.

Pablo

pcecere@gmail.com

 
Average of ratings: -
Picture of Richard Enison
Re: cannot find $CFG->dirroot path
 
FK,

If you do, be sure to remove your database password first!

PC,

I'm not convinced it is a config.php problem. If dirroot were wrong, it wouldn't have gotten as far as it did. But if there is something wrong with the file, we can have a race to see who posts the fix first! big grin

RLE
 
Average of ratings: -
Picture of Richard Enison
Re: cannot find $CFG->dirroot path
 
FK,

  1. I didn't say there was, or should be, a dot after public_html. I said the first of the four pathnames in your include_path was a dot. The very first character in include_path is a dot (call it a period, full stop, or decimal point if you want), followed by a colon.
  2. Changing php to pear in include_path makes no sense. That's why I said it wasn't the change I had in mind. The important thing is, as you know, that change was not reflected in the error msg., or in the local column in the phpinfo output.
  3. I should have mentioned that changes to php.ini don't take effect until after you restart your webserver (Apache). I have looked at your phpinfo output, now that you have recompiled PHP (and presumably restarted Apache). Both master and local values of include_path now show

    .:/usr/lib/php:/usr/local/lib/php

  4. Now if you make the change I suggested, and restart Apache, it will say

    .:/usr/lib/php:/usr/local/lib/php:/home/ezabann/public_html/lib/pear
  5. Based on the phpinfo output you reported, it now appears that your problem was not that you edited the wrong php.ini file. My guess is that you just needed to restart Apache. But that just explains why the change you made (the wrong change) was not reflected in the error msg., or in the local column in the phpinfo output. Now if you make the change I suggested (to /usr/local/lib/php.ini) and restart Apache, we'll see if that helps.
RLE
 
Average of ratings: -