So the problem changed from what it was, i\'ll leave the original question below to prevent bad reviews on answers like I had after someone editing his question I answered :
try:
exec('`which mysql_config` --socket');
this should show you the configured socket.