Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ansible Playbook to install PHP7
- name: Install Packages Needed To Compile PHP 7
apt: pkg={{ item }} state=latest
with_items:
- git
- autoconf
- bison
- libxml2-dev
- libbz2-dev
- libmcrypt-dev
- libcurl4-openssl-dev
- libltdl-dev
- libpng-dev
- libpspell-dev
- libreadline6
- libreadline6-dev
- name: Clone PHP7
sudo: false
git: repo=https://git.php.net/repository/php-src.git dest=/home/vagrant/php-src
- name: Create a few directories
file: path=/etc/php7/{{ item }} recurse=true state=directory
with_items:
- conf.d
- cli/conf.d
- fpm/conf.d
- /usr/local/php7
- name: Run buildconf
sudo: false
shell: ./buildconf
args:
chdir: /home/vagrant/php-src
- name: Configure the build.
sudo: false
shell: ./configure {{ php7_configure_string }}
args:
chdir: /home/vagrant/php-src
- name: Configure the cli build.
sudo: false
shell: ./configure {{ php7_cli_configure_string }}
args:
chdir: /home/vagrant/php-src
- name: Build PHP7
sudo: false
shell: make
args:
chdir: /home/vagrant/php-src
- name: Install PHP7
shell: make install
args:
chdir: /home/vagrant/php-src
php7_configure_string: --prefix=/usr/local/php7 --enable-bcmath --with-bz2 --enable-calendar --enable-exif --enable-dba --enable-ftp --with-gettext --with-gd --enable-mbstring --with-mcrypt --with-mhash --enable-mysqlnd --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-openssl --enable-pcntl --with-pspell --enable-shmop --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-zlib --enable-zip --with-readline --with-curl
php7_cli_configure_string: --with-config-file-path=/etc/php7/cli --with-config-file-scan-dir=/etc/php7/cli/conf.d
@woecifaun

This comment has been minimized.

Copy link

@woecifaun woecifaun commented Aug 9, 2015

Hello,

Your Create a few directories task should look like this, shouldn't it?

- name: Create a few directories
  file: path={{ item }} recurse=true state=directory
  with_items:
    - /etc/php7/conf.d
    - /etc/php7/cli/conf.d
    - /etc/php7/fpm/conf.d
    - /usr/local/php7

Otherwise you end up with a /etc/php7/usr/local/php7 directory and the /usr/local/php7 directory is not created. Is that what you wanted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment