I just wrote this: https://fedoraproject.org/wiki/Changes/Php56
Please comment. I plan to submit it really soon.
Remi.
Another small change which could happen in F21
Numeric prefix for configuration file.
Problem:
- in upstream PHP, extensions are load in any order with RTLD_LAZY (no no symbol resolution required), then extensions are initialized in the correct order (according to dependencies, included in extension description internal structure).
- in our RPM, extension must be load in correct order (with RTLD_NOW, all symbol must be satisfied at load time, for security reason).
For now, alphabetical order is used, but is sometime really messy...
Example: mysqlnd.ini mysqlnd_mysqli.ini mysqlnd_mysql.ini
k-uopz.ini (to be loaded before opcache)
z-event.ini (after sockets) z-mailparse.ini (after mbstring) z-memcached.ini (after json, igbinary and msgpack) etc
Proposal (default rule)
Main PHP, for zend extensions (only opcache) 10-foo.ini
Main PHP, for other extensions 20-foo.ini
Pecl extensions 30-foo.ini (if no dependency)
Notice : a pecl extension, without numerical prefix will be load after, so should not raise any order issue.
Example: 05-uopz.ini (before opcache) 10-opcache.ini (default rule) 15-xdebug.ini (after opcache) ... 20-mbstring.ini (default) 20-sockets.ini (default) 30-event.ini (default pecl, after sockets) 30-igbinary.ini (default pecl) 30-mailparse.ini (default pecl, and after mbstring) 30-msgpack.ini (default pecl) 40-memcached.ini (after json, igbinary and msgpack) ...
How to Find dependencies
From sources:
$ grep ZEND_MOD_ *.c *.h php_memcached.c: ZEND_MOD_REQUIRED("session") php_memcached.c: ZEND_MOD_REQUIRED("igbinary") php_memcached.c: ZEND_MOD_REQUIRED("msgpack") php_memcached.c: ZEND_MOD_REQUIRED("spl")
And also checked in the minimal load test (the more reliant): $ php -n -d extension=foo.so -m
Comments ?
Remi
On Thu, Apr 03, 2014 at 09:19:47AM +0200, Remi Collet wrote:
Proposal (default rule)
Main PHP, for zend extensions (only opcache) 10-foo.ini
Main PHP, for other extensions 20-foo.ini
Pecl extensions 30-foo.ini (if no dependency)
+1 to this, I regret not using this when first packaging /etc/php.d/*.
Regards, Joe
Le 03/04/2014 09:19, Remi Collet a écrit :
Numeric prefix for configuration file.
FPC ticket: https://fedorahosted.org/fpc/ticket/420
Remi.
Le 09/04/2014 11:15, Remi Collet a écrit :
Le 03/04/2014 09:19, Remi Collet a écrit :
Numeric prefix for configuration file.
FPC ticket: https://fedorahosted.org/fpc/ticket/420
Updated guidelines:
https://fedoraproject.org/wiki/Packaging:PHP#C_extensions_and_PECL_packages_...
php-5.5.11-2 is built in rawhide with this change.
I have start to rebuild some extensions, among my packages (mostly to save time when the php 5.6 mass rebuild will occurs).
If you need sample, see amqp, apcu, event, igbinary, xdebug...
Remi.
Another change proposal.
===== /etc/httpd/conf.d/php.conf ===== => provided by both php and php-fpm packages
# # The following lines prevent .user.ini files from being viewed by Web clients. # <Files ".user.ini"> Require all denied </Files>
# # Allow php to handle Multiviews # AddType text/html .php
# # Add index.php to the list of files that will be served as directory # indexes. # DirectoryIndex index.php
# mod_php options <IfModule mod_php5.c> # # Cause the PHP interpreter to handle files with a .php extension. # <FilesMatch .php$> SetHandler application/x-httpd-php </FilesMatch>
# # Uncomment the following lines to allow PHP to pretty-print .phps # files as PHP source code: # #<FilesMatch .phps$> # SetHandler application/x-httpd-php-source #</FilesMatch>
# # Apache specific PHP configuration options # those can be override in each configured vhost # php_value session.save_handler "files" php_value session.save_path "/var/lib/php/session" php_value soap.wsdl_cache_dir "/var/lib/php/wsdlcache" </IfModule>
===== /etc/httpd/conf.d/php-fpm.conf ===== => provided by php-fpm package
<IfModule !mod_php5.c> # # Cause the PHP interpreter to handle files with a .php extension. # <FilesMatch .php$> SetHandler "proxy:fcgi://127.0.0.1:9000" </FilesMatch> </IfModule>
Benefit: web applications could then require Apache AND (php OR php-fpm) and admin can switch from httpd prefork MPM + mod_php to httpd threaded MPM (worker or event) + php-fpm.
- except if using http authentication (ex: phpMyAdmin, which could be easily changed to work with php-fpm)
- if using php_value, php_flag, those directives need to be conditionalized, and also defined in .user.ini file for php-fpm.
Comments ?
Remi.
On Thu, Apr 03, 2014 at 09:35:37AM +0200, Remi Collet wrote:
<IfModule !mod_php5.c> # # Cause the PHP interpreter to handle files with a .php extension. # <FilesMatch .php$> SetHandler "proxy:fcgi://127.0.0.1:9000" </FilesMatch>
</IfModule>
All sounds good to me too. php-fpm will need to Requires: the patched version of httpd.
Are the SELinux rules set up so connections to TCP port 9000 are allowed by default from httpd?
Regards, Joe
Le 03/04/2014 10:58, Joe Orton a écrit :
Are the SELinux rules set up so connections to TCP port 9000 are allowed by default from httpd?
Yes, port 9000 have default "http_port_t" context, so this allow connection with SELinux enabled.
Remi
php-devel@lists.fedoraproject.org