Installing Laravel 5.0 in windows
1) Download composer and install
2) Follow the instructions:
a)Download and run Composer-Setup.exe, it will install the latest Composer version and set up your PATH so that you can just call composer from any directory in your command line.
b) openssl extension is required => To enable, just remove the ‘;’ as shown below
;extension=php_openssl.dll
c)Composer requires PHP 5.3.2+ to run. A few sensitive php settings and compile flags are also required, but when using the installer you will be warned about any incompatibilities.
d)If your php version below than PHP5.3.2, download the latest php version, eg. PHP5.4.40 (not latest but also working with composer)
e)Adding new php version in wamp server:
- Download php here: http://windows.php.net
- Extract and copy the new php folder into "C:wampinphp"
- Copy files php.ini,phpForApache.ini and wampserver.conf from your old php version folder to the new php version folder
- Open php.ini and phpForApache.ini and edit the extension path folder
extension_dir = "c:/wamp/bin/php/php5.4.40/ext/"
- Dont forget to enable extension=php_openssl.dll
- Restart wamp server and select the latest php version
f)Run Composer.exe, just follow the instructions. After finish, open Command promt and run this command :
composer global require "laravel/installer=~1.1".
Wait until it finish install. Installing using composer will automatically generate the key. This key will be used to set the application key when you create a new application later
g) Go to you Laravel root directory, enter this commmand:
cd Documents and SettingsAdministratorApplication DataComposervendorin
h) Create a new application, enter this command : laravel new blog
i) The blog folder will be generated and saved inside the laravel root folder "C:Documents and SettingAdministratorApplication DataComposervendorin". You can copy or move the blog folder to "C:wampwww", in browser you can access : "http://localhost/blog/public/"
j) For the App configuration, refer to the laravel documentation here: http://laravel.com/docs/5.0/configuration
Running PHP’s Built-in Web Server(Without external server eg, Wampp, Xampp):
Add that domain into your "hosts" file, or use a port on localhost.
1. Add to "hosts" file
On most linux distributions it’s here: /etc/hosts and on mac: /private/etc/hosts.
You should add a new line following the format of the other lines in the file. Assign the IP of
localhost (127.0.0.1) to that domain like so:
127.0.0.1 blog.dev
Apache httpd.conf
DocumentRoot C:/wamp/www/blog/public/
ServerName blog.dev
Now you will be able to open ports on localhost, using blog.dev:
php artisan serve—host blog.dev—port 8080
...and now you can access your app, in your browser via: http://blog.dev:8080.
2. Use localhost
Alternatively just assign a port on locahost:
php artisan serve—host localhost—port 5000
and access in your browser via: http://localhost:5000
Deploy Laravel on production:
First make sure that your shared host runs php >= v5.4. Second try to follow this steps:
Create a folder outside your public_html/ or www/. Ex: project/
Copy every folder and file (except the public folder) from your laravel app into that
project/ folder
Copy the content of public/ folder into your public_html/ or www/ (the .htaccess must be
there too)
Inside public/ locate the index.php file and change the following paths:
a. Path to autoload.php
require __DIR__.’/../bootstrap/autoload.php’;
into
require __DIR__.’/../project/bootstrap/autoload.php’;
b. Path to start.php
$app = require_once __DIR__.’/../bootstrap/start.php’;
into
$app = require_once __DIR__.’/../project/bootstrap/start.php’;`
Error: ‘404’ page not found
Solution: Need to enable apache rewrite_module
Error: SQLSTATE[HY000] [1045] Access denied for user ‘homestead’@‘localhost’ (using password:
YES)
solution:
edit .env file :
DB_HOST=localhost
DB_DATABASE=blog_db
DB_USERNAME=root
DB_PASSWORD=admin
database.php :
‘mysql’ => [
‘driver’ => ‘mysql’,
‘host’ => env(‘DB_HOST’, ‘localhost’),
‘database’ => env(‘DB_DATABASE’, ‘blog_db’),
‘username’ => env(‘DB_USERNAME’, ‘admin’),
‘password’ => env(‘DB_PASSWORD’, ‘admin’),
‘charset’ => ‘utf8’,
‘collation’ => ‘utf8_unicode_ci’,
‘prefix’ => ‘’,
‘strict’ => false,
],
create database ‘blog_db’ in phpmyadmin then perform the migrate/seed.
Seed used to create a table based on the file inside the migrations folder
run this command:
php artisan migrate:refresh—seed
or
php artisan migrate:install
php artisan migrate