AnsweredAssumed Answered

execute custom php

Question asked by Luca Bartolini on Aug 1, 2017
Latest reply on Aug 9, 2017 by Enrico Simonetti

I created my custom php script into folder ./utils/RecuperaPregressoEsigenze.php

I try to execute it from putty but I get a fatal error 

 

From Shell Linux

php RecuperaPregressoEsigenze.php


PHP Warning: require_once(include/SugarQuery/SugarQueryException.php): failed to open stream: No such file or directory in /SUGAR-CRM-NAS/sugarcrm-esercizio/include/SugarQuery/SugarQuery.php on line 13
PHP Fatal error: require_once(): Failed opening required 'include/SugarQuery/SugarQueryException.php' (include_path='.:/usr/share/pear:/usr/share/php') in /SUGAR-CRM-NAS/sugarcrm-esercizio/include/SugarQuery/SugarQuery.php on line 13

 

<?php

require_once('/SUGAR-CRM-NAS/sugarcrm-esercizio/include/SugarQuery/SugarQuery.php');

 

class MyCustomClass {

   __construct(){}

   ........

 

}

 

$jobPregressoEsigenze = new MyCustomClass();
$jobPregressoEsigenze->swap_cases_from_lead_to_account();

 

?>

 

I guess the problem is a relative path inside the sugar libraries and my absolute path, but i don't know how to handle it.

I have to execute it just once from crontab.

 

Any advise?

 

Thank you,

Luca

 

PHP 5.6.30 

SugarCrm 7.8.2.1

Outcomes