1

What I want

I have project, where don't have docker/docker-compose. I want run PHP scripts - PHPUnit by terminal. Best would be working with PhpStorm.

What I have

File docker-phpez

#!/usr/bin/env bash
# echo "Current working directory: '"$(pwd)"'"
docker run --rm -v $(pwd):/var/www -e SYMFONY_ENV=dev ezsystems/php:7.1-v1 php $@

Result

Checking version

Run this docker-phpez -v, give me:

PHP 7.1.6 (cli) (built: Jun 12 2017 21:35:13) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.1.6, Copyright (c) 1999-2017, by Zend Technologies
    with blackfire v1.17.1~linux-x64-non_zts71, https://blackfire.io, by SensioLabs

Then this is correct.

Checking mount

When I run listing (modify files) then, I see all needed files.

Run PHPUnit

When I try to run, it see config file in main folder, but won't see bootstrap file in path:

PHP Warning:  include(/var/www/src/Tests/../../vendor/ezsystems/ezpublish-kernel/config.php): failed to open stream: No such file or directory in /var/www/src/Tests/bootstrap.php on line 3

Question:

  • why PHP inside container don't see this file, when I see this running inside ls /var/www/src/Tests ?

Update v1:

running pwd

docker run --rm -v $(pwd):/var/www -e SYMFONY_ENV=dev ezsystems/php:7.1-v1 pwd

give:

/var/www

running ls

docker run --rm -v $(pwd):/var/www -e SYMFONY_ENV=dev ezsystems/php:7.1-v1 ls

give list of all files/folders in current folder.

Composer

docker run --rm -v $(pwd):/var/www -e SYMFONY_ENV=dev ezsystems/php:7.1-v1 composer install

run correctly and install all data.

All command are run in MAIN folder of project

1 Answer 1

1

This:

/var/www/src/Tests/../../vendor/ezsystems/ezpublish-kernel/config.php

is translated to:

/var/www/vendor/ezsystems/ezpublish-kernel/config.php

Because of ../..

You are not looking there.

Sign up to request clarification or add additional context in comments.

6 Comments

ok, do you know, how to add that php should see main catalog? and needed file would be visible?
It depends on where you have put the vendor and maybe the rest of the app. Also check whether you are running the tests from the wrong working directory.
So, do you have this /var/www/vendor/?
yes, running run --rm -v $(pwd):/var/www -e SYMFONY_ENV=dev ezsystems/php:7.1-v1 ls vendor/ or docker run --rm -v $(pwd):/var/www -e SYMFONY_ENV=dev ezsystems/php:7.1-v1 ls /var/www/vendor give same result - content of vendor from localmachine.
find out, that problem was not configuration itselt, but vendor + composer had bug. My mistake - i'm blind. The file wasn't creating as it should. thanks for efford.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.