Search code examples
phpcrondatabase-connectionmampfrapi

(Frapi API) How to get Frapi_Database::getInstance() without class or function(Outside MAMP and FRAPI Environment)?


I am setting up cron job in mac using crontab command.

I am using MAMP PRO as a local server environment for FRAPI API.

But I can not get Frapi_Database::getInstance() without using class or function in my simple PHP Script...

Actually function for getting database instance is as below :

 public function __construct()
 {
     $this->dbLink = Frapi_Database::getInstance();
 }

But I want to get database instance without using this method from Library,not from Action. How can I do this?


Solution

  • I also had same problem.Include this file into your Cron file:

    /src/frapi/library/Frapi/AllFiles.php from Frapi API.

    It has All necessary file like Libraries,database,adaptor files,etc.

    Also If you getwarning like "PHP Notice: Undefined index HTTP_HOST" in internal.php file then replace

    $_SERVER with getenv

    You will get rid out of this.