PHP7 with almost everything that you may need.
Run docker-composer -up
and access http://localhost:8080
(NGINX) or http://localhost:8000
(Caddy).
NOTE: The container will run with user
www-data
, that is a non-root user, if you need access the container as root rundocker exec -u 0 -it php-fpm sh
.
To enable New Relic Agent, you must pass set the env NEWRELIC_ENABLED
and NEWRELIC_LICENSE
. Other params is also available, check the Dockerfile for more details.
The container is configured to run the file that bootstrap applications in folder /app/public
, because I use Laravel/Lumen by default, so, if you don't use a framework that bootstrap the application in this folder, you must put your source files there.
To the debug works, you must:
-
Set your local IP address in
XDEBUG_HOST
environment variable indocker-compose.yml
. -
Configure your editor/IDE to map the local source and the remote source.
You need configure your editor/IDE to map the local source and where is the remote source.
Install PHP Debug Extension.
Put this config in your launch.json
:
NOTE this example will map the local folder app, to
/app
on the container. Remenber that container is configured to boostrap in/app/public
, as the example provided in this repo
//launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "XDebug",
"type": "php",
"request": "launch",
"port": 9000,
"pathMappings": {
"/app": "${workspaceRoot}"
},
"ignore": ["**/vendor/**/*.php"]
}
]
}
Install XDebug Client
Create a sublime-project in Project > Save Project As...
Paste the config as bellow in created file, and ensure that path_mapping
is mapping the full path to your source, eg: C:\my\source
, /Users/user/my/source
, /home/user/source
, etc...:
{
"folders": [
{
"follow_symlinks": true,
"path": "."
}
],
"settings": {
"xdebug": {
"url": "http://localhost:8080",
"path_mapping": {
"/app" : "/full/path/to/your/source"
}
}
}
}
Intall this extension, go to Settings > Open Config Folder
and put in your config.cson
:
"php-debug":
PathMaps: [
"remotepath;localpath"
"/app;/path/to/your/local/source"
]
Configuration is in two parts:
Configuring a Server: Preferences > Languages & Frameworks > PHP > Servers
Configuring a new PHP Remote Debugger: Run > Edit Configurations
click in +
and PHP Remote Debugger
License BSD 3-Clause
BSD 3-Clause License
Copyright (c) 2017, Juliano Petronetto
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.