I installed Composer using PuTTY via SSH on my GoDaddy shared hosting environment, intending to manage and update Drupal modules. The hosting environment is shared, with PHP version 8.2 and SSH access enabled. According to the Composer documentation, the tool requires at least PHP 7.2.5 for the latest version to function, and it specifies the following prerequisites:
PHP Settings: Certain sensitive PHP settings and compile flags are required. Incompatibilities are flagged during the installation process.
Supporting Applications: Composer relies on tools such as 7z (or 7zz), gzip, tar, unrar, unzip, and xz for decompressing files.
Version Control Systems: For library repository management, Composer integrates with systems like Git, Mercurial, Perforce, and Subversion.
I installed Composer using the following commands in SSH, and the installation completed without errors:
cd ~
curl -sS https://getcomposer.org/installer | php
mv composer.phar composer
chmod +x composer
After installation, I verified the version, and the following was displayed:
Composer version 2.6.5 2023-10-06 10:11:52
However, when I attempt to install or update Drupal modules using Composer (e.g., composer require drupal/views_bulk_operations), I encounter errors. Below is an example of the error output when trying to install the views_bulk_operations module for Drupal:
In Filesystem.php line 288:
Could not delete /home/username/public_html/drupal/sites/default/default.services.yml:
I suspect the problem might stem from insufficient file system permissions in the shared hosting environment. While Composer installed correctly, certain commands may lack the required permissions to modify or delete files within the Drupal installation directory.
Questions:
A list command should help
ls -la [path]
It will give you an output with lines similar to the below:
-rw-r--r--@ 1 username group 1105 6 Dec 21:10 filename.txt
The -rw-r--r--@
part tells you what permissions you have. https://chmod-calculator.com may be helpful to understand what the permissions mean.
The username and group parts tell you who owns the file.
If you have sudo privileges you should be able to do your delete and move commands by prefixing with sudo
sudo rm [path]/default.services.yml
Here's a good resource on using the sudo command https://www.baeldung.com/linux/sudo-command
Edit: I should remind you to be very careful when moving and deleting files you don't have privileges for. It's not immediately obvious to me from your question what the end result is you're aiming to achieve but I'm assuming you're aware of the consequences of moving/deleting the files in question