You are not logged in.

#1 2013-07-01 09:28:35

doragasu
Member
Registered: 2012-03-03
Posts: 152

[SOLVED] Owncloud: Cannot create admin account

Some time ago I installed apache to set up a subversion server, and it worked/works perfect. Now I wanted to set up owncloud. Following the LAMP wiki section, I installed sqlite, and installed and configured PHP. Everything went fine, and test.php worked as intended.

Then I installed owncloud-git from AUR, followed owncloud wiki section, and now I can access owncloud setup on http://<server_ip>. The setup page asks me to create an admin account. I write the admin username and password, then the page stays some seconds showing a "Finishing" indication, and goes back to the admin account creation page. And this loop goes forever.

The first time I accessed owncloud setup page, it complained about .htaccess file not working, so googling I found I had to set "AllowOverride All" in the Directory section of httpd.conf. Did it and the .htaccess warning dissapeared, but I got still the same result: an infinite loop trying to create admin account.

Then googled a bit more, and found some users with the same problem, pointing out that you have to provide a session.save_path in the php.ini file. Tried this setting session.save_path to "/tmp" and to "/usr/share/webapps/owncloud/sessions" (+ chown http.http) with no luck. I have verified session data is properly written to the configured session directory, so maybe that is not the problem.

Browsing owncloud.log file, each time I try to create the admin account, the following messages are added:

{"app":"core","message":"setting locale to en_US.UTF-8\/en_US.UTF8 failed. Support is probably not installed on your system","level":3,"time":"July 01, 2013 09:00:11"}
{"app":"PHP","message":"Invalid argument supplied for foreach() at \/usr\/share\/webapps\/owncloud\/lib\/config.php#146","level":4,"time":"July 01, 2013 09:00:11"}
{"app":"core","message":"setting locale to en_US.UTF-8\/en_US.UTF8 failed. Support is probably not installed on your system","level":3,"time":"July 01, 2013 09:00:11"}
{"app":"PHP","message":"Invalid argument supplied for foreach() at \/usr\/share\/webapps\/owncloud\/lib\/config.php#146","level":4,"time":"July 01, 2013 09:00:11"}
{"app":"PHP","message":"Invalid argument supplied for foreach() at \/usr\/share\/webapps\/owncloud\/lib\/config.php#146","level":4,"time":"July 01, 2013 09:00:22"}
{"app":"core","message":"setting locale to en_US.UTF-8\/en_US.UTF8 failed. Support is probably not installed on your system","level":3,"time":"July 01, 2013 09:00:22"}
{"app":"PHP","message":"Invalid argument supplied for foreach() at \/usr\/share\/webapps\/owncloud\/lib\/config.php#146","level":4,"time":"July 01, 2013 09:00:22"}
{"app":"core","message":"setting locale to en_US.UTF-8\/en_US.UTF8 failed. Support is probably not installed on your system","level":3,"time":"July 01, 2013 09:00:22"}
{"app":"PHP","message":"Invalid argument supplied for foreach() at \/usr\/share\/webapps\/owncloud\/lib\/config.php#146","level":4,"time":"July 01, 2013 09:00:22"}
{"app":"PHP","message":"Invalid argument supplied for foreach() at \/usr\/share\/webapps\/owncloud\/lib\/config.php#146","level":4,"time":"July 01, 2013 09:00:22"}
{"app":"core","message":"setting locale to en_US.UTF-8\/en_US.UTF8 failed. Support is probably not installed on your system","level":3,"time":"July 01, 2013 09:00:22"}
{"app":"core","message":"setting locale to en_US.UTF-8\/en_US.UTF8 failed. Support is probably not installed on your system","level":3,"time":"July 01, 2013 09:00:23"}
{"app":"PHP","message":"Invalid argument supplied for foreach() at \/usr\/share\/webapps\/owncloud\/lib\/config.php#146","level":4,"time":"July 01, 2013 09:00:23"}
{"app":"core","message":"setting locale to en_US.UTF-8\/en_US.UTF8 failed. Support is probably not installed on your system","level":3,"time":"July 01, 2013 09:00:23"}
{"app":"PHP","message":"Invalid argument supplied for foreach() at \/usr\/share\/webapps\/owncloud\/lib\/config.php#146","level":4,"time":"July 01, 2013 09:00:23"}
{"app":"PHP","message":"Invalid argument supplied for foreach() at \/usr\/share\/webapps\/owncloud\/lib\/config.php#146","level":4,"time":"July 01, 2013 09:00:23"}
{"app":"PHP","message":"Invalid argument supplied for foreach() at \/usr\/share\/webapps\/owncloud\/lib\/config.php#146","level":4,"time":"July 01, 2013 09:00:23"}

I suppose the locale related messages can be ignored. I have the system configured with es_ES locale, and owncloud pages are displayed in spanish. What worries me are the "Invalid argument supplied for foreach()" messages. Maybe there is the problem, but I do not know how to fix it sad. I have also noticed that time shown lacks the GMT+2 adjust. Where it shows 09:00:23, time in my machine was 11:00:23. I don't know if this behaviour is normal or not. I configured "date.timezone = Europe/Madrid" in php.ini, but that doesn't make a difference.

Anyone using owncloud here? Any suggestions are welcome.

EDIT: edited /etc/locale.gen, added en_US.UTF-8 locale, ran locale-gen and all the locale errors are gone, but the last 3 errors remain and I am still trapped in the admin account creation loop.

Last edited by doragasu (2013-07-02 14:17:28)

Offline

#2 2013-07-01 18:33:47

cookies
Member
Registered: 2013-01-17
Posts: 253

Re: [SOLVED] Owncloud: Cannot create admin account

I know from experience that

Invalid argument supplied for foreach()

usually means bad code: the array given to foreach is no array (because something went wrong) and noone made sure to check.

Unfortunately I can't really tell you where the problem is though, since the config.php file php complains about looks fine. You might add

var_dump($config_files);

right before line 146 and see what gets passed to foreach. http://php.net/manual/en/function.var-dump.php

Is there something else in OC::$SERVERROOT."/config/" besides the default config file?

Offline

#3 2013-07-02 14:16:43

doragasu
Member
Registered: 2012-03-03
Posts: 152

Re: [SOLVED] Owncloud: Cannot create admin account

Thanks a lot for help. Got it working to some extent. This is what I did:

Tried adding the var_dump() call before the foreach, and the output in the browser is "NULL". OC::$SERVERROOT is "/usr/share/webapps/owncloud" (I have displayed it by again using var_dump()). Inside "/usr/share/webapps/owncloud/config" (I have skipped the dot before "config", I suppose it is PHP stuff I can ignore) there are two files: "config.php" and "config.sample.php" I suppose config.php file should be returned by the glob functions, but it is not.

I have tried adding var_dump($config_files) after the glob function this way:

                // read all file in config dir ending by config.php
                $config_files = glob( OC::$SERVERROOT."/config/*.config.php");

                var_dump($config_files);

And displayed value in the browser was "bool(false)". So I tried removing the dot '.' before config.php, and it started working! Unfortunately pages are not properly rendered, I'll have a look to see if I can guess why.

Offline

#4 2013-07-02 17:40:47

cookies
Member
Registered: 2013-01-17
Posts: 253

Re: [SOLVED] Owncloud: Cannot create admin account

Hm, don't know about the rendering problem, but maybe the default config is read in twice (what does var_dump print out right before the foreach?).

BTW this is something you could try

private static function readData() {
	if( self::$init ) {
	return true;
	}

	// read all file in config dir ending by config.php
	$config_files = glob( OC::$SERVERROOT."/config/*.config.php");

	if(is_array($config_files)){
		//Filter only regular files
		$config_files = array_filter($config_files, 'is_file');

		//Sort array naturally :
		natsort($config_files);
	}else{
		//Create an empty array so we can add the default config later
		$config_files = array();
	}

	// Add default config
	array_unshift($config_files,OC::$SERVERROOT."/config/config.php");

	//Include file and merge config
	foreach($config_files as $file){
		include $file;
		if( isset( $CONFIG ) && is_array( $CONFIG )) {
			self::$cache = array_merge(self::$cache, $CONFIG);
		}
	}

	// We cached everything
	self::$init = true;

	return true;
}

It would be interesting to see if it works if there are other config files besides the default one (especially since I left the dot in the glob function, it should work but I haven't tested it).

Offline

#5 2013-07-03 06:52:08

doragasu
Member
Registered: 2012-03-03
Posts: 152

Re: [SOLVED] Owncloud: Cannot create admin account

The rendering problem was caused by the var_dump() function. Once I removed it, the rendering problems disappeared. Maybe it happened because owncloud wanted to display one of that windows that comes on top of the page, dimming everything else, and somehow this interferes with the var_dump().

There were some bugs on the file upload page, so I dowgraded from owncloud-git (version 6.x pre-alpa) to owncloud (version 5.0.7) and now everything is working perfect! Unfortunately I cannot test your suggestions without again upgrading to owncloud-git.

Again, thanks a lot for help!

Offline

#6 2013-07-07 12:03:41

cookies
Member
Registered: 2013-01-17
Posts: 253

Re: [SOLVED] Owncloud: Cannot create admin account

So, I found some time to set up apache and did some testing, the readData function now looks like this (and it's working perfectly, I'd say):

private static function readData() {
	if( self::$init ) {
	return true;
	}

	$the_default_config = OC::$SERVERROOT."/config/config.php";

	// read all file in config dir ending by config.php
	$config_files = glob( OC::$SERVERROOT."/config/*.config.php");

	if(is_array($config_files)){
		//Filter only regular files
		$config_files = array_filter($config_files, 'is_file');

		//Sort array naturally :
		natsort($config_files);

		// Add default config
		array_unshift($config_files, $the_default_config);
	}else{
		$config_files[] = $the_default_config;
	}

	//Include file and merge config
	foreach($config_files as $file){
		include $file;
		if( isset( $CONFIG ) && is_array( $CONFIG )) {
			self::$cache = array_merge(self::$cache, $CONFIG);
		}
	}

	// We cached everything
	self::$init = true;

	return true;
}

Unfortunately I could not find any bugs related to file upload during my testing (but I did not look really hard so I might have missed them). If you can give me some details I'll try and see if I can do anything about it. If not I'll just let the owncloud devs know about the fixed readData function.

Offline

#7 2013-07-08 06:56:38

doragasu
Member
Registered: 2012-03-03
Posts: 152

Re: [SOLVED] Owncloud: Cannot create admin account

The problems I found with git version were in the upload page. When I did click in the files icon in the left, the icons for "New" and "Upload" were not properly arranged, and I due to that I was not able to upload a single file. I was using Chromium, maybe the problem is browser dependent. Or maybe it has been fixed.

Offline

#8 2013-07-08 14:37:45

cookies
Member
Registered: 2013-01-17
Posts: 253

Re: [SOLVED] Owncloud: Cannot create admin account

Okay, I'll see what I can find, now that I know what I'm looking for.

Offline

Board footer

Powered by FluxBB