diff mbox

[3/6] php: enable opcache extension in php.ini if selected

Message ID 1431978724-25081-3-git-send-email-bos@je-eigen-domein.nl
State Accepted
Commit ccbeeb8a8cf1157eaf01550d4d6b479883bbcae7
Headers show

Commit Message

Floris Bos May 18, 2015, 7:52 p.m. UTC
Add a line to load the opcache extension in php.ini, at the
bottom of the "dynamic extensions" section.

Signed-off-by: Floris Bos <bos@je-eigen-domein.nl>
---
 package/php/php.mk | 3 +++
 1 file changed, 3 insertions(+)

Comments

Thomas Petazzoni May 18, 2015, 8:36 p.m. UTC | #1
Dear Floris Bos,

On Mon, 18 May 2015 21:52:01 +0200, Floris Bos wrote:
> Add a line to load the opcache extension in php.ini, at the
> bottom of the "dynamic extensions" section.
> 
> Signed-off-by: Floris Bos <bos@je-eigen-domein.nl>
> ---
>  package/php/php.mk | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/package/php/php.mk b/package/php/php.mk
> index c36a80c..65d5015 100644
> --- a/package/php/php.mk
> +++ b/package/php/php.mk
> @@ -296,6 +296,9 @@ define PHP_INSTALL_FIXUP
>  		$(TARGET_DIR)/etc/php.ini
>  	$(SED) 's%;date.timezone =.*%date.timezone = $(PHP_LOCALTIME)%' \
>  		$(TARGET_DIR)/etc/php.ini
> +	$(if $(BR2_PACKAGE_PHP_EXT_OPCACHE),
> +		$(SED) '/;extension=php_xsl.dll/azend_extension=opcache.so' \

Why are you replacing the extension=php_xsl.dll line specifically?

If you're only looking at adding an extension, what about:

	$(if $(BR2_PACKAGE_PHP_EXT_OPCACHE),
		grep -q ^azend_extension=opcache.so $(TARGET_DIR)/etc/php.ini || \
			echo azend_extension=opcache.so >> $(TARGET_DIR)/etc/php.ini)

I don't know it's a few more lines, but it seems more "correct" than
hijacking some random line from php.ini, no?

Thanks,

Thomas
Floris Bos May 18, 2015, 8:48 p.m. UTC | #2
Dear Thomas,

On 05/18/2015 10:36 PM, Thomas Petazzoni wrote:
> On Mon, 18 May 2015 21:52:01 +0200, Floris Bos wrote:
>> Add a line to load the opcache extension in php.ini, at the
>> bottom of the "dynamic extensions" section.
>>
>> Signed-off-by: Floris Bos <bos@je-eigen-domein.nl>
>> ---
>>   package/php/php.mk | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/package/php/php.mk b/package/php/php.mk
>> index c36a80c..65d5015 100644
>> --- a/package/php/php.mk
>> +++ b/package/php/php.mk
>> @@ -296,6 +296,9 @@ define PHP_INSTALL_FIXUP
>>   		$(TARGET_DIR)/etc/php.ini
>>   	$(SED) 's%;date.timezone =.*%date.timezone = $(PHP_LOCALTIME)%' \
>>   		$(TARGET_DIR)/etc/php.ini
>> +	$(if $(BR2_PACKAGE_PHP_EXT_OPCACHE),
>> +		$(SED) '/;extension=php_xsl.dll/azend_extension=opcache.so' \
> Why are you replacing the extension=php_xsl.dll line specifically?

I am not.

"/a" means Append line after the range specified.
Replacing would be done with the "s" from Substitute instead.


Yours sincerely,

Floris Bos
Thomas Petazzoni May 18, 2015, 8:53 p.m. UTC | #3
Floris,

On Mon, 18 May 2015 22:48:27 +0200, Floris Bos wrote:

> >> +	$(if $(BR2_PACKAGE_PHP_EXT_OPCACHE),
> >> +		$(SED) '/;extension=php_xsl.dll/azend_extension=opcache.so' \
> > Why are you replacing the extension=php_xsl.dll line specifically?
> 
> I am not.
> 
> "/a" means Append line after the range specified.
> Replacing would be done with the "s" from Substitute instead.

Ah, indeed, my bad. For some reason, I had in my mind that if you're
using sed, you must be replacing an existing line.

So, I'm fine with your proposal.

Thomas
Peter Korsgaard May 19, 2015, 7:41 p.m. UTC | #4
>>>>> "Floris" == Floris Bos <bos@je-eigen-domein.nl> writes:

 > Add a line to load the opcache extension in php.ini, at the
 > bottom of the "dynamic extensions" section.

 > Signed-off-by: Floris Bos <bos@je-eigen-domein.nl>

Committed, thanks.
diff mbox

Patch

diff --git a/package/php/php.mk b/package/php/php.mk
index c36a80c..65d5015 100644
--- a/package/php/php.mk
+++ b/package/php/php.mk
@@ -296,6 +296,9 @@  define PHP_INSTALL_FIXUP
 		$(TARGET_DIR)/etc/php.ini
 	$(SED) 's%;date.timezone =.*%date.timezone = $(PHP_LOCALTIME)%' \
 		$(TARGET_DIR)/etc/php.ini
+	$(if $(BR2_PACKAGE_PHP_EXT_OPCACHE),
+		$(SED) '/;extension=php_xsl.dll/azend_extension=opcache.so' \
+		$(TARGET_DIR)/etc/php.ini)
 endef
 
 PHP_POST_INSTALL_TARGET_HOOKS += PHP_INSTALL_FIXUP