PHP Error in Nextcloud Logging- "File (/proc/cpuinfo) is not within the allowed path(s):.."

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version _(eg, 20.0.5)_: `Hub 6- 27.1.0`
Operating system and version _(eg, Ubuntu 20.04)_: `Ubuntu 22.04`
Apache or nginx version _(eg, Apache 2.4.25)_:  `Apache 2.4.52`
PHP version _(eg, 7.4)_: `php 8.1.23`

The issue you are facing: Nextcloud logging shows many, many PHP Errors related to opening or editing .docx or other Collabora-CORE elements.

Is this the first time you’ve seen this error? (Y/N): Not sure when this started. Recently Collabora documents were failing to open, but we’ve fixed that.

Steps to replicate it:

  1. Open or create a .docx file, or other Nextcloud Office task.
  2. Check logs, find errors.

The output of your Nextcloud log in Admin > Logging:

    Error	is_file(): open_basedir restriction in effect. File(/proc/cpuinfo) is not within the allowed 
    path(s): (/var/www/clients/client0/web1/web:/var/www/clients/client0/web1/private:/var/www/clients/clie 
nt0/web1/tmp:/var/www/sub.domain.ext/web:/srv/www/sub.domain.ext/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom) at /media/sdb1/nextcloud/web1/web/lib/private/Preview/Generator.php#303	

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'xxxxxxxxxxxxxxx',
  'passwordsalt' => 'xxxxxxxxxxxxxxxxxxxxxx',
  'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  'trusted_domains' =>
  array (
    0 => 'sub.domain.ext',
    1 => 'xxx.xxx.xxx',
  ),
  'datadirectory' => '/media/sdb1/nextcloud/web1/private/data',
  'dbtype' => 'mysql',
  'version' => '27.1.0.7',
  'overwrite.cli.url' => 'https://sub.domain.ext',
  'dbname' => 'xxxxxxxxxxx',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'xxxxxxxxxxxxxxx',
  'dbpassword' => 'xxxxxxxxxxxxx',
  'installed' => true,
  'app_install_overwrite' =>
  array (
    0 => 'epubreader',
    1 => 'files_ebookreader',
    2 => 'documentserver_community',
  ),
  'maintenance' => false,
  'default_phone_region' => 'US',
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'ssl',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'admin',
  'mail_domain' => 'domain.ext',
  'mail_smtphost' => 'smtp.domain.ext',
  'mail_smtpport' => '465',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'xxxxxxxxxxxxxxxx',
  'mail_smtppassword' => 'xxxxxxxxxxxxxxx',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => 0,
    'timeout' => 0.0,
  ),
  'theme' => '',
  'loglevel' => '2',
);

The output of your Apache/nginx/system log in /var/log/____:

sub.domain.ext:443 192.168.0.67 - - [20/Sep/2023:17:01:00 +0000] "GET /index.php/apps/serverinfo/update HTTP/2.0" 200 1009 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
sub.domain.ext:443 192.168.0.67 - - [20/Sep/2023:17:01:00 +0000] "GET /index.php/apps/serverinfo/update HTTP/2.0" 200 1009 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
sub.domain.ext:443 192.168.0.67 - - [20/Sep/2023:17:01:00 +0000] "GET /ocs/v2.php/apps/serverinfo/api/v1//basicdata?format=json HTTP/2.0" 200 864 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36" ...etc.


Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

Error	is_file(): open_basedir restriction in effect. File(/proc/cpuinfo) is not within the allowed path(s): (/var/www/clients/client0/web1/web:/var/www/clients/client0/web1/private:/var/www/clients/client0/web1/tmp:/var/www/sub.domain.ext/web:/srv/www/sub.domain.ext/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom) at /media/sdb1/nextcloud/web1/web/lib/private/Preview/Generator.php#303	

I’ve searched google on this category of error, and the few hits I’ve found “open_basedir restriction in effect” all seem to concern short term bugs on version updates in the past. I’m not convinced that is the case here. ( See: https://github.com/nextcloud/server/issues/37921 )

Yesterday evening I was also finding a similar error, but referring to a different file:
Error is_executable(): open_basedir restriction in effect. File(/usr/bin/gpg) is not within the
allowed path(s):

I would like to find how to eliminate these errors, as they are flooding the log. Thanks for any help!

Based on this discussion, the fix has not yet been published. You can try to manually apply it at a first step:

1 Like

Much thanks, j-ed, for your reply and the related links.

I’m happy to wait until NC28 to see if the errors go away. I don’t understand what @anon78853765 has done to resolve the errors. (It all makes my head spin!)

Good to know it’s on somebody’s to-do list.

ADDENDUM: I scratched my head looking at the code revisions in the post from @anon78853765 , and the sense of the task suddenly clicked for me. This noob does not write code, but I can follow a recipe. I saved a copy of Generator.php to Generator.php.save, then carefully deleted the indicated (-) lines of code (299,300), and added in the changes marked (+) by @anon78853765 and @kesselb (lines 299-312).

They DO stop the error messages from appearing on the web Logging page. Unfortunately that’s only because the logging page then failed to update at all.

I had to revert to the original Generator.php file to get logging to report to the website.

Even so, the whole experience expanded my understanding of Nextcloud, and how to administrate it. I’m very grateful to this community for helping me to learn today.

We’re just running Nextcloud files, not Collabora. But we worked around that error by adding /proc/ to the open_basedir line in the PHP settings. I think you can do that in PHP.ini if you run your own server.