dofda3 box: Linux Development Environment for PHP Developers

Submitted by mshannaq on Sun, 02/24/2019 - 10:08

dofda3 (in Arabic ضفدع) is A vagrant box Ready to use as A Linux Development Environment for PHP Developers Includes Ubuntu 18.04.1, Apache 2.4.29 MySQL 5.7.25, Multi PHP Versions (PHP 5.6, PHP 7.0, PHP 7.1, PHP 7.2), phpMyAdmin 4.8.5, MailHog

To use dofda3 you must have Virtual Box and Vagrant Installed into your machine.

dofda3

 

You can download from Vagrant Cloud:
https://app.vagrantup.com/mshannaq/boxes/dofda3

dofda3 box initial release 0.0.1

version 0.0.1 :
https://app.vagrantup.com/mshannaq/boxes/dofda3/versions/0.0.1

This release is ready to use as A Development Environment for PHP Developers Includes Ubuntu 18.04.1, Apache 2.4.29 MySQL 5.7.25, Multi PHP Versions (PHP 5.6, PHP 7.0, PHP 7.1, PHP 7.2), phpMyAdmin 4.8.5, MailHog

USE THE BOX FOR INTERNAL USE ONLY!, It is not secure to use in public !!

Never use this box for production use , and never run it public online on the internet (Until you change the root password and the mysql password and secure the box)

You must forward ports 80 , 8025 to use the dofda3 box features.
You are advised to disable auto update check in Vagrantfile because this is a beta release and next releases may conatins big changes

You can find A sample of Vagrantfile that I have used on the following link https://ms.per.jo/downloads/dofda3box/Vagrantfile

after you initialize the box using vagrant init and vagrant upyou can login into the ssh server by vagrant ssh or by using root username from any other ssh client (for example Putty or Cmder)

WARNING! If ou face this error when running vagrant up "RawFile#0 failed to create the raw output file C:/Users/mshan/vagrants/dofda3/ubuntu-bionic-18.04-cloudimg-console.log (VERR_PATH_NOT_FOUND)." Then open VirtualBox and goto box settings > Serial Ports and then make sure that Path/Address is pointed to a file that exists in your computer (you can create empty file and enter its name in this filed)
If machine freez when going up in "default: SSH auth method: private key" double check from virtualbox that serial port is enabled and pointed to already exists file in your system.

after you run vagrant up you can ssh 192.168.33.10 with root username (don't forget to change the IP to the current used IP)

the ssh root username password is: toor

mysql root password is: toor

mysql server can be accessible outside localhost

to access phpmyadmin visit http://192.168.33.10/phpmyadmin (don't forget to change the IP to the current used IP)

Uploading PHP Project files to the server

Where to put your PHP projects?

Upload your PHP files into the folder /var/www/html/

You can use the following ssh username to upload files to /var/www/html

    ssh username: dofda3
    ssh password: ribbit

dofda3 user is Sudo User so you can use sudo command with dofda3 user

do not upload php files as A root (use user dofda3 instead) to keep files permissions in good stand and writable by Apache

This user can upload files using SFTP , SCP into the folder /var/www/html which is used as apache2 document root

You are advised to keep your php projects structured into /var/www/html , for example each project has its own folder. (eg project1 /var/www/html/project1 , project2 /var/www/html/project2 .. etc) 

dofda3 support multiple PHP versions

The current release of dofda3 support PHP 5.6.40 , 7.0.33 , 7.1.26 , 7.2.15

You can change the current used PHP version which used by linux cli and apache2 on the fly from ssh command line by running dofda3 command with appropriate parameters

for example to change the running php version to PHP 5.6 ssh to the box and run the following command

sudo dofda3 --php=5.6

for more help run dofda3 -h

PHP 5.6 , 7.0 & 7.1 uses Ondřej Surý PPA ppa:ondrej/php repository

Tracking Email Messages

dofda3 using MailHog to track and analyze outgoing email instead of sending emails to real word, so when use php send mail feature it will passed to MailHog instead of sending it in real.

to track and view sent emails by php visit http://192.168.33.10:8025/ (don't forget to use your server IP)

Configuration files

Apache 2 config file can be found in /etc/apache2/apache2.conf and the definition of apache 2 document root can be found in /etc/apache2/sites-enabled/000-default.conf

php.ini file which handle php configuration while running from linux cli can be found in /etc/php/N.N/cli/php.ini after change N.N to the specific PHP Version (eg php 5.6 php.ini can be found at /etc/php/5.6/cli/php.ini and 7.1 php.ini can be found in /etc/php/7.1/cli/php.ini ... etc.

php.ini file which handle php configuration while running from apache2 can be found in /etc/php/N.N/apache2/php.ini after change N.N to the specific PHP Version (eg php 5.6 php.ini can be found at /etc/php/5.6/apache2/php.ini and 7.1 php.ini can be found in /etc/php/7.1/apache2/php.ini ... etc.

when restarting services like apache2 you may be asked for Authentication , so use "dofda3 user for webserver (dofda3)" to authenticate by choosing dofda3 and enter the user ssh password

Tools that can be used

ssh commands

createmysqldb : use this command to create a new mysql database.

Leave a comment