core icon indicating copy to clipboard operation
core copied to clipboard

500 error caused by PHP Fatal error: Class 'OC\\Search' not found in /var/www/cloud1/lib/private/server.php on line 190

Open treynolen opened this issue 12 years ago • 11 comments

Steps to reproduce

  1. Log into cloud
  2. Log out of cloud - error happens here

There are many other ways to get it to happen, but this is the easiest.

Expected behaviour

In this case, you should be logged out without error.

Actual behaviour

The server reports a 500 Internal Server Error

Server configuration

Operating system: Ubuntu 12.04.4

Web server: Apache 2.2

Database: MySQL 5.5.22

PHP version: 5.3.10

ownCloud version: 7.0.7

Updated from an older ownCloud or fresh install: both

List of activated apps: Bookmarks Calendar Contacts Deleted files Documents PDF Viewer Pictures Shared Files Text Editor Updater Versions

The content of config/config.php:

<?php
$CONFIG = array (
  'installed' => true,
  'dbtype' => 'mysql',
  'dbname' => 'scbcloud',
  'dbuser' => 'oc_netsol',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'forcessl' => true,
  'blacklisted_files' => 
  array (
    0 => '.htaccess',
  ),
  'overwritehost' => '',
  'overwriteprotocol' => '',
  'overwritewebroot' => '',
  'overwritecondaddr' => '',
  'proxy' => '',
  'proxyuserpwd' => '',
  'theme' => 'netsol',
  '3rdpartyroot' => '',
  '3rdpartyurl' => '',
  'defaultapp' => 'files',
  'knowledgebaseenabled' => false,
  'knowledgebaseurl' => 'http://api.apps.owncloud.com/v1',
  'appstoreenabled' => true,
  'appstoreurl' => 'http://api.apps.owncloud.com/v1',
  'mail_smtpdebug' => false,
  'mail_smtpmode' => 'sendmail',
  'mail_smtphost' => 'smtp.internetpro.net',
  'mail_smtpport' => 465,
  'mail_smtptimeout' => 10,
  'mail_smtpsecure' => 'ssl',
  'mail_smtpauth' => true,
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpname' => 'hidden',
  'mail_smtppassword' => 'hidden',
  'trashbin_retention_obligation' => 90,
  'allow_user_to_change_display_name' => true,
  'appcodechecker' => '',
  'updatechecker' => true,
  'log_type' => 'owncloud',
  'logfile' => '',
  'loglevel' => '1',
  'remember_login_cookie_lifetime' => 1296000,
  'session_lifetime' => 86400,
  'custom_csp_policy' => 'default-src \'self\'; script-src \'self\' \'unsafe-eval\'; style-src \'self\' \'unsafe-inline\'; frame-src *; img-src *; font-src \'self\' data:; media-src *',
  'xframe_restriction' => true,
  'maintenance' => false,
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/var/www/scb/apps',
      'url' => '/apps',
      'writable' => true,
    ),
  ),
  'user_backends' => 
  array (
    0 => 
    array (
      'class' => 'OC_User_IMAP',
      'arguments' => 
      array (
        0 => '{imap.gmail.com:993/imap/ssl}INBOX',
      ),
    ),
  ),
  'customclient_desktop' => 'http://www.netsolinc.com/sync-clients/',
  'customclient_android' => 'https://play.google.com/store/apps/details?id=com.owncloud.android',
  'customclient_ios' => 'https://itunes.apple.com/us/app/owncloud/id543672169?mt=8',
  'instanceid' => '51f1b2ac80725',
  'version' => '7.0.1.1',
  'trusted_domains' => 
  array (
    0 => 'scb.internetpro.net',
  ),
);

Are you using external storage, if yes which one: local/smb/sftp/... NO

Are you using encryption: yes/no No

Client configuration

Browser: Any

Operating system: Any

Logs

Web server error log

[Tue Aug 19 13:54:33 2014] [error] [client 70.193.79.156] PHP Fatal error:  Class 'OC\\Search' not found in /var/www/sobanco/lib/private/server.php on line 190
[Tue Aug 19 13:55:04 2014] [error] [client 70.193.79.156] PHP Fatal error:  Class 'OC\\Search' not found in /var/www/sobanco/lib/private/server.php on line 190
[Tue Aug 19 13:55:36 2014] [error] [client 70.193.79.156] PHP Fatal error:  Class 'OC\\Search' not found in /var/www/sobanco/lib/private/server.php on line 190
[Tue Aug 19 13:56:07 2014] [error] [client 70.193.79.156] PHP Fatal error:  Class 'OC\\Search' not found in /var/www/sobanco/lib/private/server.php on line 190
[Tue Aug 19 14:01:42 2014] [error] [client 70.193.79.156] PHP Fatal error:  Class 'OC\\Search' not found in /var/www/scb/lib/private/server.php on line 190
[Tue Aug 19 14:02:13 2014] [error] [client 70.193.79.156] PHP Fatal error:  Class 'OC\\Search' not found in /var/www/scb/lib/private/server.php on line 190
[Tue Aug 19 14:22:57 2014] [error] [client 70.193.79.156] PHP Fatal error:  Class 'OC\\Search' not found in /var/www/scb/lib/private/server.php on line 190
[Tue Aug 19 14:23:29 2014] [error] [client 70.193.79.156] PHP Fatal error:  Class 'OC\\Search' not found in /var/www/scb/lib/private/server.php on line 190
[Tue Aug 19 14:49:18 2014] [error] [client 70.193.79.156] PHP Fatal error:  Class 'OC\\Search' not found in /var/www/scb/lib/private/server.php on line 190
[Wed Aug 20 10:06:05 2014] [error] [client 74.252.14.240] PHP Fatal error:  Class 'OC\\Search' not found in /var/www/scb/lib/private/server.php on line 190, referer: https://scb.internetpro.net/index.php/apps/files/
[Wed Aug 20 10:06:06 2014] [error] [client 74.252.14.240] PHP Fatal error:  Class 'OC\\Search' not found in /var/www/scb/lib/private/server.php on line 190, referer: https://scb.internetpro.net/
[Wed Aug 20 10:06:08 2014] [error] [client 74.252.14.240] PHP Fatal error:  Class 'OC\\Search' not found in /var/www/scb/lib/private/server.php on line 190
[Wed Aug 20 10:06:19 2014] [error] [client 74.252.14.240] PHP Fatal error:  Class 'OC\\Search' not found in /var/www/scb/lib/private/server.php on line 190

ownCloud log (data/owncloud.log)

{"app":"PHP","message":"touch(): Unable to create file  because No such file or directory at \/var\/www\/scb\/lib\/private\/log\/owncloud.php#49","level":3,"time":"2014-08-20T15:06:00+00:00"}
{"app":"PHP","message":"Class 'OC\\Search' not found at \/var\/www\/scb\/lib\/private\/server.php#190","level":3,"time":"2014-08-20T15:06:19+00:00"}

Comments: This server is configured with multiple cloud instances. The instances are all under /var/www. The DocumentRoot for each is in the form of /var/www/cloud1, /var/www/cloud2, etc. Each cloud instance will work fine on its own if all others are disabled. Each cloud instance is using a separate IP address for SSL (each cloud has a valid SSL). When more than one cloud instance is activated, we start seeing errors in the logs referencing paths in the OTHER clouds. See above where one path referenced is /var/www/sobanco and one is /var/www/scb. I set up the virtualhost using the openbase_dir restriction in PHP (e.g.: php_admin_value open_basedir "/var/www/scb/:/tmp/"). When I did that, I was able to track down where the other paths were being called/referenced. It is in the lib/autoloder.php file. Here is a sample log entry:

[Tue Aug 19 12:07:13 2014] [error] [client 70.193.76.17] PHP Fatal error: require_once(): Failed opening required '/var/www/netsol/lib/private/util.php' (include_path='/var/www/scb/lib/private:/var/www/scb/config:/var/www/scb/3rdparty:/var/www/scb/apps:/var/www/scb/lib:.:/usr/share/php:/usr/share/pear:/var/www/scb') in /var/www/scb/lib/autoloader.php on line 142

Notice that this cloud was in the /var/www/scb DocumentRoot, but the file trying to be refernenced was in the /var/www/netsol DocumentRoot.

The part of autoloader.php referenced is: foreach ($pathsToRequire as $fullPath) { require_once $fullPath;

And $fullPath is $fullPath = stream_resolve_include_path($path);

So, I believe that the stream_resolve_include_path funtion is returning incorrect paths for some reason.

treynolen avatar Aug 20 '14 15:08 treynolen

Thanks for the detailed report.

When you say multiple cloud instances, are you referring to completely separate ownCloud instances that work independently from each other or are these part of a cluster (basically being clones of each other) ?

If the latter, you might need to setup a frontend address and fill in the "overwriteXXX" fields in the config to always point to the front ownCloud.

PVince81 avatar Aug 22 '14 10:08 PVince81

@treynolen you had this issue 9 days back - and it was solved - https://github.com/owncloud/core/issues/10404#issuecomment-52322912

Now the issue is back - strange?

DeepDiver1975 avatar Aug 22 '14 10:08 DeepDiver1975

I dn't think the issue actually left...I'm not sure it is actually the same issue. In the previous one, we did have some files in the theme which were causing similar errors, but now our theme only has .css files and images.

@PVince81..."multiple cloud instances" means that this server is basically doing shared hosting and each owncloud instance has its own installation. So, you can go to https://cloud1.domain.com and its structure would be in /var/www/cloud1. If you go to https://cloud2.domain.com, the installation is in /var/www/cloud2. Each has its own database and should be completely separate, but according to the logs, each cloud instance is referencing files in the others....And it looks like it gets that information from autoloader.php.

treynolen avatar Aug 22 '14 11:08 treynolen

I have moved files around so that all instances are not under the /var/www folder, but I'm still having the same issue. I also installed "stock" instances with NO theme to rule out theme issue. I'm at a loss...I just can't understand how it would be referencing other clouds on the same server which are being served with completely different URLs on completely different IP addresses. This server has hosted OC 4.5 through 7.0.1 and this just started with the 7.0 series.

treynolen avatar Aug 22 '14 16:08 treynolen

Are you still seeing this issue with 7.0.5 or 8.0.2 ?

PVince81 avatar Apr 29 '15 14:04 PVince81

Please try again with 8.0.6 or 8.1.1.

If you're still experiencing this issue, please reopen.

PVince81 avatar Aug 21 '15 08:08 PVince81

Hello, I'm experiencing similar issue on 7.0.12. (I know, it's time to upgrade). I have 3 virtualhost serving 3 different owncloud installations, all at the same version. They arent sharing anything except the httpd: different virtualhost, different listening ports, different database, different data directory. But i keep getting errors in apache error.log regarding one of the other istances. (e.g. on error.log for installation called "owncloud" i find errors showing path of files from "owncloud-2" )

remixtj avatar Mar 10 '16 09:03 remixtj

The issue seems related to memory caching of paths. From autoloader.php of stable9, function load (which is the same also for stable7 and later);

    if ($this->memoryCache) {
            $pathsToRequire = $this->memoryCache->get($class);
        }

I keep getting $pathsToRequire after this function call full of paths from wrong directories.

I have several virtualhost on the same httpd with mod_php.

@PVince81 I think that issue has to be reopened, since there hasn't been significative changes on the autoloader.

remixtj avatar Mar 10 '16 11:03 remixtj

Forgot to say that i'm using APCu on php 5.6.11

remixtj avatar Mar 10 '16 11:03 remixtj

Found the issue: all my instances has the same instanceid. When namespacing (no matter if APCu or Xcache), instanceid is used as prefix. This leads to the issue

@treynolen can you still check if this is true?

remixtj avatar Mar 10 '16 15:03 remixtj

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Aug 05 '19 15:08 lock[bot]