Categories
Fixing Stuff Laravel

installing node.js on windows 7 computer

Installing node.js on my windows 7 machine  was a bit of a struggle so I wrote down the notes:

 

1.) Install node.js from their site.  Just use the big green button, download the installer

2.) Run their auto installer and then open up git bash (note open it up in the project folder you are attempting to install bower in)

3.) If your using windows you will need to install node.js then set your environment variables (start > run > environment variables > path > edit ) then add this line to the end “;C:\Program Files\nodejs”

4.) Open up git bash and type “npm install” (if you get an error you will just need to manually create the “npm” folder in (C:\Users\your-user\AppData\Roaming ).  *replace your-user with your current user, and also its possible your file path will be different, if a different file path is echo’d out in the command prompt then use that file path.

5.) you should be able to type “npm” and load the node package manager, once that loads you can type “bower install” and load bower then you should be all set to use data tables (or whatever you loaded node.js into your project to do)

 

Categories
Fixing Stuff Laravel Samuel

Setting up Laravel 4 for the first time onWAMP server

This post is meant as a helpful guide for setting up laravel 4 on a windows machine with WAMP server installed.  The process is a little cumbersome so I wanted to jot down the steps.  Hopefully these notes on setting up laravel on local windows dev environment help someone out there on the interwebs… and I’m sure I will refer back to these on occasion.

–edit–

for a list of helpful php artisan commands please refer to the bottom of this page

–end edit–

1.) Enable openSSL in wamp server (allows us to install composer which is step #2)

  • From the wamp tray icon hit php > php extensions > php_openSSL (note we also need both php_curl & php_socket enabled for later steps)
  • restart wamp server
  • navigate to and open (C:\wamp\bin\php\php-5.4.3\php.ini).  Search for openssl and remove the comment in front of the line (then save the file)
  • now were ready to install composer

2.) Install Composer.  On windows you can install composer by downloading this setup file (https://getcomposer.org/Composer-Setup.exe)

  • if you did not enable openssl correctly you will get the following error (The openssl extension is missing, which will reduce the security and stability of Composer. If possible you should enable it or recompile php with –with-openssl).  If you get this error go back and re-visit ((C:\wamp\bin\php\php-5.4.3\php.ini).  openSSL needs to be enabled in this file for composer to install
  • now open up the command prompt and navigate to the directory you will store laravel in and install composer.  e.x.  CD C:\wamp\www\laravel) then type “composer install”.  The install will run and provide you feedback on if it was successful or not.

—-helpful note for newer version of wamp server—-
after installing a new version of wamp server you might have an issue using composer (you will have to re-install it and re-setup your environment varialbes to get it to work). Even after that though if your getting the following error when trying to run composer install then the steps below will help: /c/ProgramData/ComposerSetup/bin/composer: line 10: php: command not found

  • : Open git bash
  • go to your work directory like if you have wamp then c:/wamp/www.
  • type “composer” if you can see the composer command list then its installed correctly
  • type “composer self-update”.

Once the update runs you will be able to then navigate to your project directory and run “composer install”.

3.) Add PHP to windows environment variables

  • start > environment variables for your account > Path > edit (now chose the path variable under “user variables”)
  • add (C:\wamp\bin\php\php5.5.12) so full line will look like: (C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\wamp\bin\php\php5.5.12)

4.) Download Sqlite

5.) Download gitbash (http://git-scm.com/downloads).

  • this is not needed but it is a nicer user interface than the default windows command prompt
  • you can navigate to a file, right click > git bash, then command prompt opens up in this directory… no need to cd into the directory manually

6.) Run first local migrations

  • make a local database config file in (app\config\local\database.php)
  • change the default to sqlite (line 29 ‘default’ => ‘sqlite’,)
  • change the directory path to ../storage/database/ (line 51 ‘database’ => __DIR__.’/../../storage/database/production.sqlite’,)
  • open git bash in your laravel directory
  • run “php artisan migrate” (if having problems using local config run php artisan –env-local migrate)

7.) Run laravel on local environment

  • navigate to your laravel directory (either through windows command prompt, or by going to the file right clicking and hitting git bash)
  • type “php artisan serve”
  • go to http://localhost:8000

 

Hopefully these notes help someone out there in the interwebs.  Getting laravel up and running for the first time can feel like a somewhat daunting task, but the rewards of being able to work on a local environment are definitely worth it…. and a real plus to using sqlite is that you technically don’t even have to start wamp server now to test your local site. Once you have the local config files setup, you can open git bash, run php artisan serve and then artisan takes care of serving your actually website on localhost 8000…. which is pretty neat.

 

–random helpful notes & commands —

-runing migrations, open git bash in the laravel directory, and run: “php artisan migrate”

-to detect local and production environments edit bootstrap/start.php

$env = $app->detectEnvironment(array(
‘local’ => array(‘homestead’, ‘computer-name’),
‘production’ => array(‘server-name’),
));

 

//to detect what your server/computer name is locally put this in the top of the starts.php file and navigate to any page

echo gethostname();exit();

-to seed the db run “php artisan db:seed”

  • to do seeds and migrations locally run “php artisan –env-local migrate” and or  “php artisan –env-local db:seed”
  • if getting an error of “cant replicate database seeder” run “composer dump-autoload”