We have the Orinoco river project and we have Vagrant so why not install a version of Orinoco (previous installs Xampp, CentOS, Pagodabox) on Vagrant / Windows10.

In the vagrantfile add the line

config.vm.synced_folder "zf2", "/var/www/zf2.localhost"

and add the folder “zf2” in the C:\vm\test folder.

In virtualBox run Ubuntu virtual machine set up earlier.

Connect to the Vagrant box via SSH.

cd /var/www

mkdir zf2.localhost

cd zf2.localhost

Connecting to github requires a SSH key pair:

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

Public key saved as

/home/vagrant/.ssh/id_rsa.pub

submit to github account settings

Next clone repo in current directory (mind the dot)

git clone git@github.com:hrvanderlingen/orinoco-river-zf2-project.git .

Next self-update composer

composer self-update

Problems!

rename(/home/vagrant/.composer/cache/composer-temp.phar,/usr/local/bin/composer): Permission denied

user vagrant should belong to the same group as root

check with

vi /etc/passwd

should contain the line

vagrant:x:1000:1000::/home/vagrant:/bin/bash

Also check

sudo visudo -f /etc/sudoers.d/vagrant

# CLOUD_IMG: This file was created/modified by the Cloud Image build process
vagrant ALL=(ALL) NOPASSWD:ALL

sudo su root

and save the day

usermod -a -G root vagrant

we rock:

vagrant@vagrant-ubuntu-trusty-64:/var/www/zf2.localhost# composer self-update
Updating to version 1.2.2 (stable channel).
Downloading: 100%
Use composer self-update --rollback to return to version 1.2.1

Next up

composer update

returns

composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- fabpot/goutte v1.0.7 requires ext-curl * -> the requested PHP extension curl is missing from your system.

Evidently curl is missing

solution:

sudo apt-get install php5-curl

next try

composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing diniska/chemistry (1.0)
Downloading: 100%
The following exception is caused by a lack of memory or swap, or not having swap configured

Nooooo!!

In the VirtualBox console the system memory is set at 1012 MB but this clearly is not enough.

return to cmd.exe and shut down vagrant with vagrant halt or halt via Virtualbox

then increase memory to 3012 MB

repeat

sudo composer update

success !!

Nothing yet in the browser? (enable error reporting)

Fatal error: Uncaught exception 'Zend\Loader\Exception\InvalidArgumentException' with message 'Map file provided does not exist. Map file: "/var/www/zf2.localhost/module/Application/autoload_classmap.php"'

The add the class maps

./vendor/bin/classmap_generator.php -w –library vendor/zendframework/zendframework/library/Zend –output vendor/zend_autoload_classmap.php
./vendor/bin/classmap_generator.php -w –library module/Application –output module/Application/autoload_classmap.php
./vendor/bin/templatemap_generator.php -w –view module/Application/view –output module/Application/template_map.php

and the cache folder

mkdir data
mkdir data/cache
chmod 777 data/cache

Arrange database access

sudo su root

service mysql stop
mysqld_safe --skip-grant-tables &
mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD("hi") where User='root';
mysql> flush privileges;
mysql> quit

set new password in local.config

Upload the database scheme

mysql -u root -p zf2project < schema.sql

create symlinks:

ln -s ../vendor/components components
ln: failed to create symbolic link components: Protocol error

This problem is solved by running VirtualBox as an administrator

Almost there but the .htaccess file is being ignored, first enable rewrite rules

sudo a2enmod rewrite

and restart apache

sudo service apache2 restart

Then allow .htaccess files by making a change in /etc/apache2/apache2.conf

Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted

sudo service apache2 restart

And there it is: a running Orinoco Zend Framework installation in a Vagrant environment.

Advertisements