Hi,
I'd like to open a discussion about a new PHP extension named PCS.
PCS stands for 'PHP Code Service' and it is (yet) another way to mix C
and PHP code in extensions.
Some months ago (January 2015), we had come to the conclusion that two
issues needed to be solved : allow the PHP code to be opcache-d, and
avoid loading every script at RINIT. PCS proposes a solution for both
via a stream wrapper and an autoloader.
During this discussion, it also became clear that two different sources
of PHP scripts should be supported : some want to embed and distribute
scripts in the compiled module, and others want to store them in a
separate location on the host. So, PCS supports both architectures or
even a mix of both.
The documentation is available at http://pcs.tekwire.net :
- the 'Introduction' document details the pros and cons of the different
approaches, - and a tutorial describes in details how to embed the MongoDB PHP
library in the MongoDB C extension.
If this discussion results in a positive consensus, and because PCS may
potentially be used to rewrite parts of core extensions from C to PHP,
I'll write an RFC proposing to include it in the 7.1 core distrib.
Note : don't use the 'pecl install' command to get PCS, download from
PECL. I still need to find a workaround for the 'pecl' command bug.
Regards
François
Hi Francois,
On Wed, Dec 2, 2015 at 10:44 PM, François Laupretre francois@php.net
wrote:
Hi,
I'd like to open a discussion about a new PHP extension named PCS.
PCS stands for 'PHP Code Service' and it is (yet) another way to mix C and
PHP code in extensions.Some months ago (January 2015), we had come to the conclusion that two
issues needed to be solved : allow the PHP code to be opcache-d, and avoid
loading every script at RINIT. PCS proposes a solution for both via a
stream wrapper and an autoloader.During this discussion, it also became clear that two different sources of
PHP scripts should be supported : some want to embed and distribute scripts
in the compiled module, and others want to store them in a separate
location on the host. So, PCS supports both architectures or even a mix of
both.The documentation is available at http://pcs.tekwire.net :
- the 'Introduction' document details the pros and cons of the different
approaches,- and a tutorial describes in details how to embed the MongoDB PHP library
in the MongoDB C extension.If this discussion results in a positive consensus, and because PCS may
potentially be used to rewrite parts of core extensions from C to PHP, I'll
write an RFC proposing to include it in the 7.1 core distrib.
we already chatted about PCS privately, again here I want to mention my
support for this kind of solution. I think its very valuable to have this
kind of support available in PHP to ship PHP code in C extensions. Huge +1
from me for the work, i'd love to see this in PHP 7.1
Note : don't use the 'pecl install' command to get PCS, download from
PECL. I still need to find a workaround for the 'pecl' command bug.Regards
François
Hi François,
Hi,
I'd like to open a discussion about a new PHP extension named PCS.
PCS stands for 'PHP Code Service' and it is (yet) another way to mix C
and PHP code in extensions.Some months ago (January 2015), we had come to the conclusion that two
issues needed to be solved : allow the PHP code to be opcache-d, and avoid
loading every script at RINIT. PCS proposes a solution for both via a
stream wrapper and an autoloader.During this discussion, it also became clear that two different sources
of PHP scripts should be supported : some want to embed and distribute
scripts in the compiled module, and others want to store them in a separate
location on the host. So, PCS supports both architectures or even a mix of
both.The documentation is available at http://pcs.tekwire.net :
- the 'Introduction' document details the pros and cons of the different
approaches,- and a tutorial describes in details how to embed the MongoDB PHP
library in the MongoDB C extension.If this discussion results in a positive consensus, and because PCS may
potentially be used to rewrite parts of core extensions from C to PHP, I'll
write an RFC proposing to include it in the 7.1 core distrib.Note : don't use the 'pecl install' command to get PCS, download from
PECL. I still need to find a workaround for the 'pecl' command bug.
Very nice work! :)
For the core and to begin with, I would however prefer a very focused
feature, to allow to bundle php code in an extension binary and make it
available to userland, including opcache support (what is missing now). Any
other features, while being useful in some situations, will make it harder
to maintain and may be the next phar. Also many of these features could
live well in an external extensions keeping the core part simple.
Cheers,
Pierre