Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use php.ini-development by default instead of production one #36

Closed
Slamdunk opened this issue Apr 30, 2021 · 1 comment · Fixed by #43
Closed

Use php.ini-development by default instead of production one #36

Slamdunk opened this issue Apr 30, 2021 · 1 comment · Fixed by #43
Milestone

Comments

@Slamdunk
Copy link
Contributor

Slamdunk commented Apr 30, 2021

(From shivammathur/setup-php#450, which applies here too.)

Hi, currently this GA leverages Ondřej Surý repositories (https://deb.sury.org/), which select and use the php.ini-production config from php-src, which sets for example error_reporting to E_ALL & ~E_DEPRECATED & ~E_STRICT instead of E_ALL:

$ docker run --rm -it --entrypoint /bin/bash ghcr.io/laminas/laminas-continuous-integration:1.7.1
root@372e50e97cc6:/# grep -rn ^error_reporting /etc/php/
/etc/php/5.6/cli/php.ini:449:error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
/etc/php/7.4/cli/php.ini:465:error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
/etc/php/7.1/cli/php.ini:460:error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
/etc/php/7.0/cli/php.ini:445:error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
/etc/php/8.0/cli/php.ini:486:error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
/etc/php/7.2/cli/php.ini:457:error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
/etc/php/7.3/cli/php.ini:457:error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT

But as a Continuous Integration services, it would be preferable to have the php.ini-development one.

Here's the full diff for PHP 8.0 between the two. You can see that all the differences are worthy for a CI environment:

--- php.ini-production  2021-04-30 09:12:53.773278488 +0200
+++ php.ini-development 2021-04-30 09:12:57.181308089 +0200
@@ -83,7 +83,7 @@
 ; development version only in development environments, as errors shown to
 ; application users can inadvertently leak otherwise secure information.

-; This is the php.ini-production INI file.
+; This is the php.ini-development INI file.

 ;;;;;;;;;;;;;;;;;;;
 ; Quick Reference ;
@@ -376,7 +376,7 @@
 ; Default Value: Off
 ; Development Value: Off
 ; Production Value: On
-zend.exception_ignore_args = On
+zend.exception_ignore_args = Off

 ; Allows setting the maximum string length in an argument of a stringified stack trace
 ; to a value between 0 and 1000000.
@@ -384,9 +384,7 @@
 ; Default Value: 15
 ; Development Value: 15
 ; Production Value: 0
-; In production, it is recommended to set this to 0 to reduce the output
-; of sensitive information in stack traces.
-zend.exception_string_param_max_len = 0
+zend.exception_string_param_max_len = 15

 ;;;;;;;;;;;;;;;;;
 ; Miscellaneous ;
@@ -483,7 +481,7 @@
 ; Development Value: E_ALL
 ; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
 ; http://php.net/error-reporting
-error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
+error_reporting = E_ALL

 ; This directive controls whether or not and where PHP will output errors,
 ; notices and warnings too. Error output is very useful during development, but
@@ -500,7 +498,7 @@
 ; Development Value: On
 ; Production Value: Off
 ; http://php.net/display-errors
-display_errors = Off
+display_errors = On

 ; The display of errors which occur during PHP's startup sequence are handled
 ; separately from display_errors. We strongly recommend you set this to 'off'
@@ -509,7 +507,7 @@
 ; Development Value: On
 ; Production Value: Off
 ; http://php.net/display-startup-errors
-display_startup_errors = Off
+display_startup_errors = On

 ; Besides displaying errors, PHP can also log errors to locations such as a
 ; server-specific log, STDERR, or a location specified by the error_log
@@ -1199,7 +1197,7 @@

 ; Enable / Disable collection of memory usage statistics by mysqlnd which can be
 ; used to tune and monitor MySQL operations.
-mysqlnd.collect_memory_statistics = Off
+mysqlnd.collect_memory_statistics = On

 ; Records communication from all extensions using mysqlnd to the specified log
 ; file.
@@ -1572,7 +1570,7 @@
 ; Development Value: 1
 ; Production Value: -1
 ; http://php.net/zend.assertions
-zend.assertions = -1
+zend.assertions = 1

 ; Assert(expr); active by default.
 ; http://php.net/assert.active
@@ -1882,7 +1880,7 @@

 ; Enables or disables copying of PHP code (text segment) into HUGE PAGES.
 ; This should improve performance, but requires appropriate OS configuration.
-;opcache.huge_code_pages=1
+;opcache.huge_code_pages=0

 ; Validate cached file permissions.
 ;opcache.validate_permission=0
@boesing
Copy link
Member

boesing commented May 25, 2021

I would be +1 on this, even tho we do not align in TSC meeting with the assert usage.

weierophinney added a commit to weierophinney/laminas-continuous-integration-action that referenced this issue Jun 2, 2021
This patch updates the base `php.ini` for each PHP version to provide the following develoment values (assuming that the version supports the setting):

- `zend.exception_ignore_args = Off`
- `zend.exception_string_param_max_len = 15`
- `error_reporting = E_ALL`
- `display_errors = On`
- `display_startup_errors = On`
- `mysqlnd.collect_memory_statistics = On`
- `zend.assertions = 1`

Fixes laminas#36

Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
@weierophinney weierophinney added this to the 1.10.0 milestone Jun 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants