From 9530d7b0f42031ba1aedc1b2914948c3d8c2aebd Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 7 May 2015 08:54:38 +0200 Subject: php70-php: add experimental file based opcode cache --- opcache.ini | 7 +++++++ php-7.0.0-systzdata-v12.patch | 37 ++++++++++++++++++++----------------- php-fpm-www.conf | 1 + php.conf | 2 ++ php.spec | 20 ++++++++++++-------- 5 files changed, 42 insertions(+), 25 deletions(-) diff --git a/opcache.ini b/opcache.ini index 21f16ad..de4377b 100644 --- a/opcache.ini +++ b/opcache.ini @@ -93,3 +93,10 @@ opcache.blacklist_filename=/etc/php.d/opcache*.blacklist ; Useful for internal debugging only. ;opcache.protect_memory=0 +; Experimental file based opcode cache +; RPM note : file cache directory must be owned by process owner +; for mod_php, see /etc/httpd/conf.d/php.conf +; for php-fpm, see /etc/php-fpm.d/*conf +;opcache.file_cache= +;opcache.file_cache_only=0 +;opcache.file_cache_consistency_checks=1 diff --git a/php-7.0.0-systzdata-v12.patch b/php-7.0.0-systzdata-v12.patch index 6232ba2..af5b3a6 100644 --- a/php-7.0.0-systzdata-v12.patch +++ b/php-7.0.0-systzdata-v12.patch @@ -20,9 +20,9 @@ r3: fix a crash if /usr/share/zoneinfo doesn't exist (Raphael Geissert) r2: add filesystem trawl to set up name alias index r1: initial revision -diff -up php-src-1a4d3e4855619538eb1902b8513473e2cda76804/ext/date/lib/parse_tz.c.systzdata php-src-1a4d3e4855619538eb1902b8513473e2cda76804/ext/date/lib/parse_tz.c ---- php-src-1a4d3e4855619538eb1902b8513473e2cda76804/ext/date/lib/parse_tz.c.systzdata 2015-04-26 12:04:54.000000000 +0200 -+++ php-src-1a4d3e4855619538eb1902b8513473e2cda76804/ext/date/lib/parse_tz.c 2015-04-27 13:02:48.713660916 +0200 +diff -up php-src-dd0b602381fad375d8f29a97f25f099be7c9db35/ext/date/lib/parse_tz.c.systzdata php-src-dd0b602381fad375d8f29a97f25f099be7c9db35/ext/date/lib/parse_tz.c +--- php-src-dd0b602381fad375d8f29a97f25f099be7c9db35/ext/date/lib/parse_tz.c.systzdata 2015-05-07 07:46:56.000000000 +0200 ++++ php-src-dd0b602381fad375d8f29a97f25f099be7c9db35/ext/date/lib/parse_tz.c 2015-05-07 08:31:21.444876177 +0200 @@ -20,6 +20,16 @@ #include "timelib.h" @@ -489,7 +489,6 @@ diff -up php-src-1a4d3e4855619538eb1902b8513473e2cda76804/ext/date/lib/parse_tz. return 0; } -+ +static int seek_to_tz_position(const unsigned char **tzf, char *timezone, + char **map, size_t *maplen, + const timelib_tzdb *tzdb) @@ -549,6 +548,7 @@ diff -up php-src-1a4d3e4855619538eb1902b8513473e2cda76804/ext/date/lib/parse_tz. { const unsigned char *tzf; - return (seek_to_tz_position(&tzf, timezone, tzdb)); ++ +#ifdef HAVE_SYSTEM_TZDATA + if (tzdb == timezonedb_system) { + char fname[PATH_MAX]; @@ -574,8 +574,8 @@ diff -up php-src-1a4d3e4855619538eb1902b8513473e2cda76804/ext/date/lib/parse_tz. + return (inmem_seek_to_tz_position(&tzf, timezone, tzdb)); } - static void skip_2nd_header_and_data(const unsigned char **tzf, timelib_tzinfo *tz) -@@ -361,23 +859,53 @@ static void skip_2nd_header_and_data(con + static void skip_64bit_preamble(const unsigned char **tzf, timelib_tzinfo *tz) +@@ -374,24 +872,54 @@ static void read_64bit_header(const unsi timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb) { const unsigned char *tzf; @@ -593,10 +593,13 @@ diff -up php-src-1a4d3e4855619538eb1902b8513473e2cda76804/ext/date/lib/parse_tz. read_transistions(&tzf, tmp); read_types(&tzf, tmp); - if (version == 2) { -- skip_2nd_header_and_data(&tzf, tmp); -- skip_transistions_64bit(&tzf, tmp); -- skip_types_64bit(&tzf, tmp); +- skip_64bit_preamble(&tzf, tmp); +- read_64bit_header(&tzf, tmp); +- skip_64bit_transistions(&tzf, tmp); +- skip_64bit_types(&tzf, tmp); - skip_posix_string(&tzf, tmp); +- } +- read_location(&tzf, tmp); + +#ifdef HAVE_SYSTEM_TZDATA + if (memmap) { @@ -625,20 +628,20 @@ diff -up php-src-1a4d3e4855619538eb1902b8513473e2cda76804/ext/date/lib/parse_tz. + { + /* PHP-style - use the embedded info. */ + if (version == 2) { -+ skip_2nd_header_and_data(&tzf, tmp); -+ skip_transistions_64bit(&tzf, tmp); -+ skip_types_64bit(&tzf, tmp); ++ skip_64bit_preamble(&tzf, tmp); ++ read_64bit_header(&tzf, tmp); ++ skip_64bit_transistions(&tzf, tmp); ++ skip_64bit_types(&tzf, tmp); + skip_posix_string(&tzf, tmp); + } + read_location(&tzf, tmp); - } -- read_location(&tzf, tmp); ++ } } else { tmp = NULL; } -diff -up php-src-1a4d3e4855619538eb1902b8513473e2cda76804/ext/date/lib/timelib.m4.systzdata php-src-1a4d3e4855619538eb1902b8513473e2cda76804/ext/date/lib/timelib.m4 ---- php-src-1a4d3e4855619538eb1902b8513473e2cda76804/ext/date/lib/timelib.m4.systzdata 2015-04-26 12:04:54.000000000 +0200 -+++ php-src-1a4d3e4855619538eb1902b8513473e2cda76804/ext/date/lib/timelib.m4 2015-04-27 12:51:05.568644759 +0200 +diff -up php-src-dd0b602381fad375d8f29a97f25f099be7c9db35/ext/date/lib/timelib.m4.systzdata php-src-dd0b602381fad375d8f29a97f25f099be7c9db35/ext/date/lib/timelib.m4 +--- php-src-dd0b602381fad375d8f29a97f25f099be7c9db35/ext/date/lib/timelib.m4.systzdata 2015-05-07 07:46:56.000000000 +0200 ++++ php-src-dd0b602381fad375d8f29a97f25f099be7c9db35/ext/date/lib/timelib.m4 2015-05-07 08:27:21.541863417 +0200 @@ -78,3 +78,17 @@ stdlib.h dnl Check for strtoll, atoll diff --git a/php-fpm-www.conf b/php-fpm-www.conf index 696cb7b..008d575 100644 --- a/php-fpm-www.conf +++ b/php-fpm-www.conf @@ -416,3 +416,4 @@ 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 +;php_value[opcache.file_cache] = /var/lib/php/opcache diff --git a/php.conf b/php.conf index 3915031..38f54ae 100644 --- a/php.conf +++ b/php.conf @@ -47,4 +47,6 @@ DirectoryIndex index.php 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" + + #php_value opcache.file_cache "/var/lib/php/opcache" diff --git a/php.spec b/php.spec index 2e41a7b..28d4f39 100644 --- a/php.spec +++ b/php.spec @@ -116,11 +116,7 @@ %endif %global with_zip 1 -%if 0%{?fedora} >= 20 %global with_libzip 1 -%else -%global with_libzip 0 -%endif %if 0%{?fedora} < 18 && 0%{?rhel} < 7 @@ -129,13 +125,13 @@ %global db_devel libdb-devel %endif -%global gh_commit 94f0b940f923e5f4f5a06283e8401ef34cd83fb0 +%global gh_commit dd0b602381fad375d8f29a97f25f099be7c9db35 %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) -%global gh_date 20150428 +%global gh_date 20150507 %global gh_owner php %global gh_project php-src #global rcver RC1 -%global rpmrel 5 +%global rpmrel 6 Summary: PHP scripting language for creating dynamic web sites @@ -857,7 +853,8 @@ License: PHP Group: System Environment/Libraries Requires: %{?scl_prefix}php-common%{?_isa} = %{version}-%{release} %if %{with_libzip} -BuildRequires: pkgconfig(libzip) >= 0.11.1 +# 0.11.1 required, but 1.0.1 is bundled +BuildRequires: pkgconfig(libzip) >= 1.0.1 %endif %description zip @@ -1132,6 +1129,7 @@ pushd build-cgi build --libdir=%{_libdir}/php \ --enable-pcntl \ --enable-opcache \ + --enable-opcache-file \ --enable-phpdbg \ %if %{with_imap} --with-imap=shared --with-imap-ssl \ @@ -1354,6 +1352,7 @@ install -m 755 -d $RPM_BUILD_ROOT%{_sysconfdir}/php.d install -m 755 -d $RPM_BUILD_ROOT%{_localstatedir}/lib/php install -m 700 -d $RPM_BUILD_ROOT%{_localstatedir}/lib/php/session install -m 700 -d $RPM_BUILD_ROOT%{_localstatedir}/lib/php/wsdlcache +install -m 700 -d $RPM_BUILD_ROOT%{_localstatedir}/lib/php/opcache %if %{with_lsws} install -m 755 build-apache/sapi/litespeed/php $RPM_BUILD_ROOT%{_bindir}/lsphp @@ -1644,6 +1643,7 @@ fi %endif %attr(0770,root,apache) %dir %{_localstatedir}/lib/php/session %attr(0770,root,apache) %dir %{_localstatedir}/lib/php/wsdlcache +%attr(0770,root,apache) %dir %{_localstatedir}/lib/php/opcache %config(noreplace) %{_httpd_confdir}/%{name}.conf %if "%{_httpd_modconfdir}" != "%{_httpd_confdir}" %config(noreplace) %{_httpd_modconfdir}/15-%{name}.conf @@ -1699,6 +1699,7 @@ fi %license fpm_LICENSE %attr(0770,root,apache) %dir %{_localstatedir}/lib/php/session %attr(0770,root,apache) %dir %{_localstatedir}/lib/php/wsdlcache +%attr(0770,root,apache) %dir %{_localstatedir}/lib/php/opcache %if %{with_httpd2410} %config(noreplace) %{_httpd_confdir}/%{name}.conf %endif @@ -1805,6 +1806,9 @@ fi %changelog +* Tue Apr 28 2015 Remi Collet 7.0.0-0.6.20150507gitdd0b602 +- add experimental file based opcode cache (disabled by default) + * Tue Apr 28 2015 Remi Collet 7.0.0-0.5.20150428git94f0b94 - new snapshot -- cgit