Remitur Posted April 2, 2016 Share Posted April 2, 2016 Hello. I'm writing a gateway module (mygateway.php), which need another stand-alone php file (mygateway2.php) Both are in whmcs/modules/gateways/ mygateway2.php need to interact with db, so (according to http://docs.whmcs.com/Interacting_With_The_Database ) it begin with use Illuminate\Database\Capsule\Manager as Capsule; The problem is I get always an error of this kind: PHP Fatal error: Class 'Illuminate\Database\Capsule\Manager' not found in /home/a856314wib/public_html/mydomain.ext/whmcs/modules/gateways/mygateway1.php on line 52 I tried with different paths, but or I did'nt guess the right one, or I lost some "include" which is necessary... :-( 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted April 2, 2016 Share Posted April 2, 2016 does mygateway2.php file include "init.php"? I mean if mygateway2.php file not called by WHMCS directly, then you need to add this line at the beggining of this file: require_once("init.php"); 0 Quote Link to comment Share on other sites More sharing options...
Remitur Posted April 2, 2016 Author Share Posted April 2, 2016 Solved! It was both a problem of include, and of relative path. It was necessary to insert: require_once __DIR__ . '/../../init.php'; require_once __DIR__ . '/../../includes/gatewayfunctions.php'; require_once __DIR__ . '/../../includes/invoicefunctions.php'; (the third one probably is useless, I have not checked it yet) Thannk you for suggestion. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 2, 2016 Share Posted April 2, 2016 i'm not sure if it's mentioned in the documentation, but you might also want to take a look at the sample code at the WHMCS GitHub site. https://github.com/WHMCS/sample-gateway-module 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.