• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue PHP Composer issue trying to install GoCardless library

Simon1

New Pleskian
Server operating system version
CentOS Linux 7.9.2009 (Core)
Plesk version and microupdate number
Plesk Obsidian v18.0.55_build1800230919.07 os_CentOS 7
Hello,

I'm trying to install the GoCardless library into a site in my Plesk server.

The instructions say to try this from the command line having cd'd to the root directory of the site in question:

composer require gocardless/gocardless-pro​

However that gets me this:

/usr/bin/env: php: No such file or directory​

So next up I tried uploading the composer.json that's listed in github, using the Plesk Composer GUI.

For completeness, that looks like this:

{​
"name": "gocardless/gocardless-pro",​
"description": "GoCardless Pro PHP Client Library",​
"version": "5.3.0",​
"keywords": [​
"gocardless",​
"direct debit",​
"api"​
],​
"license": "MIT",​
"authors": [​
{​
"name": "GoCardless and contributors",​
}​
],​
"require": {​
"php": ">=8.1",​
"ext-curl": "*",​
"ext-json": "*",​
"ext-mbstring": "*",​
"guzzlehttp/guzzle": "^7.4"​
},​
"require-dev": {​
"phpunit/phpunit": "^9.5",​
"squizlabs/php_codesniffer": "^3.6",​
"php-coveralls/php-coveralls": "^2.4"​
},​
"autoload": {​
"psr-4": {​
"GoCardlessPro\\" : "lib/"​
}​
},​
"autoload-dev": {​
"psr-4": {​
"GoCardlessPro\\": "tests/"​
}​
}​
}​

After that 'something' happened in that the vendor directory on my site changed. However when I try the test script

require 'vendor/autoload.php​
$client = new \GoCardlessPro\Client(​
...​
I get this error:

AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Class "GoCardlessPro\\Client" not found in /var/www/vhosts/0maths.com/httpdocs/test.php:9\nStack trace:\n#0 {main}\n thrown in /var/www/vhosts/0maths.com/httpdocs/test.php on line 9'​

So that's not a success either. Am I using the Plesk composer uploader right? Am I supposed to be doing something other than uploading the composer.json file?

I'm arguably the wrong man for the job as I'm new to Plesk, new to GoCardless and new to PHP Composer. Yet here we are.

I'd certainly appreciate any help.
 
The problem appears to be that neither php nor composer.phar are where expected.

What sort of worked (but not entirely) is

/opt/plesk/php/8.1/bin/php /usr/lib64/plesk-9.0/composer.phar require gocardless/gocardless-pro

I'm now getting the error

Root package 'gocardless/gocardless-pro' cannot require itself in its composer.json

I guess a different error is progress...
 
Back
Top