Skip to content

Commit 600a615

Browse files
Omranicbestlong
authored andcommitted
Automate xdebug installation and simplify instructions (laradock#1630)
1 parent 4673ba7 commit 600a615

3 files changed

Lines changed: 12 additions & 31 deletions

File tree

DOCUMENTATION/content/documentation/index.md

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -277,44 +277,17 @@ docker-compose build workspace
277277

278278
1 - First install `xDebug` in the Workspace and the PHP-FPM Containers:
279279
<br>
280-
a) open the `docker-compose.yml` file
280+
a) open the `.env` file
281281
<br>
282-
b) search for the `INSTALL_XDEBUG` argument under the Workspace Container
282+
b) search for the `WORKSPACE_INSTALL_XDEBUG` argument under the Workspace Container
283283
<br>
284284
c) set it to `true`
285285
<br>
286-
d) search for the `INSTALL_XDEBUG` argument under the PHP-FPM Container
286+
d) search for the `PHP_FPM_INSTALL_XDEBUG` argument under the PHP-FPM Container
287287
<br>
288288
e) set it to `true`
289289

290-
It should be like this:
291-
292-
```yml
293-
workspace:
294-
build:
295-
context: ./workspace
296-
args:
297-
- INSTALL_XDEBUG=true
298-
...
299-
php-fpm:
300-
build:
301-
context: ./php-fpm
302-
args:
303-
- INSTALL_XDEBUG=true
304-
...
305-
```
306-
307-
2 - Open `laradock/workspace/xdebug.ini` and `laradock/php-fpm/xdebug.ini` and enable at least the following configurations:
308-
309-
```
310-
xdebug.remote_autostart=1
311-
xdebug.remote_enable=1
312-
xdebug.remote_connect_back=0
313-
; NOTE: The dockerhost is your vEthernet (DockerNAT) IP
314-
xdebug.remote_host=dockerhost
315-
```
316-
317-
3 - Re-build the containers `docker-compose build workspace php-fpm`
290+
2 - Re-build the containers `docker-compose build workspace php-fpm`
318291

319292
For information on how to configure xDebug with your IDE and work it out, check this [Repository](https://github.com/LarryEitel/laravel-laradock-phpstorm) or follow up on the next section if you use linux and PhpStorm.
320293

php-fpm/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \
101101
# Copy xdebug configuration for remote debugging
102102
COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
103103

104+
RUN sed -i "s/xdebug.remote_autostart=0/xdebug.remote_autostart=1/" /usr/local/etc/php/conf.d/xdebug.ini && \
105+
sed -i "s/xdebug.remote_enable=0/xdebug.remote_enable=1/" /usr/local/etc/php/conf.d/xdebug.ini && \
106+
sed -i "s/xdebug.cli_color=0/xdebug.cli_color=1/" /usr/local/etc/php/conf.d/xdebug.ini
107+
104108
###########################################################################
105109
# Blackfire:
106110
###########################################################################

workspace/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \
238238
# ADD for REMOTE debugging
239239
COPY ./xdebug.ini /etc/php/${PHP_VERSION}/cli/conf.d/xdebug.ini
240240

241+
RUN sed -i "s/xdebug.remote_autostart=0/xdebug.remote_autostart=1/" /etc/php/${PHP_VERSION}/cli/conf.d/xdebug.ini && \
242+
sed -i "s/xdebug.remote_enable=0/xdebug.remote_enable=1/" /etc/php/${PHP_VERSION}/cli/conf.d/xdebug.ini && \
243+
sed -i "s/xdebug.cli_color=0/xdebug.cli_color=1/" /etc/php/${PHP_VERSION}/cli/conf.d/xdebug.ini
244+
241245
###########################################################################
242246
# Blackfire:
243247
###########################################################################

0 commit comments

Comments
 (0)