In this tutorial i will guide you through the installation of PHP and MySQL in windows , and additionally how to setup PHP framework laravel and Composer with git . php5.4 and later versions have inbuilt development server so in this tutorial i won’t be cover all the web server setup and all just simple php and mysql with composer and inbuilt development web-server . so lets get started .
- PHP ( Server Side Scripting Language )
- MySQL ( Database )
- Composer ( Dependency manager )
- Git ( Version Control System )
and extract the php file in ** C:\php ** or anywhere just remember the location , after extracting the php lets setup windows PATH variable , so we can access php from CMD ( command prompt ) . How to setup Environment Variable in windows : just simply follow the steps
- open My Computer and click on properties
- click on advance system settings
- Click on the Environment Variables From System Properties window
- Choose System variables and select PATH and click edit
- Add ” ; ” ( without quotes ) and add php location
- Click OK and OK again and Press_ Windows + R_ and type_ CMD_ and type php -vif you are getting that kind of output , Congrats now php is installed and accessible from CMD
MySQL comes with windows installer but i will show you how to install using zip package . Download and extract zip in C:\MySQL and setup environment variable exactly like how we did setup for PHP .
now secure the mysql initial user account see this guide : http://dev.mysql.com/doc/refman/5.5/en/default-privileges.html
MySQL Service in windows
if you want to start mysql when you log on then install mysql service and select automatic start ,
click on start >>all programs >> accessories > then right click and open Command prompt as admin
cd c:\mysql\bin C:\MySQL\bin>mysqld --install
and now open service manager and find MySQL service then click on properties set automatic start
now php and mysql is installed lets install composer . Download windows installer and install like another windows package . just choose correct php location when installing .
open CMD and type ” composer –version ” and make sure it print version otherwise troubleshoot your installation .
Now lets setup laravel , Laravel is php based MVC framework if you are confuse its like ASP MVC and Ruby On Rails framework just written in PHP . let’s install , open CMD and paste
composer create-project laravel/laravel TestProject
wait for time it will take some time to install all the dependencies , if you are getting openssl error then simply open php.ini file and fix extension dir path ( see the php folder that we extracted at the time of installation )
extension_dir = C:\php\ext
;extension=php_bz2.dll //to extension=php_bz2.dll
then try again , i am sure it gonna work . now wait until it finish setting up dependencies .after that lets start development server . open CMD cd to project root and laravel comes with a tool calle artisan lets fire up dev server using artisan
php artisan serve
then open browser and open http://localhost:8000 , and you will see default laravel page .
Some important links