GEWIS Website Workshop – The first one – Installation



GEWIS Website Workshop – The first one – Installation

0 0


webworkshop

First web workshop

On Github kokx / webworkshop

GEWIS Website Workshop

The first one

You can find this presentation online

http://gewis.nl/~kokx/web/workshop/

Some remarks on beforehand

This is all based on Windows. So if you run Mac (yes, I'm talking about you, Jim), don't try to install the same things.

Fortunately, most of these things are much easier to install on Mac.

You might want to take a look at: http://akrabat.com/computing/setting-up-php-mysql-on-os-x-mavericks/

Voor Jim: Heb wel naar Mac gekeken, maar daar zal ik je zelf mee helpen. De link staat iig in de slides. Je zou de stappen over 'PEAR', 'Compiling extensions' en 'PECL OAuth' kunnen skippen.

Installation

Already installed?

Apache, PHP, MySQL

Install XAMPP

  • Install from http://apachefriends.org
  • Just agree with everything.
  • Default settings are quite OK.
  • You can leave out 'BitNami'. We don't need it.

Configure xdebug

Stop apache, if it is running Open C:\xampp\php\php.ini Go to the bottom of the file Uncomment zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
[XDebug]
zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
;xdebug.profiler_append = 0
;xdebug.profiler_enable = 1
;xdebug.profiler_enable_trigger = 0
;xdebug.profiler_output_dir = "C:\xampp\tmp"
;xdebug.profiler_output_name = "cachegrind.out.%t-%s"
;xdebug.remote_enable = 0
;xdebug.remote_handler = "dbgp"
;xdebug.remote_host = "127.0.0.1"
;xdebug.trace_output_dir = "C:\xampp\tmp"
XDebug hebben we niet perse nodig. Maar het helpt heel erg met debuggen. Jim, jij hoeft dit niet perse te doen. Het is ook iets ingewikkelder om te installeren op Mac.

Start it up

Start Apache and MySQL. The other services are not needed.

If get a Windows Firewall alert, just allow everything.

If you use Skype, it might block port 80.If so, go to Options -> Advanced -> Connection and uncheck "Use port 80 and 443...."

Test Apache

http://localhost/

Test PHP

Create a file with the following contents and save it as C:\xampp\htdocs\test.php

<?php
phpinfo();

Test PHP

Go to http://localhost/test.php

You should see something like:

Test PHPMyAdmin + MySQL

http://localhost/phpmyadmin/.

Add PHP to PATH

Start, right click on 'Computer' -> Properties Column on the left, 'Advanced System Settings' In tab 'Advanced', click the button 'Environment Variables...' Under 'System Variables', find 'Path' Add ;C:\xampp\mysql\bin;C:\xampp\php; to the end.

This is where Mac users should do something else for a while.

On Windows 8: Control panel -> System. Then continue with step 2 (Advanced System Settings)

Add PHP to PATH

Add PHP to PATH

Because we changed the PATH, we need to reboot windows.

Everything working?

Git and GitHub

Install git

We will simply install GitHub for Windows, because that does everything we need.

windows.github.com

This will take a while...

So, in the meanwhile, it is a good idea to create an account at github.com.

Start it up

Open the 'GitHub' program. And login with the account you just created.

Hardcore forking action!

Find the repo GEWIS/gewisweb, and fork it on your GitHub account.

I think I'm a clone now

Open the GitHub program, find the repository, right mouse click and clone it to C:\xampp\htdocs

Test it!

Go to localhost/gewisweb/public/.

Error?

Error?

Just do what it says!

Open the GitHub application Right click on gewisweb repository -> open a shell here Type php composer.phar install

Result!

We're not done yet!

The frontpage is working. But we still have some things to configure.

Database

Open phpmyadmin Create a new database, you should name it something like gewisweb_dev

Database - config

In the gewisweb config autoload directory (C:\xampp\htdocs\gewisweb\config\autoload), copy doctrine.local.php.dist to doctrine.local.php and open it.

Database - config

Fill in the username, password and database name

This should be root, no password and gewisweb_dev

<?php
return array(
    'doctrine' => array(
        'connection' => array(
            'orm_default' => array(
                'driverClass' =>'Doctrine\DBAL\Driver\PDOMySql\Driver',
                'params' => array(
                    'host'     => 'localhost',
                    'port'     => '3306',
                    'user'     => 'root',
                    'password' => '',
                    'dbname'   => 'gewisweb_dev',
                )
            )
        )
    )
);

Database - initialization

Open a shell (in GitHub application, right click -> open a shell here) Execute ./vendor/bin/doctrine-module orm:schema-tool:create

Test it!

Go to localhost/gewisweb/public/user and try to login with any number and password (longer than 8 chars). It should give:

Tell me when there are any errors!

Developer toolbar - config

In the gewisweb config autoload directory (C:\xampp\htdocs\gewisweb\config\autoload), copy zdt.local.php.dist to zdt.local.php.

Developer toolbar - result

git 101

Has anyone used Subversion or other version control?

If svn, tell them to forget everything they know about it. Or get brain surgery

Tutorial!

try.github.io

It only takes 15 minutes!

We gaan nu die simpele tutorial doen. Dit kost niet veel tijd, en leert je de basics van git.

The End

Any questions?