This repository has been archived by the owner on Apr 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sean Hellum
authored
Feb 12, 2020
1 parent
ac32521
commit bb7312c
Showing
4 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# PHP in Gitpod | ||
|
||
Gitpod supports PHP right out of the box, but more advanced features such as debugging can be configured, so here is how to do it! | ||
|
||
## 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) | | ||
| symfony-demo | Symfony Demo Application |[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/gitpod-io/symfony-demo) | ||
## VSCode Extensions | ||
### PHP Debug | ||
|
||
![](images/phpDebug.gif) | ||
The PHP Debug extension allows debugging PHP applications from within Gitpod. | ||
|
||
To get this extension for your project, you must do two things: | ||
|
||
First you must create a [`.gitpod.Dockerfile`](https://www.gitpod.io/docs/config-docker/) for your repository: | ||
|
||
```Dockerfile | ||
FROM gitpod/workspace-full | ||
|
||
|
||
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, and then also install the extension, like so: | ||
|
||
```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: | ||
extensions: | ||
- [email protected]:WX8Y3EpQk3zgahy41yJtNQ== | ||
``` | ||
Finally, here is a full [example repository](https://github.com/JesterOrNot/Gitpod-PHP-Debug) containing the complete Gitpod PHP debug configuration described above. You can try it by clicking here: | ||
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/JesterOrNot/Gitpod-PHP-Debug) | ||
## PECL Package Manager | ||
Gitpod's default workspace image also comes with the [PECL](https://pecl.php.net/) package manager pre-installed. To install packages with it, you must use `sudo pecl install <EXTENSION>` in your repository's [`.gitpod.Dockerfile`](https://www.gitpod.io/docs/config-docker/), e.g. like so: | ||
```Dockerfile | ||
FROM gitpod/workspace-full | ||
RUN sudo pecl channel-update pecl.php.net && \ | ||
sudo pecl install <EXTENSION> | ||
``` | ||
where `<EXTENSION>` is the PHP extension you want to install, e.g. `xdebug`. |