AnsweredAssumed Answered

why doesn't work the 'include(config.php)'?

Question asked by David Solano Rojas on Mar 5, 2020
Latest reply on Mar 8, 2020 by Ashish Dwivedi

Hello everybody

 

I am sending data by ajax from a custom module to make inquiries with the data sent, so I include a connectionDB.php with this data:

 

include('config.php');
$db_host_name=$sugar_config[dbconfig][db_host_name];
$db_user_name=$sugar_config[dbconfig][db_user_name];
$db_password=$sugar_config[dbconfig][db_password];
$db_name=$sugar_config[dbconfig][db_name];

////////////////////////////////////////////
$sevidor="mysql:dbname=".$db_name.";host=".$db_host_name;
$usuario=$db_user_name;
$password=$db_password;
try{
$pdo= new PDO($sevidor, $usuario, $password, array(PDO::MYSQL_ATTR_INIT_COMMAND=>"SET NAMES utf8"));
//echo "connect..";
}catch(PDOException $e){
echo "Bad connection..".$e->getMessage();
}

 

But at the time of executing the ajax in the php log it shows me this:

 

PHP Warning:  include(modules/key_Surveys/metadata/connectionDB.php): failed to open stream: No such file or directory 

And this:

 

PHP Warning:  include(): Failed opening 'modules/key_Surveys/metadata/connectionDB.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear')

 

I hope you could help me, thank you very much.

 

Regards.

Outcomes