Skip to content
This repository was archived by the owner on Oct 1, 2020. It is now read-only.

Commit 641b521

Browse files
author
Alexander Paliarush
committedJan 4, 2016
- Added PHP 7.0 support by default
1 parent 199b2d7 commit 641b521

File tree

7 files changed

+84
-24
lines changed

7 files changed

+84
-24
lines changed
 

Diff for: ‎README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,22 @@ Custom solution is implemented for Windows hosts. See [explanation of the propos
2222
With current configuration Vagrant will:
2323

2424
1. Run Ubuntu box
25-
1. Install and configure all software necessary for Magento 2
25+
1. Install and configure all software necessary for Magento 2 (Apache 2.4, PHP 7.0 (or 5.5.9), MySQL 5.6, git, Composer, XDebug, Rabbit MQ)
2626
1. Install the Magento 2 application
27+
1. Configure PHP Storm project
2728

2829
## How to install
2930

3031
If you never used Vagrant before, read [Vagrant Docs](https://docs.vagrantup.com/v2/)
3132

3233
### Requirements
33-
- [Vagrant](https://www.vagrantup.com/downloads.html) is installed and available globally in command line
34+
- [Vagrant 1.8+](https://www.vagrantup.com/downloads.html) is installed and available globally in command line
3435
- [Host manager plugin for Vagrant](https://github.com/smdahlen/vagrant-hostmanager)
3536
- [VirtualBox](https://www.virtualbox.org/wiki/Downloads)
3637
- [Composer](https://getcomposer.org/doc/00-intro.md) is installed and is available globally in command line
3738
- Make sure you have SSH keys generated and associated with your github account, see [manual](https://help.github.com/articles/generating-ssh-keys/).
3839
:information_source: You can use another way of getting codebase instead of cloning, it does not matter for successful installation.
40+
- \[Optional\] but highly recommended, [PHP Storm](https://www.jetbrains.com/phpstorm)
3941

4042
### Installation steps
4143

Diff for: ‎Vagrantfile

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ Vagrant.configure(VAGRANT_API_VERSION) do |config|
3030
vb.memory = get_variable_value('guest_ram') # Default is 2Gb, around 3Gb is necessary to run functional tests
3131
end
3232

33-
config.vm.synced_folder '.', '/vagrant'
33+
config.vm.synced_folder '.', '/vagrant', disabled: true
34+
config.vm.synced_folder './local.config', '/vagrant/local.config'
35+
config.vm.synced_folder './scripts', '/vagrant/scripts'
3436
if OS.is_windows
3537
guest_magento_dir = '/var/www/magento2ce'
3638
config.vm.synced_folder host_magento_dir + '/var/generation', guest_magento_dir + '/var/generation'

Diff for: ‎local.config/.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
!/magento2_virtual_host.conf.dist
99
!/magento_host_name.txt.dist
1010
!/magento_ip_address.txt.dist
11-
!/guest_ram.txt.dist
11+
!/guest_ram.txt.dist
12+
!/use_php7.txt.dist

Diff for: ‎scripts/host/configure_php_storm.sh

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ cp -R "${vagrant_dir}/scripts/host/php-storm-configs" "${vagrant_dir}/.idea"
1515
enabled_virtual_host_config="/etc/apache2/sites-available/magento2.conf"
1616
sed -i '' "s|<host_name>|${magento_host_name}|g" "${vagrant_dir}/.idea/webServers.xml"
1717
sed -i '' "s|<ssh_port>|${ssh_port}|g" "${vagrant_dir}/.idea/webServers.xml"
18+
sed -i '' "s|<host_name>|${magento_host_name}|g" "${vagrant_dir}/.idea/php.xml"
19+
sed -i '' "s|<ssh_port>|${ssh_port}|g" "${vagrant_dir}/.idea/php.xml"
1820
sed -i '' "s|<host_name>|${magento_host_name}|g" "${vagrant_dir}/.idea/deployment.xml"
1921
sed -i '' "s|<host_name>|${magento_host_name}|g" "${vagrant_dir}/.idea/.name"
2022
sed -i '' "s|<host_name>|${magento_host_name}|g" "${vagrant_dir}/.idea/modules.xml"

Diff for: ‎scripts/host/php-storm-configs/php.xml

+17
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,21 @@
55
<PhpUnitSettings load_method="CUSTOM_LOADER" custom_loader_path="$PROJECT_DIR$/magento2ce/vendor/phpunit/phpunit/phpunit" phpunit_phar_path="" />
66
</phpunit_settings>
77
</component>
8+
<component name="MessDetector">
9+
<phpmd_settings>
10+
<MessDetectorConfiguration tool_path="$USER_HOME$/PhpstormProjects/magento2-vagrant/magento2ce/vendor/phpmd/phpmd/src/bin/phpmd" />
11+
</phpmd_settings>
12+
</component>
13+
<component name="PhpCodeSniffer">
14+
<phpcs_settings>
15+
<PhpCSConfiguration standards="MySource;PEAR;PHPCS;PSR1;PSR2;Squiz;Zend" tool_path="$USER_HOME$/PhpstormProjects/magento2-vagrant/magento2ce/vendor/squizlabs/php_codesniffer/scripts/phpcs" />
16+
</phpcs_settings>
17+
</component>
18+
<component name="PhpInterpreters">
19+
<interpreters>
20+
<interpreter home="sftp://vagrant@127.0.0.1:<ssh_port>/usr/bin/php" id="php-interpreter-<host_name>" name="Remote PHP (<host_name>)" debugger_id="php.debugger.XDebug">
21+
<remote_data WEB_SERVER_CONFIG_ID="web-server-id-<host_name>" WEB_SERVER_CONFIG_NAME="<host_name>" HOST="127.0.0.1" PORT="<ssh_port>" ANONYMOUS="false" USERNAME="vagrant" PASSWORD="" PRIVATE_KEY_FILE="$PROJECT_DIR$/.vagrant/machines/magento2.vagrant/virtualbox/private_key" MY_KNOWN_HOSTS_FILE="" PASSPHRASE="" USE_KEY_PAIR="true" INTERPRETER_PATH="/usr/bin/php" HELPERS_PATH="/home/vagrant/.phpstorm_helpers" INITIALIZED="false" VALID="true" />
22+
</interpreter>
23+
</interpreters>
24+
</component>
825
</project>

Diff for: ‎scripts/host/php-storm-configs/webServers.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<project version="4">
33
<component name="WebServers">
44
<option name="servers">
5-
<webServer id="8eec3df1-5f59-4fcc-a1dc-dd86806122d4" name="<host_name>" url="http://127.0.0.1">
5+
<webServer id="web-server-id-<host_name>" name="<host_name>" url="http://127.0.0.1">
66
<fileTransfer host="127.0.0.1" port="<ssh_port>" privateKey="$PROJECT_DIR$/.vagrant/machines/<host_name>/virtualbox/private_key" accessType="SFTP" username="vagrant" keyPair="true">
77
<advancedOptions>
88
<advancedOptions dataProtectionLevel="Private" />

Diff for: ‎scripts/provision/install_environment.sh

+55-19
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ is_windows_host=$1
77
guest_magento_dir=$2
88
magento_host_name=$3
99

10+
vagrant_dir="/vagrant"
11+
1012
apt-get update
1113

14+
# Install git
15+
apt-get install -y git
16+
1217
# Setup Apache
1318
apt-get install -y apache2
1419
a2enmod rewrite
@@ -17,8 +22,8 @@ a2enmod rewrite
1722
sed -i 's|www-data|vagrant|g' /etc/apache2/envvars
1823

1924
# Enable Magento virtual host
20-
custom_virtual_host_config="/vagrant/local.config/magento2_virtual_host.conf"
21-
default_virtual_host_config="/vagrant/local.config/magento2_virtual_host.conf.dist"
25+
custom_virtual_host_config="${vagrant_dir}/local.config/magento2_virtual_host.conf"
26+
default_virtual_host_config="${vagrant_dir}/local.config/magento2_virtual_host.conf.dist"
2227
if [ -f ${custom_virtual_host_config} ]; then
2328
virtual_host_config=${custom_virtual_host_config}
2429
else
@@ -34,19 +39,53 @@ a2ensite magento2.conf
3439
sudo a2dissite 000-default
3540

3641
# Setup PHP
37-
apt-get install -y php5 php5-mhash php5-mcrypt php5-curl php5-cli php5-mysql php5-gd php5-intl php5-xsl php5-xdebug curl
38-
if [ ! -f /etc/php5/apache2/conf.d/20-mcrypt.ini ]; then
39-
ln -s /etc/php5/mods-available/mcrypt.ini /etc/php5/apache2/conf.d/20-mcrypt.ini
40-
fi
41-
if [ ! -f /etc/php5/cli/conf.d/20-mcrypt.ini ]; then
42-
ln -s /etc/php5/mods-available/mcrypt.ini /etc/php5/cli/conf.d/20-mcrypt.ini
43-
fi
44-
echo "date.timezone = America/Chicago" >> /etc/php5/cli/php.ini
42+
use_php7=$(sh "${vagrant_dir}/scripts/host/get_variable_value.sh" "use_php7")
43+
if [ ${use_php7} -eq 1 ]; then
44+
# Workaround until php7.0 is available in official ubuntu repository
45+
apt-get install -y language-pack-en-base
46+
LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php-7.0
47+
apt-get update
48+
49+
apt-get install -y php7.0 php7.0-mcrypt php7.0-curl php7.0-cli php7.0-mysql php7.0-gd php7.0-intl php7.0-xsl
50+
51+
# Install XDebug
52+
apt-get install -y php7.0-dev
53+
cd /usr/lib
54+
git clone git://github.com/xdebug/xdebug.git
55+
cd xdebug
56+
phpize
57+
./configure --enable-xdebug
58+
make
59+
make install
60+
61+
## Configure XDebug to allow remote connections from the host
62+
touch /etc/php/7.0/cli/conf.d/20-xdebug.ini
63+
echo 'zend_extension=/usr/lib/xdebug/modules/xdebug.so
64+
xdebug.max_nesting_level=200
65+
xdebug.remote_enable=1
66+
xdebug.remote_connect_back=1' >> /etc/php/7.0/cli/conf.d/20-xdebug.ini
67+
68+
echo "date.timezone = America/Chicago" >> /etc/php/7.0/cli/php.ini
69+
70+
sed -i "s|;include_path = \".:/usr/share/php\"|include_path = \".:/usr/share/php:${guest_magento_dir}/vendor/phpunit/phpunit\"|g" /etc/php/7.0/cli/php.ini
71+
72+
rm -rf /etc/php/7.0/apache2
73+
ln -s /etc/php/7.0/cli /etc/php/7.0/apache2
74+
else
75+
apt-get install -y php5 php5-mhash php5-mcrypt php5-curl php5-cli php5-mysql php5-gd php5-intl php5-xsl php5-xdebug curl
76+
if [ ! -f /etc/php5/apache2/conf.d/20-mcrypt.ini ]; then
77+
ln -s /etc/php5/mods-available/mcrypt.ini /etc/php5/apache2/conf.d/20-mcrypt.ini
78+
fi
79+
if [ ! -f /etc/php5/cli/conf.d/20-mcrypt.ini ]; then
80+
ln -s /etc/php5/mods-available/mcrypt.ini /etc/php5/cli/conf.d/20-mcrypt.ini
81+
fi
82+
echo "date.timezone = America/Chicago" >> /etc/php5/cli/php.ini
4583

46-
# Configure XDebug to allow remote connections from the host
47-
echo 'xdebug.max_nesting_level=200
48-
xdebug.remote_enable=1
49-
xdebug.remote_connect_back=1' >> /etc/php5/cli/conf.d/20-xdebug.ini
84+
# Configure XDebug to allow remote connections from the host
85+
echo 'xdebug.max_nesting_level=200
86+
xdebug.remote_enable=1
87+
xdebug.remote_connect_back=1' >> /etc/php5/cli/conf.d/20-xdebug.ini
88+
fi
5089

5190
# Restart Apache
5291
service apache2 restart
@@ -62,9 +101,6 @@ sed -i '/\[client\]/a \
62101
user = root \
63102
password =' /etc/mysql/my.cnf
64103

65-
# Install git
66-
apt-get install -y git
67-
68104
# Setup Composer
69105
if [ ! -f /usr/local/bin/composer ]; then
70106
cd /tmp
@@ -73,7 +109,7 @@ if [ ! -f /usr/local/bin/composer ]; then
73109
fi
74110

75111
# Configure composer
76-
composer_auth_json="/vagrant/local.config/composer/auth.json"
112+
composer_auth_json="${vagrant_dir}/local.config/composer/auth.json"
77113
if [ -f ${composer_auth_json} ]; then
78114
set +x
79115
echo "Installing composer OAuth tokens from ${composer_auth_json}..."
@@ -85,7 +121,7 @@ if [ -f ${composer_auth_json} ]; then
85121
fi
86122

87123
# Declare path to scripts supplied with vagrant and Magento
88-
echo "export PATH=\$PATH:/vagrant/scripts/guest:${guest_magento_dir}/bin" >> /etc/profile
124+
echo "export PATH=\$PATH:${vagrant_dir}/scripts/guest:${guest_magento_dir}/bin" >> /etc/profile
89125
echo "export MAGENTO_ROOT=${guest_magento_dir}" >> /etc/profile
90126

91127
# Set permissions to allow Magento codebase upload by Vagrant provision script

0 commit comments

Comments
 (0)
This repository has been archived.