Sunday, July 31, 2016

Installing Symfony on Windows XAMPP setup

I tried installing Symfony on windows platform(win 7 64-bit) and  got some issues which by trying for few  hours I was able to install it successfully.

I was working on XAMPP  bundle for windows. Lets start now installing Symfony. There are 2 different ways as mentioned on Symfony website, the first one is by using installer and the second one is by using composer.

In this tutorial I am gonna use the installer to create a Symfony project.



The first and foremost thing is to set the PATH variables of your system so that you can use php as command in cmd. For that you need add this path in the end C:\xampp\php; (please note that my xampp was installed on C: drive this may differ as per your installation path)




The Next step is to Open CMD and execute the following command.
c:\Users\Ayaz>php -r "readfile('https://symfony.com/installer');" > symfony

This will create a symfony named file in present working directory.

The next step is
c:\Users\Ayaz>php symfony new my_first_project

If  everything goes fine this will create a directory with your project name with the complete packages.

May be you can get issue

 [GuzzleHttp\Exception\RequestException]
 cURL error 60: SSL certificate problem: unable to get local issuer certificate




To fix this issue  I invested 2-3 hours and just because  of this I thought of writing this blog.

The easiest way I found is to just visit this link https://curl.haxx.se/ca/cacert.pem  and copy the whole content and save it as curl-ca-bundle.crt . 
Now you need to include this file path in your php.ini file. 
You can find the php.ini file in c:\xampp\php\. Open this file in any file editor and search for curl.cainfo, remove the semicolon before it(if present) and then set the curl.cainfo="your\path\to\curl-ca-bundle.crt"

Now again try the following command and I hope  this time the installation process must be started. Cheers you are ready to explore symfony. Just deploy your application by running the following command. 

C:\Users\Ayaz\my_first_project>php app/console server:run -v

Hit the URL in browser and you would have got something like this

If you have get any issue or doubt in installation step just comment  below I will try my  best to check into your  issue.

1 comment:

  1. this has nothing to do with xamp, you can deploy anywhere. It's not using xamp's apache.

    ReplyDelete