Fixing OpenSSL on WordPress Windows PHP 5.6+

Background: i ran into OpenSSL errors during the Disqus plugin setup. there’s tons of hits suggesting various solutions, below is the very simple solution that worked for me… Sample error messages: SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed<br /> Failed to enable crypto in ... TL;DR: download latest cacert.pem place it in a pertinent folder (e.g. $\wp-includes\certificates) edit your php.ini > openssl.cafile={full path to cacert.pem}

PHP SQL Server blob hosting

from here see this post for sql server driver downloads   downloadPDF.php <?php header('Content-type: application/pdf'); // leave this out to open directly in browser: header('Content-Disposition: attachment; filename="my.pdf"'); include("SQLConnect.php"); $sql = "select InvoiceDocument from SalesInvoicePDF where InvoiceID = '123'"; $stmt = sqlsrv_query($conn, $sql); if ( sqlsrv_fetch($stmt) ) { //this pulls the first field via "0" $data = sqlsrv_get_field($stmt, 0, SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY)); // write binary sql stream directly to http response fpassthru($data); } ?


get the DLL – grab latest add to your php.ini extension list: [ExtensionList] extension=php_pdo_sqlsrv_7_nts.dll here’s sample call code: <?php try { $conn = new PDO( "sqlsrv:Server= ip_address; Database = mydb ", $user, $pwd); $conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); } catch(Exception $e){ die(var_dump($e)); } $stmt = $conn->query($qry); $result = $stmt->fetchAll(); $row = $result[0]; $colval = $row[“fieldname”]; ?>

PHP7 Debugging under Visual Studio 2015

I suggest installing PHP7 through the IIS Web Platform Installer so it does the Handler Mapping vs having to mess with that manually (i.e. assigning PHP extension to php-cgi.exe) – but there’s a lot of guides out there for doing that yourself if you want. That’ll probably leave you with a slightly older version so then just go install latest PHP7 bits over the top – we want the non-thread-safe (NTS) builds when running under IIS FastCGI (supposedly the most performant approach)