Skip to content

Commit 37d7f53

Browse files
authored
[plugin] Add php.ini in the PHP plugin (#1039)
## Summary Adds an editable `php.ini` to the PHP plugin. This is useful when developers need to configure their PHP instance, and by creating it in `devbox.d` we let developers customize it for each of their PHP projects. This addresses #1035 and the issue reported by @jrseliga ## How was it tested? * On a clean PHP project, run `devbox add php@latest` and verify that the php.ini file is created in devbox.d * Also check the updated example in this PR
1 parent 7e29b6b commit 37d7f53

File tree

12 files changed

+110
-14
lines changed

12 files changed

+110
-14
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Automatically sets up your devbox environment whenever you cd into this
2+
# directory via our direnv integration:
3+
4+
eval "$(devbox generate direnv --print-envrc)"
5+
6+
# check out https://www.jetpack.io/devbox/docs/ide_configuration/direnv/
7+
# for more details
File renamed without changes.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[php]
2+
3+
; Put your php.ini directives here. For the latest default php.ini file, see https://github.com/php/php-src/blob/master/php.ini-production
4+
5+
; memory_limit = 128M
6+
; expose_php = Off
7+
8+
xdebug.mode = debug
Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
11
{
2-
"packages": [
3-
"php81",
4-
"php81Packages.composer",
5-
"phpExtensions.imagick"
2+
"packages": [
3+
"php81Packages.composer@latest",
4+
"php81Extensions.xdebug@latest",
5+
"php81Extensions.imagick@latest",
6+
7+
],
8+
"env": {
9+
"PHPRC": "$PWD/devbox.d/php"
10+
},
11+
"shell": {
12+
"init_hook": [
13+
"composer install"
614
],
7-
"shell": {
8-
"init_hook": [
9-
"composer install"
10-
],
11-
"run_test": [
12-
"php public/index.php"
13-
]
15+
"scripts": {
16+
"run_test": "php public/index.php"
1417
}
18+
},
19+
"nixpkgs": {
20+
"commit": "f80ac848e3d6f0c12c52758c0f25c10c97ca3b62"
21+
}
1522
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"lockfile_version": "1",
3+
"packages": {
4+
"php81Extensions.imagick@latest": {
5+
"last_modified": "2023-05-01T16:53:22Z",
6+
"resolved": "github:NixOS/nixpkgs/8670e496ffd093b60e74e7fa53526aa5920d09eb#php81Extensions.imagick",
7+
"version": "3.7.0"
8+
},
9+
"php81Extensions.xdebug@latest": {
10+
"last_modified": "2023-05-01T16:53:22Z",
11+
"resolved": "github:NixOS/nixpkgs/8670e496ffd093b60e74e7fa53526aa5920d09eb#php81Extensions.xdebug",
12+
"version": "3.2.1"
13+
},
14+
"php81Packages.composer@latest": {
15+
"last_modified": "2023-05-01T16:53:22Z",
16+
"resolved": "github:NixOS/nixpkgs/8670e496ffd093b60e74e7fa53526aa5920d09eb#php81Packages.composer",
17+
"version": "2.5.5"
18+
},
19+
20+
"last_modified": "2023-05-01T16:53:22Z",
21+
"plugin_version": "0.0.1",
22+
"resolved": "github:NixOS/nixpkgs/8670e496ffd093b60e74e7fa53526aa5920d09eb#php",
23+
"version": "8.1.18"
24+
}
25+
}
26+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
<?php
22

33
echo 'Hello world';
4+
5+
phpinfo();

examples/stacks/drupal/.envrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Automatically sets up your devbox environment whenever you cd into this
2+
# directory via our direnv integration:
3+
4+
eval "$(devbox generate direnv --print-envrc)"
5+
6+
# check out https://www.jetpack.io/devbox/docs/ide_configuration/direnv/
7+
# for more details
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[php]
2+
3+
; Put your php.ini directives here. For the latest default php.ini file, see https://github.com/php/php-src/blob/master/php.ini-production
4+
5+
memory_limit = 512M
6+
; expose_php = Off

examples/stacks/drupal/devbox.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,25 @@
66
"php81Packages.composer",
77
"nginx"
88
],
9+
"env": {
10+
"PHPRC": "$PWD/devbox.d/php81"
11+
},
912
"shell": {
1013
"init_hook": [
1114
"source devbox.d/mysql/set-env.sh"
1215
],
1316
"scripts": {
1417
"run_test": [
1518
"devbox.d/mysql/mysql.sh",
16-
"devbox services start",
19+
"devbox services up -b",
1720
"./install-drupal.sh",
1821
"curl localhost:8000",
1922
"devbox services stop",
2023
"mysqladmin -u root --socket=$MYSQL_UNIX_PORT shutdown"
2124
],
2225
"start_services": [
2326
"devbox.d/mysql/mysql.sh",
24-
"devbox services start"
27+
"devbox services up"
2528
],
2629
"stop_services": [
2730
"devbox services stop",

examples/stacks/drupal/devbox.lock

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"lockfile_version": "1",
3+
"packages": {
4+
"git": {
5+
"resolved": "github:NixOS/nixpkgs/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62#git"
6+
},
7+
"mariadb": {
8+
"resolved": "github:NixOS/nixpkgs/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62#mariadb"
9+
},
10+
"nginx": {
11+
"plugin_version": "0.0.1",
12+
"resolved": "github:NixOS/nixpkgs/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62#nginx"
13+
},
14+
"php81": {
15+
"plugin_version": "0.0.1",
16+
"resolved": "github:NixOS/nixpkgs/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62#php81"
17+
},
18+
"php81Packages.composer": {
19+
"resolved": "github:NixOS/nixpkgs/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62#php81Packages.composer"
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)