Thursday, March 17, 2016

Installing symfony on windows, PHP Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

I am trying out the symfony framework and a novice with Php language. When doing a symfony installation, i got the mentioned error of SSL operation failing as shown below
  SSL failure
Am using windows 7, XAMPP handling the web server and database server. A search on the web gives lots of solutions related to SSL operation failed but not so much related to solve it for symfony installation in simple terms.
Found a link here which i followed to solve my problem at hand. It is not the best but at-least lets you passed that error.

  1. First add php path to the windows enviroment variables (my case "D:\xampp\php")
  2. Create a install.php file in your web server www folder and insert the code below
    <?php
    $arrContextOptions=array(
    "ssl"=>array(
    "verify_peer"=>false,
    "verify_peer_name"=>false,
    ),
    );
    $response = file_put_contents('symfony', file_get_contents('https://symfony.com/installer', false, stream_context_create($arrContextOptions)));
    echo $response;
    ?>
    It should look like below in ur favorite editor
     
    Browse the install.php file url in your browse and expect to get a response similar to the one below

    Expect to find a new file "symfony" in your www folder.  
  3. Open up the command prompt (CMD) as administrator, navigate to the webserver publish folder or www folder, as the symfony installation instructions say, run the command "php symfony" to check if installer is usable.
  4. Now ready to create your first symfony project, type "php symfony new my_proj" in your command prompt and wait for the installer to pull all files down to your disk.
Enjoy !