Skip to content
This repository has been archived by the owner on Apr 19, 2021. It is now read-only.

[docs] PHP in Gitpod #418

Merged
merged 15 commits into from
Feb 12, 2020
Binary file added src/docs/images/phpDebug.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/docs/languages-and-frameworks.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ Below is a list of language and framework specific tips & tricks.
* [Go](/docs/go-in-gitpod/)
* [Bash](/docs/bash-in-gitpod/)
* [Ruby](/docs/ruby-in-gitpod)
* [PHP](/docs/php-in-gitpod)
* [Rust](/docs/rust-in-gitpod/)
* [Julia](/docs/julia-in-gitpod/)
4 changes: 4 additions & 0 deletions src/docs/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ export const MENU: MenuEntry[] = [
"Ruby",
"ruby-in-gitpod"
),
M(
"PHP",
"php-in-gitpod"
),
M(
"Rust",
"rust-in-gitpod"
Expand Down
55 changes: 55 additions & 0 deletions src/docs/php-in-gitpod.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# PHP in Gitpod

Gitpod Supports PHP right out of the box, but more advanced features such as Debugging and other tooling need to be configured, so here is how to do it!
JesterOrNot marked this conversation as resolved.
Show resolved Hide resolved

## Example Repositories

| Repository | Description | Try it |
|------------|-------------|--------|
| magento2gitpod | Magento 2 optimized setup for Gitpod: Nginx, MySQL, PHP 7.2, PHP-FPM and more | [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/nemke82/magento2gitpod) |
| koel | A personal music streaming server that works | [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/phanan/koel) |
JesterOrNot marked this conversation as resolved.
Show resolved Hide resolved
## VSCode Extensions
### PHP Debug

![](images/phpDebug.gif)
The PHP Debug extension allows debugging PHP applications from within Gitpod.

To add this extension to your repository, you must do two things:
JesterOrNot marked this conversation as resolved.
Show resolved Hide resolved

First you must create a [`.gitpod.Dockerfile`](https://www.gitpod.io/docs/config-docker/):
JesterOrNot marked this conversation as resolved.
Show resolved Hide resolved

```Dockerfile
FROM gitpod/workspace-full

USER gitpod
JesterOrNot marked this conversation as resolved.
Show resolved Hide resolved

RUN sudo apt-get update -q \
&& sudo apt-get install -y php-dev

RUN wget http://xdebug.org/files/xdebug-2.9.1.tgz \
&& tar -xvzf xdebug-2.9.1.tgz \
&& cd xdebug-2.9.1 \
&& phpize \
&& ./configure \
&& make \
&& sudo cp modules/xdebug.so /usr/lib/php/20170718 \
&& sudo bash -c "echo -e '\nzend_extension = /usr/lib/php/20170718/xdebug.so\n[XDebug]\nxdebug.remote_enable = 1\nxdebug.remote_autostart = 1\n' >> /etc/php/7.2/cli/php.ini"
```

Second, reference the above Dockerfile in a [`.gitpod.yml`](https://www.gitpod.io/docs/config-gitpod-file/) file, then also install the extension, like so:
JesterOrNot marked this conversation as resolved.
Show resolved Hide resolved

```yaml
image:
file: .gitpod.Dockerfile
# This is to get rid of the annoying popup feel free to leave this out
ports:
- port: 9000
onOpen: ignore
vscode:
JesterOrNot marked this conversation as resolved.
Show resolved Hide resolved
extensions:
- [email protected]:WX8Y3EpQk3zgahy41yJtNQ==
```

Finally, here is an [example repository](https://github.com/JesterOrNot/Gitpod-PHP-Debug) that contains a full PHP debugging configuration for Gitpod as described above. You can try it by clicking here:
JesterOrNot marked this conversation as resolved.
Show resolved Hide resolved

[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/JesterOrNot/Gitpod-PHP-Debug)