Skip to content

Commit

Permalink
Fix xdebug on Windows WSL
Browse files Browse the repository at this point in the history
  • Loading branch information
kasteckis committed Jan 12, 2023
1 parent 177c172 commit 91da633
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
18 changes: 4 additions & 14 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
# Use image which contains apache with php
FROM php:8.1.2-apache
FROM php:8.2-apache
RUN apt-get update && apt-get upgrade -y
# Install packages needed to install php extensions
RUN apt-get install git zlib1g-dev libxml2-dev libzip-dev zip unzip -y
# Install PHP extensions
RUN docker-php-ext-install zip intl mysqli pdo pdo_mysql opcache
# Install NPM
RUN apt-get install npm -y
# Upgrade npm to latest version
RUN npm install -g npm
# Install node manager - n
RUN npm install -g n
# Install latest stable node version
RUN n stable
# Install latest stable Yarn
RUN npm install --global yarn
# Install XDEBUG
RUN pecl install xdebug-3.1.3 && docker-php-ext-enable xdebug
RUN pecl install xdebug
# Enable XDEBUG
RUN docker-php-ext-enable xdebug
# Install composer command
RUN curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/local/bin/composer
# Install symfony command
RUN curl -sS https://get.symfony.com/cli/installer | bash && mv /root/.symfony/bin/symfony /usr/local/bin/symfony
# Set umask to 0000 (newly created files will have 777 permissions)
RUN echo "umask 0000" >> /root/.bashrc
5 changes: 3 additions & 2 deletions .docker/php/conf.d/xdebug.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
zend_extension=xdebug

[xdebug]
xdebug.mode=develop,debug
xdebug.client_host=host.docker.internal
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.client_port=9003
xdebug.client_host=host.docker.internal
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3"
version: "3.8"
services:
mysql:
image: mysql:8.0
Expand All @@ -11,6 +11,7 @@ services:
MYSQL_PASSWORD: project
ports:
- "3306:3306"

phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: project_phpmyadmin
Expand Down
11 changes: 11 additions & 0 deletions public/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

echo "You should put some breakpoints in your IDE";

$something = 4 + 5;

echo " to check if XDEBUG works." . PHP_EOL;

$somethingAgain = 9 + 5 + $something;

echo "I can assure you it works on my machine (:";

0 comments on commit 91da633

Please sign in to comment.