Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #53, #60: Fix php.ini not applied for php-fpm on ubuntu #83

Merged
merged 1 commit into from
Feb 20, 2016

Conversation

oxyc
Copy link
Contributor

@oxyc oxyc commented Feb 20, 2016

This is a mergable PR for #82. I want to keep the old PR for historical reference in case we need to do similar scenario testing again. This works for all distros:

  • Apache with mod_php
  • Apache with PHP FPM (not on Centos 6 because the test setup is complex, this bug fix doesnt adress centos anyway)
  • Nginx with PHP FPM
  • No webserver (applies to the CLI php).

I feel this is the best approach as a configuration change and a re-provision would create the new ini only if necessary. Instead of bloating the configs or complicating the role unnecessarily (trying to create apc/opcache ini files for all directories would be a nasty with_nested task).

The docker build for PHP FPM only pass on Ubuntu 14.04 with the custom initctl mentioned here. Ubuntu 12.04 fails in the same way as in the before mentioned task. But the ini directories are the same for both 12.04 and 14.04.

CentoOS 6 tests for Apache with PHP FPM fail because of geerlingguy/drupal-vm#346 (comment)

The only questionable addition would be to somehow support libapache2-mod-fastcgi. This would mean detecting if the package is installed and if so, creating the php.ini in /etc/php5/cgi/php.ini instead.

@geerlingguy
Copy link
Owner

Is the idempotence failure something having to do with the service task?

And thanks so much for this work so far—making my weekend and the next Drupal VM much easier!

@oxyc
Copy link
Contributor Author

oxyc commented Feb 20, 2016

Hmm that's odd... let's see what's causing it.

@geerlingguy
Copy link
Owner

It looks like the two tasks that break idempotency are:

TASK [geerlingguy.php : Place APC configuration file in place.] ****************
changed: [ubuntu1404]

TASK [geerlingguy.php : Place OpCache configuration file in place.] ************
changed: [ubuntu1404]

(Doing some local testing on VMWare).

After the second run, everything's good to go :/

@oxyc
Copy link
Contributor Author

oxyc commented Feb 20, 2016

Hmm very strange O.o I don't see how this commit good have caused that. Unfortunately I wont be able to test this more today. Hope you can figure out what's going on.

@geerlingguy
Copy link
Owner

Found it - Debian/Ubuntu configuration insanity strikes again!

Here's what the config directory looks like immediately after PHP's first installation/fpm starts up:

vagrant@ubuntu1404test:/etc/php5/cli/conf.d$ ls -lah
total 8.0K
drwxr-xr-x 2 root root 4.0K Feb 20 22:24 .
drwxr-xr-x 3 root root 4.0K Feb 20 22:24 ..
lrwxrwxrwx 1 root root   32 Feb 20 22:24 05-opcache.ini -> ../../mods-available/opcache.ini
lrwxrwxrwx 1 root root   28 Feb 20 22:24 10-pdo.ini -> ../../mods-available/pdo.ini
lrwxrwxrwx 1 root root   29 Feb 20 22:24 20-apcu.ini -> ../../mods-available/apcu.ini
lrwxrwxrwx 1 root root   29 Feb 20 22:24 20-curl.ini -> ../../mods-available/curl.ini
lrwxrwxrwx 1 root root   27 Feb 20 22:24 20-gd.ini -> ../../mods-available/gd.ini
lrwxrwxrwx 1 root root   29 Feb 20 22:24 20-json.ini -> ../../mods-available/json.ini
lrwxrwxrwx 1 root root   31 Feb 20 22:24 20-mcrypt.ini -> ../../mods-available/mcrypt.ini
lrwxrwxrwx 1 root root   33 Feb 20 22:24 20-readline.ini -> ../../mods-available/readline.ini

Note that those are all symlinks to files inside mods-available.

After the first provision, that's still the structure of that directory. But after the second provision, the templated files are copied into place (since we have force: yes).

I'm going to fiddle with the ordering.

Edit: Here's the before/after:

05-opcache.ini  10-pdo.ini  20-apcu.ini  20-curl.ini  20-gd.ini  20-json.ini  20-mcrypt.ini  20-readline.ini
vagrant@ubuntu1404test:/etc/php5/cli/conf.d$ ls -lah
total 8.0K
drwxr-xr-x 2 root root 4.0K Feb 20 22:33 .
drwxr-xr-x 3 root root 4.0K Feb 20 22:33 ..
lrwxrwxrwx 1 root root   32 Feb 20 22:33 05-opcache.ini -> ../../mods-available/opcache.ini
lrwxrwxrwx 1 root root   28 Feb 20 22:33 10-pdo.ini -> ../../mods-available/pdo.ini
lrwxrwxrwx 1 root root   29 Feb 20 22:33 20-apcu.ini -> ../../mods-available/apcu.ini
lrwxrwxrwx 1 root root   29 Feb 20 22:33 20-curl.ini -> ../../mods-available/curl.ini
lrwxrwxrwx 1 root root   27 Feb 20 22:33 20-gd.ini -> ../../mods-available/gd.ini
lrwxrwxrwx 1 root root   29 Feb 20 22:33 20-json.ini -> ../../mods-available/json.ini
lrwxrwxrwx 1 root root   31 Feb 20 22:33 20-mcrypt.ini -> ../../mods-available/mcrypt.ini
lrwxrwxrwx 1 root root   33 Feb 20 22:33 20-readline.ini -> ../../mods-available/readline.ini
vagrant@ubuntu1404test:/etc/php5/cli/conf.d$ ls -lah
total 8.0K
drwxr-xr-x 2 root root 4.0K Feb 20 22:33 .
drwxr-xr-x 3 root root 4.0K Feb 20 22:33 ..
lrwxrwxrwx 1 root root   36 Feb 20 22:33 05-opcache.ini -> /etc/php5/mods-available/opcache.ini
lrwxrwxrwx 1 root root   28 Feb 20 22:33 10-pdo.ini -> ../../mods-available/pdo.ini
lrwxrwxrwx 1 root root   33 Feb 20 22:33 20-apcu.ini -> /etc/php5/mods-available/apcu.ini
lrwxrwxrwx 1 root root   29 Feb 20 22:33 20-curl.ini -> ../../mods-available/curl.ini
lrwxrwxrwx 1 root root   27 Feb 20 22:33 20-gd.ini -> ../../mods-available/gd.ini
lrwxrwxrwx 1 root root   29 Feb 20 22:33 20-json.ini -> ../../mods-available/json.ini
lrwxrwxrwx 1 root root   31 Feb 20 22:33 20-mcrypt.ini -> ../../mods-available/mcrypt.ini
lrwxrwxrwx 1 root root   33 Feb 20 22:33 20-readline.ini -> ../../mods-available/readline.ini

I tried setting follow: yes on the two tasks so they would follow the symlink. That kind of worked... but Ansible still switched the symlink to an absolute path instead of relative in the 2nd provision. Complicated config symlinks--

@oxyc
Copy link
Contributor Author

oxyc commented Feb 20, 2016

Ugh. I do see what you mean about Ubuntu... I think I'll begin using centos for my base boxes after all this 😄

@geerlingguy
Copy link
Owner

Yay! I have a fix.

@geerlingguy
Copy link
Owner

Adding more tasks for Debian because it's weird--

@geerlingguy geerlingguy merged commit 2982629 into geerlingguy:master Feb 20, 2016
@geerlingguy
Copy link
Owner

We'll see if the fix works; tested 3 times with different settings in 12/14 locally.

This was referenced Feb 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants