core icon indicating copy to clipboard operation
core copied to clipboard

{"app":"PHP","message":"Cannot redeclare class OC\\Search at \/my\/root/path\/lib\/private\/search.php#30","level":3,"time":"2014-08-13T16:05:25+00:00"}

Open treynolen opened this issue 12 years ago • 5 comments

Steps to reproduce

  1. Install multiple instances of cloud on server
  2. Activation of one of the clouds cause all others to give 500 error

Expected behaviour

All clouds should work separately

Actual behaviour

All clouds but one give 500 error with the owncloud.log showing this: {"app":"PHP","message":"Cannot redeclare class OC\Search at /my/root/path/lib/private/search.php#30","level":3,"time":"2014-08-13T16:05:25+00:00"}

Resolution

/lib/private/search.php was edited and all lines commented out from line 30 to 96 (the end). This was done on all clouds except one and they all worked thereafter.

Server configuration

Operating system: Ubuntu 12.04.1 64-bit Web server: Apache 2.2

Database: MySQL 5.5.22 PHP version: 5.3.10 ownCloud version: (see ownCloud admin page) 7.0.1 Updated from an older ownCloud or fresh install: both List of activated apps:

The content of config/config.php:

<?php
$CONFIG = array (
  'installed' => true,
  'dbtype' => 'mysql',
  'dbname' => 'scbcloud',
  'dbuser' => 'oc_netsol',
  'dbpassword' => '',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'passwordsalt' => '',
  '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' => 'smtp',
  'mail_smtppassword' => 'letmesend',
  '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',
  ),
);

Not using external storage

SSL is in use

Client configuration

All browsers (Firefox, Chrome, Safari, etc)

Operating system: Windows, Linux, Mac

Logs

Web server error log

[Wed Aug 13 11:00:43 2014] [error] [client 74.252.14.240] PHP Fatal error:  Cannot redeclare class OC\\Search in /var/www/fils/lib/private/search.php on line 30

ownCloud log (data/owncloud.log)

{"app":"PHP","message":"Cannot redeclare class OC\\Search at \/var\/www\/fils\/lib\/private\/search.php#30","level":3,"time":"2014-08-13T16:00:44+00:00"}

Comments:

This could be a server misconfiguration, but it was working in this config before 7.0. We are unable to find the configuration error if this is the case. All clouds are on separate IP addresses because of SSL. We did notice that the logs in one reference files in another, but are unable to determine why. Config of two "conflicting clouds" follows: Cloud 1:

<IfModule mod_ssl.c>
<VirtualHost 192.168.16.52:443>
    ServerAdmin [email protected]
    ServerName scb.internetpro.net
    DocumentRoot /var/www/scb/
<Directory /var/www/scb >
    AllowOverride All
</Directory>
    ErrorLog ${APACHE_LOG_DIR}/scb.internetpro.net_error.log
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/scb.internetpro.net_access.log combined
    SSLEngine on
    SSLCertificateFile    /etc/ssl/certs/wildcard.internetpro.net.crt
    SSLCertificateKeyFile /etc/ssl/private/wildcard.internetpro.net.key
    SSLCertificateChainFile /etc/ssl/certs/namecheap-positive.ca
    <FilesMatch "\.(cgi|shtml|phtml|php)$">
        SSLOptions +StdEnvVars
    </FilesMatch>
    <Directory /usr/lib/cgi-bin>
        SSLOptions +StdEnvVars
    </Directory>
    BrowserMatch "MSIE [2-6]" \
        nokeepalive ssl-unclean-shutdown \
        downgrade-1.0 force-response-1.0
    BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
</IfModule>

Cloud2:

<IfModule mod_ssl.c>
<VirtualHost 74.252.14.179:443>
    ServerAdmin [email protected]
    ServerName cloud.internetpro.net
    DocumentRoot /var/www/netsol/
<Directory /var/www/netsol >
    AllowOverride All
</Directory>
    ErrorLog ${APACHE_LOG_DIR}/cloud.internetpro.net_error.log
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/cloud.internetpro.net_access.log combined
    SSLEngine on
    SSLCertificateFile    /etc/ssl/certs/wildcard.internetpro.net.crt
    SSLCertificateKeyFile /etc/ssl/private/wildcard.internetpro.net.key
    SSLCertificateChainFile /etc/ssl/certs/namecheap-positive.ca
    <FilesMatch "\.(cgi|shtml|phtml|php)$">
        SSLOptions +StdEnvVars
    </FilesMatch>
    <Directory /usr/lib/cgi-bin>
        SSLOptions +StdEnvVars
    </Directory>
    BrowserMatch "MSIE [2-6]" \
        nokeepalive ssl-unclean-shutdown \
        downgrade-1.0 force-response-1.0
    BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
</IfModule>

treynolen avatar Aug 13 '14 16:08 treynolen

@butonic Can you have a look please?

karlitschek avatar Aug 13 '14 19:08 karlitschek

@treynolen did you upgrade from a previous version of ownCloud? Did you properly follow the upgrade steps - especially the fact that the old code has to be deleted?

http://doc.owncloud.org/server/7.0/admin_manual/maintenance/update.html#upgrading-the-owncloud-server

THX

DeepDiver1975 avatar Aug 13 '14 22:08 DeepDiver1975

Some of the instances were upgraded. Another cloud instance was a new install. All had the same issues and yes, we did follow the upgrade instructions. We moved the entire installation, unpacked the new files, and then moved the config and data back into the new installation.

treynolen avatar Aug 13 '14 22:08 treynolen

This is indeed likely a configuration error. Did you update the path to the apps folder for all instances in config.php?

  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/var/www/scb/apps', // <- make sure this matches the corresponding cloud instance
      'url' => '/apps',
      'writable' => true,
    ),
  ),

Explanation: several apps contain a require_once __DIR__ . '/../<whatever>'; which might cause loading a completely separate base.php, because __DIR__ is used to build the path.

@DeepDiver1975 @craigpg @karlitschek I guess this is worth a technical debt issue.

butonic avatar Aug 14 '14 10:08 butonic

OK, I found the issue. We accidentally had the /lib/private tree in our themes folder. That was apparently "double calling" some functions. This is definitely a configuration issue on our part.

Thank you for the help. Please close and mark as resolved (idiocy is the issue).

treynolen avatar Aug 15 '14 15:08 treynolen