Friday, September 25, 2015

Re: [google-cloud-sql-discuss] my php script is working fine in GAE but not on the server

I believe if you are using mysql_connect you need to prepend ':' to the socket. So you should use:

$conn = mysql_connect(':/cloudsql/<your-project-id>:<your-instance-name>',
 
'root', // username
 
''      // password
 
);
mysql_select_db
('<database-name'>);
As shown in our documentation.

On Fri, Sep 25, 2015 at 2:51 PM, help <surveyofca@gmail.com> wrote:
it is still showing the same error. 

error message :-  Could not get data: Unable to find the socket transport "unix" - did you forget to enable it when you configured PHP?
 
<?php
    echo 'Hello world!';

$conn = mysql_connect('/cloudsql/testingqweqwe:gh', 
  'root', // username
  ''      // password
  );
if ($conn)
{
echo "connection established";
}
$checkdb = mysql_select_db('test');
if ($conn)
{
echo "database connected";
}
$sql = "INSERT INTO test (name) VALUES (123)";
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
  die('Could not get data: ' . mysql_error());
}
echo "successfully done ";
?>

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/6f0efa62-5434-42db-b3cd-ba269d521a38%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/CAJZK_bb3cXYQ34sikTb5_zvB7LUaz%3DRy%3Dp-KP6LnPUe1Ucqszg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment