Kushank Jain

api not working on ondemand.

Discussion created by Kushank Jain on Apr 21, 2016

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

Error given on sugarondemand instance after hitting the file on browser

Added a file product.php in /custom directory to add products in database by integrating the 3rd party API.

Written the following code in /custom/product.php to connect with database

<?php

global $db;

global $sugar_flavor;

include 'config.php';


$usr = $sugar_config['dbconfig']['db_user_name'];

$pwd = $sugar_config['dbconfig']['db_password'];

$database = $sugar_config['dbconfig']['db_name'];

$host=$sugar_config['dbconfig']['db_host_name'];

mysql_connect("$host", "$usr", $pwd) or die(mysql_error());

mysql_select_db("$database") or die(mysql_error());


Can anybody help in this that if we add a php file in /custom directory and upload the file on sugarondemand and then hit the file on browser with the url sugarondemand.com_url/custom/product.php

it gives the erroor

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)




 

Outcomes