vagrant up by apache user

Install centos 6 on vagrant + virtualbox and make it php’s local development environment.

If you use vagrant, the execution user becomes ‘vagrant’, but is it possible to make it ‘apache’?

I created ssh.config in the directory where vagrantFile exists and tried to make user ‘apache’, but it did not work.

<?php exec("whoiam"); ?>  return 'vagrant'

The reason for this is because the executing user of the production environment is ‘apache’, so we want to match the local development environment with the production environment.


Source: stackoverflow-php

Phansible installing incorrect PHP5-FPM

Utilizing Phansible I’ve managed to fix all the bugs to bring up a LEMP stack properly.

I have ran php -v and 5.6.30 for CLI is installed.
However when I ran through the forward nginx web – I am getting errors.
With phpinfo(); from the web I have discovered that php5-fpm is set and that is on native ubuntu 5.5.9.

PHP 5.6 did get installed under /usr/sbin/php-fpm5.6 however.
How do i get the correct version of PHP installed both for CLI (currently working) and fpm (currently not work) within ansible playbook rather than copying files over since I have to distribute this vagrant ansible setup across projects.


Source: stackoverflow-php

Cannot mount volume in docker

I am trying to use docker-compose to mount my local directory a new directory at the root level on my docker container. Supposedly this is quite a simple thing to do.

This is what my docker-compose file looks like:


version: '2'
services:
web:
build: ./docker/web/
expose:
- 80
volumes:
- .:/contracts

The Dockerfile in docker/web literally looks like this (I plan to do more later):

FROM php:5.6-apache
RUN /contracts/provision/web.sh

But I keep getting the error that web.sh cannot be found. Putting various ls commands and the like in my Dockerfile show that no such directory called “contracts” is being created on the container. If I try with an existing directly like mnt, I get the same result – the directory remains empty.

But a vagrant inspect shows that it is apparently mounted!

    "Mounts": [
        {
            "Type": "bind",
            "Source": "/vagrant",
            "Destination": "/contracts",
            "Mode": "rw",
            "RW": true,
            "Propagation": ""
        }
    ],

I am running docker-compose on a vagrant box running Ubuntu 14.04.

Any help would be hugely appreciated, I am at the end of my tether. Thanks!


Source: stackoverflow-php