sageone_api_php_sample icon indicating copy to clipboard operation
sageone_api_php_sample copied to clipboard

Fatal error: require(): Failed opening required '/var/php/vendor/autoload.php' (include_path='.:/opt/cpanel/ea-php72/root/usr/share/pear')

Open devnb opened this issue 5 years ago • 2 comments

I'm new to the API world so.. be gentle but I can't figure out what to do in this situation and when I commented this line //require '/var/php/vendor/autoload.php'; appeared:

  • Fatal error: Uncaught Error: Call to undefined function SageAccounting\yaml_parse_file() in...
  • SageAccounting\ClientConfiguration->load() #1...
  • SageAccounting\ApiClient->loadClientConfiguration() #2 ...
  • SageAccounting\ApiClient->__construct() #3...

devnb avatar Feb 18 '20 14:02 devnb

Hello @devnb ! Sorry that you have problems with this application.

The recomended way to use the API Sample Application is to run it via the docker environment. That guarantees you that all dependencies are available in the correct version. So could you try this please? Before some minutes I tryed it, and it works well.

If you have questions about the Sage Business Cloud Accounting API or want to report problems, then the accounting api section of sagecity.com is the perfect place.

If you have questions, just ask :)

NucsuM avatar Mar 17 '20 08:03 NucsuM

For anyone else with this issue do the following, this was done on a mac installing libyaml manually as homebrew kept failing.

  1. You need libyaml installed (download, phpize, make install from here https://pecl.php.net/package/yaml)

  2. Check this with phpinfo

  3. Remove this part from the composer.json: "config": { "vendor-dir": "/var/php/vendor" }

Run composer dump-autoload

  1. Update the lib/api_client.php vendor include to: require dirname(FILE) . '/../vendor/autoload.php';

This should then run locally with:

php -S localhost:8080

mattayers avatar Aug 18 '23 20:08 mattayers