mysqli sll connection fails with “Got an error reading communication packets”How to use mysqli connection with SSLMySQL Error 1153 - Got a packet bigger than 'max_allowed_packet' bytesLocking in PHP to acheive a crtitical section - unexpected results with MySQLRe-sizing a webpagePhp echo a row values by unique code and emailHow can I pull Data from an SQL table using PHP inside an HTMLSSL self-signed certifications to connect with Mysql with PHPCan't count records in PHP result set hitting a SQL database?mysql is not connected in my local serverdata not retrieving from online mysql serverUnable to connect my sql server from PHP

Giving blur shadow to plot

Is it ethical to tell my teaching assistant that I like him?

How did pilots avoid thunderstorms and related weather before “reliable” airborne weather radar was introduced on airliners?

Can't understand how static works exactly

High income and difficulty during interviews

Can someone explain the English 'W' sound?

Short story where a flexible reality hardens to an unchanging one

How can I deal with someone that wants to kill something that isn't supposed to be killed?

RC differentiator giving a higher output amplitude than input amplitude

What rules turn any attack that hits a given target into a critical hit?

What does a black-and-white Puerto Rican flag signify?

Are there any English words pronounced with sounds/syllables that aren't part of the spelling?

Is it OK to accept a job opportunity while planning on not taking it?

Why do people say "I am broke" instead of "I am broken"?

My current job follows "worst practices". How can I talk about my experience in an interview without giving off red flags?

What kind of vegetable has pink and white concentric rings?

What kind of anatomy does a centaur have?

Does Impedance Matching Imply any Practical RF Transmitter Must Waste >=50% of Energy?

Can I make an Opportunity Attack during Time Stop?

How does mathematics work?

Why can't a country print its own money to spend it only abroad?

How can I indicate that what I'm saying is not sarcastic online?

"It is what it is" in French

How often should alkaline batteries be checked when they are in a device?



mysqli sll connection fails with “Got an error reading communication packets”


How to use mysqli connection with SSLMySQL Error 1153 - Got a packet bigger than 'max_allowed_packet' bytesLocking in PHP to acheive a crtitical section - unexpected results with MySQLRe-sizing a webpagePhp echo a row values by unique code and emailHow can I pull Data from an SQL table using PHP inside an HTMLSSL self-signed certifications to connect with Mysql with PHPCan't count records in PHP result set hitting a SQL database?mysql is not connected in my local serverdata not retrieving from online mysql serverUnable to connect my sql server from PHP






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















When trying to connect to a mysql database in php-7.2 using ssl, it results in the error Got an error reading communication packets



SSL was setup on the server using the command:



sudo mysql_ssl_rsa_setup --uid=mysql


So far I have tried the following approaches:



<?php
$conn=mysqli_init();
if (!$conn)
die("mysqli_init failed");


$conn->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, true);
mysqli_ssl_set($conn,NULL,NULL,"scripts/ssl/ca.pem",NULL,NULL);

if (!mysqli_real_connect($conn,"<ip-address>","<user>","<passsword>","<database>"))
die("Connect Error: " . mysqli_connect_error());


$sql = "SELECT * FROM accounts";
$result = $conn->query($sql);

if ($result->num_rows > 0)
// output data of each row
while($row = $result->fetch_assoc())
echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";

else
echo "0 results";


mysqli_close($conn);
?>


and...



<?php
$conn=mysqli_init();
if (!$conn)
die("mysqli_init failed");


mysqli_ssl_set($conn,"scripts/ssl/client-key.pem","scripts/ssl/client-cert.pem","scripts/ssl/ca.pem",NULL,NULL);

if (!mysqli_real_connect($conn,"<ip-address>","<user>","<passsword>","<database>"))
die("Connect Error: " . mysqli_connect_error());


$sql = "SELECT * FROM accounts";
$result = $conn->query($sql);

if ($result->num_rows > 0)
// output data of each row
while($row = $result->fetch_assoc())
echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";

else
echo "0 results";


mysqli_close($conn);
?>


I temporally added:



$homepage = file_get_contents("scripts/ssl/client-key.pem");
echo $homepage;


to the code which printed the cert to the screen, so I know that the file paths are correct.



The SSL files were all pulled straight from the server running mysql so there should be no issues there either.



mysqli_connect_error() returns nothing. The only error is Got an error reading communication packets from /var/log/mysql/error.log



I found the methods above from this stack overflow question.



The linked post references this documentation, which is only slightly more useful than the official docs. Documentation on SSL with mysqli seems rather lacking.



Any suggestions on what I am doing wrong










share|improve this question




























    0















    When trying to connect to a mysql database in php-7.2 using ssl, it results in the error Got an error reading communication packets



    SSL was setup on the server using the command:



    sudo mysql_ssl_rsa_setup --uid=mysql


    So far I have tried the following approaches:



    <?php
    $conn=mysqli_init();
    if (!$conn)
    die("mysqli_init failed");


    $conn->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, true);
    mysqli_ssl_set($conn,NULL,NULL,"scripts/ssl/ca.pem",NULL,NULL);

    if (!mysqli_real_connect($conn,"<ip-address>","<user>","<passsword>","<database>"))
    die("Connect Error: " . mysqli_connect_error());


    $sql = "SELECT * FROM accounts";
    $result = $conn->query($sql);

    if ($result->num_rows > 0)
    // output data of each row
    while($row = $result->fetch_assoc())
    echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";

    else
    echo "0 results";


    mysqli_close($conn);
    ?>


    and...



    <?php
    $conn=mysqli_init();
    if (!$conn)
    die("mysqli_init failed");


    mysqli_ssl_set($conn,"scripts/ssl/client-key.pem","scripts/ssl/client-cert.pem","scripts/ssl/ca.pem",NULL,NULL);

    if (!mysqli_real_connect($conn,"<ip-address>","<user>","<passsword>","<database>"))
    die("Connect Error: " . mysqli_connect_error());


    $sql = "SELECT * FROM accounts";
    $result = $conn->query($sql);

    if ($result->num_rows > 0)
    // output data of each row
    while($row = $result->fetch_assoc())
    echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";

    else
    echo "0 results";


    mysqli_close($conn);
    ?>


    I temporally added:



    $homepage = file_get_contents("scripts/ssl/client-key.pem");
    echo $homepage;


    to the code which printed the cert to the screen, so I know that the file paths are correct.



    The SSL files were all pulled straight from the server running mysql so there should be no issues there either.



    mysqli_connect_error() returns nothing. The only error is Got an error reading communication packets from /var/log/mysql/error.log



    I found the methods above from this stack overflow question.



    The linked post references this documentation, which is only slightly more useful than the official docs. Documentation on SSL with mysqli seems rather lacking.



    Any suggestions on what I am doing wrong










    share|improve this question
























      0












      0








      0








      When trying to connect to a mysql database in php-7.2 using ssl, it results in the error Got an error reading communication packets



      SSL was setup on the server using the command:



      sudo mysql_ssl_rsa_setup --uid=mysql


      So far I have tried the following approaches:



      <?php
      $conn=mysqli_init();
      if (!$conn)
      die("mysqli_init failed");


      $conn->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, true);
      mysqli_ssl_set($conn,NULL,NULL,"scripts/ssl/ca.pem",NULL,NULL);

      if (!mysqli_real_connect($conn,"<ip-address>","<user>","<passsword>","<database>"))
      die("Connect Error: " . mysqli_connect_error());


      $sql = "SELECT * FROM accounts";
      $result = $conn->query($sql);

      if ($result->num_rows > 0)
      // output data of each row
      while($row = $result->fetch_assoc())
      echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";

      else
      echo "0 results";


      mysqli_close($conn);
      ?>


      and...



      <?php
      $conn=mysqli_init();
      if (!$conn)
      die("mysqli_init failed");


      mysqli_ssl_set($conn,"scripts/ssl/client-key.pem","scripts/ssl/client-cert.pem","scripts/ssl/ca.pem",NULL,NULL);

      if (!mysqli_real_connect($conn,"<ip-address>","<user>","<passsword>","<database>"))
      die("Connect Error: " . mysqli_connect_error());


      $sql = "SELECT * FROM accounts";
      $result = $conn->query($sql);

      if ($result->num_rows > 0)
      // output data of each row
      while($row = $result->fetch_assoc())
      echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";

      else
      echo "0 results";


      mysqli_close($conn);
      ?>


      I temporally added:



      $homepage = file_get_contents("scripts/ssl/client-key.pem");
      echo $homepage;


      to the code which printed the cert to the screen, so I know that the file paths are correct.



      The SSL files were all pulled straight from the server running mysql so there should be no issues there either.



      mysqli_connect_error() returns nothing. The only error is Got an error reading communication packets from /var/log/mysql/error.log



      I found the methods above from this stack overflow question.



      The linked post references this documentation, which is only slightly more useful than the official docs. Documentation on SSL with mysqli seems rather lacking.



      Any suggestions on what I am doing wrong










      share|improve this question














      When trying to connect to a mysql database in php-7.2 using ssl, it results in the error Got an error reading communication packets



      SSL was setup on the server using the command:



      sudo mysql_ssl_rsa_setup --uid=mysql


      So far I have tried the following approaches:



      <?php
      $conn=mysqli_init();
      if (!$conn)
      die("mysqli_init failed");


      $conn->options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, true);
      mysqli_ssl_set($conn,NULL,NULL,"scripts/ssl/ca.pem",NULL,NULL);

      if (!mysqli_real_connect($conn,"<ip-address>","<user>","<passsword>","<database>"))
      die("Connect Error: " . mysqli_connect_error());


      $sql = "SELECT * FROM accounts";
      $result = $conn->query($sql);

      if ($result->num_rows > 0)
      // output data of each row
      while($row = $result->fetch_assoc())
      echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";

      else
      echo "0 results";


      mysqli_close($conn);
      ?>


      and...



      <?php
      $conn=mysqli_init();
      if (!$conn)
      die("mysqli_init failed");


      mysqli_ssl_set($conn,"scripts/ssl/client-key.pem","scripts/ssl/client-cert.pem","scripts/ssl/ca.pem",NULL,NULL);

      if (!mysqli_real_connect($conn,"<ip-address>","<user>","<passsword>","<database>"))
      die("Connect Error: " . mysqli_connect_error());


      $sql = "SELECT * FROM accounts";
      $result = $conn->query($sql);

      if ($result->num_rows > 0)
      // output data of each row
      while($row = $result->fetch_assoc())
      echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";

      else
      echo "0 results";


      mysqli_close($conn);
      ?>


      I temporally added:



      $homepage = file_get_contents("scripts/ssl/client-key.pem");
      echo $homepage;


      to the code which printed the cert to the screen, so I know that the file paths are correct.



      The SSL files were all pulled straight from the server running mysql so there should be no issues there either.



      mysqli_connect_error() returns nothing. The only error is Got an error reading communication packets from /var/log/mysql/error.log



      I found the methods above from this stack overflow question.



      The linked post references this documentation, which is only slightly more useful than the official docs. Documentation on SSL with mysqli seems rather lacking.



      Any suggestions on what I am doing wrong







      php mysql ssl mysqli






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 26 at 14:22









      cheesemarathoncheesemarathon

      256 bronze badges




      256 bronze badges






















          0






          active

          oldest

          votes










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55359467%2fmysqli-sll-connection-fails-with-got-an-error-reading-communication-packets%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes




          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55359467%2fmysqli-sll-connection-fails-with-got-an-error-reading-communication-packets%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현