Compare commits

..

No commits in common. "master" and "v1.0" have entirely different histories.
master ... v1.0

9 changed files with 137 additions and 99 deletions

View file

@ -1 +0,0 @@
Chef::Config.chef_license = 'accept'

View file

@ -3,11 +3,11 @@
## Description ## Description
This repository contains a starter kit providing a fully functional **Ubuntu Server 18.04 LTS** (headless) LAMP local development environment on top of Vagrant. This repository contains a starter kit providing a fully functional **Ubuntu Server 16.04 LTS** (headless) LAMP local development environment on top of Vagrant.
This starter kit uses a virtualization application (**VirtualBox**), a virtualization wrapper (**Vagrant**) and a recipes manager (**Chef Solo**). See "[Installation](#installation)" below. This starter kit uses a virtualization application (**VirtualBox**), a virtualization wrapper (**Vagrant**) and a recipes manager (**Chef Solo**). See "[Installation](#installation)" below.
The Vagrant Virtual Machine (or VM) will run a Ubuntu Server instance. The Ubuntu box is hosted on VagrantUp as [hashicorp/bionic64](https://app.vagrantup.com/hashicorp/boxes/bionic64). It is a clean install of Ubuntu with just a little bit of configuration in it. You may use a different box or use your own by editing the `config.vm.box` setting into the [Vagrantfile](https://github.com/axeloz/vagrant-lamp/blob/master/Vagrantfile). I highly recommend to use an Ubuntu distribution. It might also work on Debian but this is untested. Changing the Vagrant box is at your own risk as I cannot guaranty the compatibility. The Vagrant Virtual Machine (or VM) will run a Ubuntu Server instance. The **box image used was created by me**. It is hosted on VagrantUp as [axeloz/ubuntu-server-16.04](https://app.vagrantup.com/axeloz/boxes/ubuntu-server-16.04). It is a clean install of Ubuntu with just a little bit of configuration in it. You may use a different box or use your own by editing the `config.vm.box` setting into the [Vagrantfile](https://github.com/axeloz/vagrant-lamp/blob/master/Vagrantfile). I highly recommend to use an Ubuntu distribution. It might also work on Debian but this is untested. Changing the Vagrant box is at your own risk as I cannot guaranty the compatibility.
### Why should I use this starter kit? ### Why should I use this starter kit?
@ -41,10 +41,12 @@ Let me know if you encounter any issue.
- Browser Sync (https://www.browsersync.io) - Browser Sync (https://www.browsersync.io)
- CURL (https://curl.haxx.se) - CURL (https://curl.haxx.se)
- Deployer (https://deployer.org) - Deployer (https://deployer.org)
- Drush@8.1.10 (https://github.com/drush-ops/drush)
- Drupal Console (https://drupalconsole.com/)
- Git (https://git-scm.com/) - Git (https://git-scm.com/)
- Git-LFS (https://git-lfs.github.com) - Git-LFS (https://git-lfs.github.com)
- Gulp (http://gulpjs.com/) - Gulp (http://gulpjs.com/)
- PHP7.4 (http://www.php.net) : - PHP7.1 (http://www.php.net) :
- CURL - CURL
- Dev - Dev
- GD - GD
@ -68,7 +70,7 @@ Let me know if you encounter any issue.
- MongoDB (https://www.mongodb.com/) - MongoDB (https://www.mongodb.com/)
- Multitail (https://www.vanheusden.com/multitail/) - Multitail (https://www.vanheusden.com/multitail/)
- Nano - Nano
- NodeJS 7 (https://nodejs.org/en/) et YARN (http://yarnpkg.com) - NodeJS 7 (https://nodejs.org/en/) et NPM (https://www.npmjs.com/)
- NTPDate - NTPDate
- Redis (https://redis.io/) - Redis (https://redis.io/)
- SASS (http://sass-lang.com) - SASS (http://sass-lang.com)
@ -83,7 +85,6 @@ Need more tools? See [Contributing](#contributing)
- Download and install VirtualBox (http://www.virtualbox.org/) - Download and install VirtualBox (http://www.virtualbox.org/)
- Download and install Vagrant (https://www.vagrantup.com/) - Download and install Vagrant (https://www.vagrantup.com/)
- Install Landrush plugin `vagrant plugin install landrush`
- Clone the latest version of this repository (https://github.com/axeloz/vagrant-lamp) into your Home directory, wherever you want it to be. For example for Mac: `/Users/my-user/Sites/vagrant-lamp` - Clone the latest version of this repository (https://github.com/axeloz/vagrant-lamp) into your Home directory, wherever you want it to be. For example for Mac: `/Users/my-user/Sites/vagrant-lamp`
- Open your terminal app, `cd` to the `vagrant-lamp` directory - Open your terminal app, `cd` to the `vagrant-lamp` directory
- Run a `vagrant up` command. During the first boot, Vagrant will download the Linux Ubuntu 16.04 box from VagrantUp, create a new VirtualBox VM, boot the VM and run the Chef recipes. This will install all the dependencies, it may take some time. - Run a `vagrant up` command. During the first boot, Vagrant will download the Linux Ubuntu 16.04 box from VagrantUp, create a new VirtualBox VM, boot the VM and run the Chef recipes. This will install all the dependencies, it may take some time.
@ -118,8 +119,7 @@ In order to upgrade, just:
- To sudo in the VM, just run `sudo <command>`. The `vagrant` user belongs to the sudoers and you may `sudo` with no password asked - To sudo in the VM, just run `sudo <command>`. The `vagrant` user belongs to the sudoers and you may `sudo` with no password asked
- The IP address `192.168.99.100` is created by VM - The IP address `192.168.99.100` is created by VM
- The VM is also available on hostname `localhost` - The VM is also available on hostname `localhost`
- In order to access your local websites: http://vagrant.vm - In order to access your local websites: http://localhost:8080
- You may use the wildcard: http://*.vagrant.vm
- In order to access Mailcatcher: http://localhost:1080 - In order to access Mailcatcher: http://localhost:1080
- In order to access to MariaDB: mysql://vagrant:vagrant@localhost:3307 from the host. Use mysql://vagrant:vagrant@localhost:3306 from the VM. - In order to access to MariaDB: mysql://vagrant:vagrant@localhost:3307 from the host. Use mysql://vagrant:vagrant@localhost:3306 from the VM.
- In order to access the Mailcatcher's SMTP from the host: smtp://localhost:1025 - In order to access the Mailcatcher's SMTP from the host: smtp://localhost:1025
@ -145,13 +145,13 @@ The SSH identity forwarding is enabled from the host to the VM (`config.ssh.forw
### Apache ### Apache
#### Access #### Access
Your local environment is available from your host computer at the address: http://vagrant.vm. This will launch the [projects browser](#projects-browser). Your local environment is available from your host computer at the address: http://localhost:8080. This will launch the [projects browser](#projects-browser).
The default document root is: `/vagrant/www` The default document root is: `/vagrant/www`
#### Dedicated Apache virtual host #### Dedicated Apache virtual host
In some cases, you might need to create a dedicated virtual host to access your projects. For example: http://myproject.vagrant.vm. In some cases, you might need to create a dedicated virtual host to access your projects. For example: http://myproject.local:8080.
For Mac and Unix systems: in order to do so, the script [create-vhost.sh](https://github.com/axeloz/vagrant-lamp/blob/master/create-vhost.sh) is provided. Make sure it is executable (`chmod +x create-vhost.sh`) and run it from the **host** (`./create-vhost.sh`). Just follow the instructions, the script will then create an entry into the `/etc/hosts` file and will add the virtual host to Apache into the `vagrant-lamp/apache/conf` folder. Finally, it will reload Apache. For Mac and Unix systems: in order to do so, the script [create-vhost.sh](https://github.com/axeloz/vagrant-lamp/blob/master/create-vhost.sh) is provided. Make sure it is executable (`chmod +x create-vhost.sh`) and run it from the **host** (`./create-vhost.sh`). Just follow the instructions, the script will then create an entry into the `/etc/hosts` file and will add the virtual host to Apache into the `vagrant-lamp/apache/conf` folder. Finally, it will reload Apache.
@ -224,7 +224,7 @@ For any other unlisted issue, please add a ticket on Github: https://github.com/
When you run a files watcher on the VM, the `watch` command is running on the VM but the watched files are located on the host computer and mounted using NFS on the VM. For this reason, the watcher does not always catch file changes properly. I tried to fix this issue, let me know if you come accross this matter. When you run a files watcher on the VM, the `watch` command is running on the VM but the watched files are located on the host computer and mounted using NFS on the VM. For this reason, the watcher does not always catch file changes properly. I tried to fix this issue, let me know if you come accross this matter.
For example for Laravel, the `yarn run watch` command doesn't seem to work properly. Use `yarn run watch-poll` instead. For example for Laravel, the `npm run watch` command doesn't seem to work properly. Use `npm run watch-poll` instead.
## Contributing ## Contributing

7
Vagrantfile vendored
View file

@ -13,10 +13,8 @@ Vagrant.configure("2") do |config|
# Every Vagrant development environment requires a box. You can search for # Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search. # boxes at https://atlas.hashicorp.com/search.
config.vm.box = "hashicorp/bionic64" config.vm.box = "axeloz/ubuntu-server-16.04"
config.landrush.enabled = true
config.landrush.tld = 'vm'
#config.ssh.private_key_path="~/.ssh/id_rsa" #config.ssh.private_key_path="~/.ssh/id_rsa"
config.ssh.username = 'vagrant' config.ssh.username = 'vagrant'
@ -76,7 +74,7 @@ Vagrant.configure("2") do |config|
#vb.gui = true #vb.gui = true
# #
# # Customize the amount of memory on the VM: # # Customize the amount of memory on the VM:
vb.memory = "2048" vb.memory = "1024"
vb.name = "w_vagrant_lamp" vb.name = "w_vagrant_lamp"
# Fixing issue of VM loosing sync of the date and time while sleeping. # Fixing issue of VM loosing sync of the date and time while sleeping.
@ -102,7 +100,6 @@ Vagrant.configure("2") do |config|
# SHELL # SHELL
config.vm.provision "chef_solo" do |chef| config.vm.provision "chef_solo" do |chef|
chef.custom_config_path = "CustomConfiguration.chef"
chef.add_recipe "lamp" chef.add_recipe "lamp"
end end

View file

@ -16,8 +16,6 @@ package 'curl'
package 'unzip' package 'unzip'
package 'lsb-release' package 'lsb-release'
package 'ca-certificates' package 'ca-certificates'
package 'software-properties-common'
##################################### #####################################
# NTPDATE # NTPDATE
@ -39,31 +37,31 @@ apt_repository 'php7' do
cache_rebuild true cache_rebuild true
end end
package 'php7.4' package 'php7.1'
package 'php7.4-curl' package 'php7.1-curl'
package 'php7.4-dev' package 'php7.1-dev'
package 'php7.4-gd' package 'php7.1-gd'
package 'php7.4-json' package 'php7.1-json'
package 'php7.4-mysql' package 'php7.1-mysql'
package 'php7.4-readline' package 'php7.1-readline'
package 'php7.4-xml' package 'php7.1-xml'
package 'php7.4-intl' package 'php7.1-intl'
package 'php7.4-mbstring' package 'php7.1-mbstring'
package 'php7.1-mcrypt' package 'php7.1-mcrypt'
package 'php-xdebug' package 'php-xdebug'
package 'php7.4-zip' package 'php7.1-zip'
package 'php7.4-sqlite3' package 'php7.1-sqlite3'
package 'php7.4-msgpack' package 'php7.1-msgpack'
package 'php7.4-gmp' package 'php7.1-gmp'
package 'php7.4-geoip' package 'php7.1-geoip'
package 'php7.4-redis' package 'php7.1-redis'
##################################### #####################################
# MEMCACHE # MEMCACHE
##################################### #####################################
package 'memcached' package 'memcached'
package 'php-memcached' package 'php7.1-memcached'
service 'memcached' do service 'memcached' do
action [:enable, :start] action [:enable, :start]
@ -74,7 +72,7 @@ end
# APACHE # APACHE
##################################### #####################################
package 'apache2' package 'apache2'
package 'libapache2-mod-php7.4' package 'libapache2-mod-php7.1'
template '/etc/apache2/conf-enabled/users.conf' do template '/etc/apache2/conf-enabled/users.conf' do
source 'users.conf' source 'users.conf'
@ -85,7 +83,7 @@ template '/etc/apache2/sites-enabled/000-default.conf' do
manage_symlink_source true manage_symlink_source true
end end
template '/etc/php/7.4/apache2/php.ini' do template '/etc/php/7.1/apache2/php.ini' do
source 'php.ini.erb' source 'php.ini.erb'
end end
@ -103,7 +101,7 @@ end
##################################### #####################################
# GIT # GIT
##################################### #####################################
#package 'python-software-properties' package 'python-software-properties'
apt_repository 'git-core' do apt_repository 'git-core' do
action :add action :add
@ -136,20 +134,9 @@ end
# MYSQL # MYSQL
##################################### #####################################
execute 'add_mariadb_repo' do
user 'root'
command 'apt-key adv --fetch-keys "https://mariadb.org/mariadb_release_signing_key.asc" && add-apt-repository "deb [arch=amd64,arm64,ppc64el] http://mirror.realcompute.io/mariadb/repo/10.4/ubuntu bionic main"'
end
apt_update
package 'mariadb-server' package 'mariadb-server'
package 'mariadb-client' package 'mariadb-client'
service 'mysql' do
action [:enable]
end
template '/etc/init.d/mysql' do template '/etc/init.d/mysql' do
source 'mysql-init-d' source 'mysql-init-d'
end end
@ -158,7 +145,6 @@ template '/etc/mysql/mariadb.conf.d/50-server.cnf' do
source 'mysql-50-server.cnf' source 'mysql-50-server.cnf'
end end
directory '/var/run/mysqld' do directory '/var/run/mysqld' do
user 'root' user 'root'
action :create action :create
@ -167,57 +153,35 @@ directory '/var/run/mysqld' do
mode '0775' mode '0775'
end end
service 'mysql' do
supports :start => true, :stop => true, :restart => true, :reload => true, :status => true
action [:enable, :reload]
end
execute 'mysql_create_databases' do execute 'mysql_create_databases' do
user 'root' user 'vagrant'
notifies :stop, 'service[mysql]', :before notifies :stop, 'service[mysql]', :before
command '/usr/bin/env mysql_install_db' command '/usr/bin/env mysql_install_db'
creates '/vagrant/mysql/data/mysql' creates '/vagrant/mysql/data/mysql'
notifies :start, 'service[mysql]', :immediately notifies :start, 'service[mysql]', :immediately
end end
execute 'mysql_create_user_1' do execute 'mysql_create_user' do
command '/usr/bin/env mysql -uroot -e "CREATE USER \'vagrant\'@\'%\' IDENTIFIED BY \'vagrant\'; GRANT ALL PRIVILEGES ON *.* TO \'vagrant\'@\'%\' WITH GRANT OPTION;"' command '/usr/bin/env mysql -uroot -e "CREATE USER \'vagrant\'@\'%\' IDENTIFIED BY \'vagrant\'; GRANT ALL PRIVILEGES ON *.* TO \'vagrant\'@\'%\' WITH GRANT OPTION;"'
not_if '/usr/bin/env mysql -uroot -e "SELECT User FROM mysql.user WHERE User = \'vagrant\' AND Host = \'%\'" |grep vagrant' not_if '/usr/bin/env mysql -uroot -e "SELECT User FROM mysql.user WHERE User = \'vagrant\'" |grep vagrant'
end end
execute 'mysql_create_user_2' do
command '/usr/bin/env mysql -uroot -e "CREATE USER \'vagrant\'@\'localhost\' IDENTIFIED BY \'vagrant\'; GRANT ALL PRIVILEGES ON *.* TO \'vagrant\'@\'localhost\' WITH GRANT OPTION;"'
not_if '/usr/bin/env mysql -uroot -e "SELECT User FROM mysql.user WHERE User = \'vagrant\' AND Host = \'localhost\'" |grep vagrant'
end
#####################################
# YARN
#####################################
execute 'add_yarn' do
user 'root'
command 'curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - && echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list'
creates '/etc/apt/sources.list.d/yarn.list'
end
apt_update
package 'yarn'
##################################### #####################################
# NODEJS # NODEJS
##################################### #####################################
execute 'install_nodejs' do execute 'install_nodejs' do
user 'root' user 'root'
command 'curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -' command 'curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -'
creates '/usr/bin/nodejs' creates '/usr/bin/nodejs'
end end
package 'nodejs' package 'nodejs'
#####################################
# NPM
#####################################
# execute 'install_gulp' do
# user 'root'
# command 'npm install -g npm'
# creates '/usr/bin/npm'
# end
##################################### #####################################
# MAILCATCHER # MAILCATCHER
@ -246,6 +210,48 @@ service 'mailcatcher' do
action [:enable, :start] action [:enable, :start]
end end
#####################################
# WP_CLI
#####################################
bash 'install_wpcli' do
code <<-EOH
/usr/bin/env curl -sO https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
if [ $? -eq 0 ] && [ -f "wp-cli.phar" ]; then
chmod +x wp-cli.phar
mv wp-cli.phar /usr/local/bin/wp
fi
EOH
creates '/usr/local/bin/wp'
end
#####################################
# DRUSH
#####################################
# Installs drush@8.1.10
bash 'install_drush' do
code <<-EOH
/usr/bin/env curl -sLO https://github.com/drush-ops/drush/releases/download/8.1.10/drush.phar
if [ $? -eq 0 ] && [ -f "drush.phar" ]; then
chmod +x drush.phar
mv drush.phar /usr/local/bin/drush
fi
EOH
creates '/usr/local/bin/drush'
end
#####################################
# DRUPAL CONSOLE
#####################################
bash 'install_drupal_console' do
code <<-EOH
php -r "readfile('https://drupalconsole.com/installer');" > drupal.phar
if [ $? -eq 0 ] && [ -f "drupal.phar" ]; then
chmod +x drupal.phar
mv drupal.phar /usr/local/bin/drupal
fi
EOH
creates '/usr/local/bin/drupal'
end
##################################### #####################################
@ -253,17 +259,27 @@ end
##################################### #####################################
execute 'install_browsersync' do execute 'install_browsersync' do
user 'root' user 'root'
command 'yarn global add browser-sync' command 'npm install -g browser-sync'
creates '/usr/bin/browser-sync' creates '/usr/bin/browser-sync'
end end
#####################################
# NPM
#####################################
execute 'install_gulp' do
user 'root'
command 'npm install -g npm'
creates '/usr/bin/npm'
end
##################################### #####################################
# BOWER # BOWER
##################################### #####################################
execute 'install_bower' do execute 'install_bower' do
user 'root' user 'root'
command 'yarn global add bower' command 'npm install -g bower'
creates '/usr/bin/bower' creates '/usr/bin/bower'
end end
@ -281,7 +297,7 @@ end
# MONGODB # MONGODB
##################################### #####################################
package 'mongodb' package 'mongodb'
service 'mongodb' do service 'mysql' do
action [:enable, :start] action [:enable, :start]
end end

View file

@ -15,10 +15,11 @@
# * Basic Settings # * Basic Settings
# #
user = vagrant user = vagrant
pid-file = /vagrant/mysql/mysqld.pid pid-file = /var/run/mysqld/mysqld.pid
socket = /vagrant/mysql/mysqld.sock socket = /var/run/mysqld/mysqld.sock
port = 3306 port = 3306
basedir = /usr basedir = /usr
#datadir = /var/lib/mysql
datadir = /vagrant/mysql/data datadir = /vagrant/mysql/data
tmpdir = /tmp tmpdir = /tmp
lc-messages-dir = /usr/share/mysql lc-messages-dir = /usr/share/mysql
@ -72,7 +73,7 @@ long_query_time = 10
# note: if you are setting up a replication slave, see README.Debian about # note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change. # other settings you may need to change.
#server-id = 1 #server-id = 1
log_bin = /vagrant/mysql/mysql-bin.log #log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10 expire_logs_days = 10
max_binlog_size = 100M max_binlog_size = 100M
#binlog_do_db = include_database_name #binlog_do_db = include_database_name
@ -125,4 +126,4 @@ collation-server = utf8mb4_general_ci
# This group is only read by MariaDB-10.0 servers. # This group is only read by MariaDB-10.0 servers.
# If you use the same .cnf file for MariaDB of different versions, # If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand # use this group for options that older servers don't understand
[mariadb-10.0] [mariadb-10.0]

View file

@ -108,7 +108,7 @@ case "${1:-''}" in
log_end_msg 0 log_end_msg 0
else else
# Could be removed during boot # Could be removed during boot
install -m 755 -o root -g root -d /var/run/mysqld install -m 755 -o vagrant -g vagrant -d /var/run/mysqld
# Start MariaDB! # Start MariaDB!
/usr/bin/mysqld_safe "${@:2}" 2>&1 >/dev/null | $ERR_LOGGER & /usr/bin/mysqld_safe "${@:2}" 2>&1 >/dev/null | $ERR_LOGGER &

View file

@ -19,6 +19,13 @@ then
fi fi
# Checking whether /etc/hosts file exists
if [ ! -f "/etc/hosts" ]
then
error "Could not find the /etc/hosts file. I must abort..."
exit 1
fi
echo echo
echo "= APPLICATION CONFIGURATION =" echo "= APPLICATION CONFIGURATION ="
echo echo
@ -117,13 +124,11 @@ append=false
echo echo
while true while true
do do
read -p "What is the subdomain of \"vagrant.vm\" would you like to add? " hostname read -p "What is the hostname of the vhost you want to add? " hostname
if [ -z "$hostname" ] if [ -z "$hostname" ]
then then
error "The subdomain cannot be empty, please retry..." error "The hostname cannot be empty, please retry..."
else
hostname=
elif [ -f "$vagrantroot/apache/conf/$hostname.conf" ] elif [ -f "$vagrantroot/apache/conf/$hostname.conf" ]
then then
error "The configuration file '$vagrantroot/apache/conf/$hostname.conf' already exists." error "The configuration file '$vagrantroot/apache/conf/$hostname.conf' already exists."
@ -229,12 +234,31 @@ echo
success "Thank you, everything is now fine. We are processing your request" success "Thank you, everything is now fine. We are processing your request"
echo echo
# Managing the /etc/hosts file
echo "= ADDING HOSTNAME TO LOCAL HOSTS FILE ="
test=`cat /etc/hosts |grep "$hostname"`
if [ $? -ne 0 ]
then
echo "You will have to enter your password."
sudo -- sh -c -e "echo '127.0.0.1 $hostname' >> /etc/hosts"
if [ $? -ne 0 ]
then
error "Could not edit the '/etc/hosts' automatically"
error "You should add the following line manually:"
error " 127.0.0.1 $hostname"
else
success "Hostname successfully added to host's file"
fi
else
success "The '$hostname' entry already exists in '/etc/hosts'"
fi
# Managing the Apache configuration # Managing the Apache configuration
echo echo
echo "= ADDING VHOST TO APACHE =" echo "= ADDING VHOST TO APACHE ="
vhost="<VirtualHost *:80> vhost="<VirtualHost *:80>
ServerName $hostname.vagrant.vm ServerName $hostname
DocumentRoot $public DocumentRoot $public
<Directory $path> <Directory $path>
AllowOverride All AllowOverride All
@ -249,7 +273,7 @@ if [ $? -ne 0 ]
then then
error "Could not create the '$vagrantroot/apache/conf/$hostname.conf' file automatically" error "Could not create the '$vagrantroot/apache/conf/$hostname.conf' file automatically"
error "You should create it with the following line manually:" error "You should create it with the following line manually:"
error "$vhost" error " 127.0.0.1 $hostname"
else else
success "Hostname successfully added to host's file" success "Hostname successfully added to host's file"
fi fi
@ -270,5 +294,6 @@ echo
echo echo
success "END, thank you!" success "END, thank you!"
success "You may now access the vhost:" success "You may now access the vhost:"
success "http://$hostname.vagrant.vm/" success "http://$hostname:8080/"
echo echo

View file

View file

@ -3,8 +3,8 @@
if (isset($_POST['to'])) { if (isset($_POST['to'])) {
$to = isset($_POST['to']) && !empty($_POST['to']) ? $_POST['to'] : 'noreply@domain.fr'; $to = isset($_POST['to']) && !empty($_POST['to']) ? $_POST['to'] : 'noreply@wcie.fr';
$from = isset($_POST['from']) && !empty($_POST['from']) ? $_POST['from'] : 'paul@domain.fr'; $from = isset($_POST['from']) && !empty($_POST['from']) ? $_POST['from'] : 'a.devignon@wcie.fr';
$subject = isset($_POST['subject']) && !empty($_POST['subject']) ? $_POST['subject'] : 'Test subject'; $subject = isset($_POST['subject']) && !empty($_POST['subject']) ? $_POST['subject'] : 'Test subject';
$message = isset($_POST['message']) && !empty($_POST['message']) ? $_POST['message'] : 'This is a test message'; $message = isset($_POST['message']) && !empty($_POST['message']) ? $_POST['message'] : 'This is a test message';
@ -57,12 +57,12 @@ if (isset($_POST['to'])) {
<form action="mail.php" method="post" enctype="multipart/form-data"> <form action="mail.php" method="post" enctype="multipart/form-data">
<div class="form-group"> <div class="form-group">
<label>From:</label> <label>From:</label>
<input type="email" class="form-control" name="from" value placeholder="noreply@domain.fr" /> <input type="email" class="form-control" name="from" value placeholder="noreply@wcie.fr" />
</div> </div>
<div class="form-group"> <div class="form-group">
<label>To:</label> <label>To:</label>
<input type="email" class="form-control" name="to" value placeholder="paul@domain.fr" /> <input type="email" class="form-control" name="to" value placeholder="a.devignon@wcie.fr" />
</div> </div>
<div class="form-group"> <div class="form-group">