Open roukydesbois opened 1 year ago
I'm not really comfortable with composer, so I don't know if the issue is on the app itself or in the way it's installed
OK - looking at the installation script, I think that because the composer is installed/executed during the install script, it's done using root - there are probably some composer-related files that don't have the correct permissions to be run using the roundcube user. Running the command as root works, I'll try to look what needs to be done to have it working with the roundcube user.
this is still an issue.
ls -l total 3136 drwxr-x--- 2 roundcube www-data 4096 Aug 1 16:04 bin -rw-r----- 1 roundcube www-data 206050 Jul 23 2022 CHANGELOG.md -rw-r----- 1 root root 1213 Aug 1 16:04 composer.json -rw-r----- 1 roundcube www-data 1086 Jul 23 2022 composer.json-dist -rw-r--r-- 1 root root 122635 Aug 1 16:04 composer.lock_bak -rwxr-xr-x 1 root root 2719975 Aug 1 16:04 composer.phar drwxr-x--- 2 roundcube www-data 4096 Aug 5 20:53 config -rw-r----- 1 roundcube www-data 11368 Aug 1 16:04 index.php -rw-r----- 1 roundcube www-data 11199 Jul 23 2022 index.php.orig -rw-r----- 1 roundcube www-data 12661 Jul 23 2022 INSTALL drwxr-x--- 3 roundcube www-data 4096 Aug 1 16:04 installer -rw-r----- 1 roundcube www-data 4298 Jul 23 2022 jsdeps.json -rw-r----- 1 roundcube www-data 35147 Jul 23 2022 LICENSE drwxr-x--- 2 roundcube www-data 4096 Aug 1 16:07 logs drwxr-x--- 39 roundcube www-data 4096 Aug 1 16:04 plugins drwxr-x--- 8 roundcube www-data 4096 Aug 1 16:04 program drwxr-x--- 3 roundcube www-data 4096 Aug 1 16:04 public_html -rw-r----- 1 roundcube www-data 3853 Jul 23 2022 README.md -rw-r----- 1 roundcube www-data 967 Jul 23 2022 SECURITY.md drwxr-x--- 3 roundcube www-data 4096 Aug 1 16:04 skins drwxr-x--- 7 roundcube www-data 4096 Jul 23 2022 SQL drwxr-x--- 3 roundcube www-data 4096 Aug 1 16:04 temp -rw-r----- 1 roundcube www-data 4657 Jul 23 2022 UPGRADING drwxr-xr-x 21 root root 4096 Aug 1 16:04 vendor
`chown roundcube:www-data composer.* COMPOSER_HOME=./.composer php composer.phar require "kitist/html5_notifier" Cannot create cache directory /var/www/roundcube/./.composer/cache/repo/https---plugins.roundcube.net/, or directory is not writable. Proceeding without cache Cannot create cache directory /var/www/roundcube/./.composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache Info from https://repo.packagist.org: #StandWithUkraine Using version ^0.6.4 for kitist/html5_notifier ./composer.json has been updated Running composer update kitist/html5_notifier Loading composer repositories with package information Cannot create cache directory /var/www/roundcube/./.composer/cache/repo/https---plugins.roundcube.net/, or directory is not writable. Proceeding without cache Cannot create cache directory /var/www/roundcube/./.composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache Info from https://repo.packagist.org: #StandWithUkraine Updating dependencies Lock file operations: 1 install, 0 updates, 0 removals
could not finde the cache dir which also has permission issues. compose as root works
Describe the bug
When trying to install a new plugin via composer following the instructions given in the README, an error is encountered.
Context
Steps to reproduce
Connect to your server as root using SSH:
$ ssh admin@1.2.3.4 $ sudo -i
Log in as the roundcube user - which owns the roundcube directory - and navigate in it:
su -s /bin/bash - roundcube
$ cd /var/www/roundcube
Install the plugin you want using composer - note that you have to specify kitist/html5_notifier and not only html5_notifier:
$ roundcube@ynh:~$ COMPOSER_HOME=./.composer php composer.phar require "kitist/html5_notifier"
Expected behavior
No error ;)
Logs
PHP Fatal error: Uncaught TypeError: json_decode() expects parameter 1 to be string, bool given in phar:///var/www/roundcube/composer.phar/src/Composer/Json/JsonFile.php:201 Stack trace:
0 phar:///var/www/roundcube/composer.phar/src/Composer/Json/JsonFile.php(201): json_decode()
1 phar:///var/www/roundcube/composer.phar/src/Composer/Factory.php(313): Composer\Json\JsonFile->validateSchema()
2 phar:///var/www/roundcube/composer.phar/src/Composer/Factory.php(615): Composer\Factory->createComposer()
3 phar:///var/www/roundcube/composer.phar/src/Composer/Console/Application.php(470): Composer\Factory::create()
4 phar:///var/www/roundcube/composer.phar/src/Composer/Console/Application.php(412): Composer\Console\Application->getComposer()
5 phar:///var/www/roundcube/composer.phar/src/Composer/Console/Application.php(353): Composer\Console\Application->hintCommonErrors()
6 phar:///var/www/roundcube/composer.phar/vendor/symfony/console/Application.php(171): Composer\Console\Application->doRun()
7 phar:///var/www/roundcube/com in phar:///var/www/roundcube/composer.phar/src/Composer/Json/JsonFile.php on line 201
Fatal error: Uncaught TypeError: json_decode() expects parameter 1 to be string, bool given in phar:///var/www/roundcube/composer.phar/src/Composer/Json/JsonFile.php:201 Stack trace:
0 phar:///var/www/roundcube/composer.phar/src/Composer/Json/JsonFile.php(201): json_decode()
1 phar:///var/www/roundcube/composer.phar/src/Composer/Factory.php(313): Composer\Json\JsonFile->validateSchema()
2 phar:///var/www/roundcube/composer.phar/src/Composer/Factory.php(615): Composer\Factory->createComposer()
3 phar:///var/www/roundcube/composer.phar/src/Composer/Console/Application.php(470): Composer\Factory::create()
4 phar:///var/www/roundcube/composer.phar/src/Composer/Console/Application.php(412): Composer\Console\Application->getComposer()
5 phar:///var/www/roundcube/composer.phar/src/Composer/Console/Application.php(353): Composer\Console\Application->hintCommonErrors()
6 phar:///var/www/roundcube/composer.phar/vendor/symfony/console/Application.php(171): Composer\Console\Application->doRun()
7 phar:///var/www/roundcube/com in phar:///var/www/roundcube/composer.phar/src/Composer/Json/JsonFile.php on line 201
*** Additional info The app setting for PHP version is 7.4, php7.4-json is installed.