@@ -7,8 +7,13 @@ is_windows_host=$1
7
7
guest_magento_dir=$2
8
8
magento_host_name=$3
9
9
10
+ vagrant_dir=" /vagrant"
11
+
10
12
apt-get update
11
13
14
+ # Install git
15
+ apt-get install -y git
16
+
12
17
# Setup Apache
13
18
apt-get install -y apache2
14
19
a2enmod rewrite
@@ -17,8 +22,8 @@ a2enmod rewrite
17
22
sed -i ' s|www-data|vagrant|g' /etc/apache2/envvars
18
23
19
24
# 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"
22
27
if [ -f ${custom_virtual_host_config} ]; then
23
28
virtual_host_config=${custom_virtual_host_config}
24
29
else
@@ -34,19 +39,53 @@ a2ensite magento2.conf
34
39
sudo a2dissite 000-default
35
40
36
41
# 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
45
83
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
50
89
51
90
# Restart Apache
52
91
service apache2 restart
@@ -62,9 +101,6 @@ sed -i '/\[client\]/a \
62
101
user = root \
63
102
password =' /etc/mysql/my.cnf
64
103
65
- # Install git
66
- apt-get install -y git
67
-
68
104
# Setup Composer
69
105
if [ ! -f /usr/local/bin/composer ]; then
70
106
cd /tmp
@@ -73,7 +109,7 @@ if [ ! -f /usr/local/bin/composer ]; then
73
109
fi
74
110
75
111
# Configure composer
76
- composer_auth_json=" /vagrant /local.config/composer/auth.json"
112
+ composer_auth_json=" ${vagrant_dir} /local.config/composer/auth.json"
77
113
if [ -f ${composer_auth_json} ]; then
78
114
set +x
79
115
echo " Installing composer OAuth tokens from ${composer_auth_json} ..."
@@ -85,7 +121,7 @@ if [ -f ${composer_auth_json} ]; then
85
121
fi
86
122
87
123
# 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
89
125
echo " export MAGENTO_ROOT=${guest_magento_dir} " >> /etc/profile
90
126
91
127
# Set permissions to allow Magento codebase upload by Vagrant provision script
0 commit comments