From 750453653775d46ae44d0fc5e11b4f610adef83c Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 18 Mar 2013 10:33:06 +0100 Subject: php 5.5, .201303180830, without dtrace (temporary), with opcache \o/ --- opcache.ini | 133 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ php55.spec | 61 ++++++++++++++++++++++++---- 2 files changed, 187 insertions(+), 7 deletions(-) create mode 100644 opcache.ini diff --git a/opcache.ini b/opcache.ini new file mode 100644 index 0000000..62088a7 --- /dev/null +++ b/opcache.ini @@ -0,0 +1,133 @@ +; Enable Zend Optimizer+ extension module +zend_extension=@EXTPATH@/opcache.so + +; Optimizer+ On/Off switch. When set to Off, code is not optimized. +;opcache.enable=1 +;opcache.enable_cli=0 + +; The Optimizer+ shared memory storage size. The amount of memory for storing +; precompiled PHP code in Mbytes. +opcache.memory_consumption=128 + +; The amount of memory for interned strings in Mbytes. +opcache.interned_strings_buffer=8 + +; The maximum number of keys (scripts) in the Optimizer+ hash table. +; The number is actually the the first one in the following set of prime +; numbers that is bigger than the one supplied: { 223, 463, 983, 1979, 3907, +; 7963, 16229, 32531, 65407, 130987 }. Only numbers between 200 and 100000 +; are allowed. +opcache.max_accelerated_files=4000 + +; The maximum percentage of "wasted" memory until a restart is scheduled. +;opcache.max_wasted_percentage=5 + +; When this directive is enabled, the Optimizer+ appends the current working +; directory to the script key, thus eliminating possible collisions between +; files with the same name (basename). Disabling the directive improves +; performance, but may break existing applications. +;opcache.use_cwd=1 + +; When disabled, you must reset the Optimizer+ manually or restart the +; webserver for changes to the filesystem to take effect. +; The frequency of the check is controlled by the directive +; "opcache.revalidate_freq". +;opcache.validate_timestamps=1 + +; How often (in seconds) to check file timestamps for changes to the shared +; memory storage allocation. ("1" means validate once per second, but only +; once per request. "0" means always validate) +;opcache.revalidate_freq=2 + +; Enables or disables file search in include_path optimization +; If the file search is disabled and a cached file is found that uses +; the same include_path, the file is not searched again. Thus, if a file +; with the same name appears somewhere else in include_path, it +; won't be found. Enable this directive if this optimization has an effect on +; your applications. The default for this directive is disabled, which means +; that optimization is active. +;opcache.revalidate_path=0 + +; If disabled, all PHPDoc comments are dropped from the code to reduce the +; size of the optimized code. +;opcache.save_comments=1 + +; If disabled, PHPDoc comments are not loaded from SHM, so "Doc Comments" +; may be always stored (save_comments=1), but not loaded by applications +; that don't need them anyway. +;opcache.load_comments=1 + + +; If enabled, a fast shutdown sequence is used for the accelerated code +; The fast shutdown sequence doesn't free each allocated block, but lets +; the Zend Engine Memory Manager do the work. +opcache.fast_shutdown=1 + +; Allow file existence override (file_exists, etc.) performance feature. +;opcache.enable_file_override=0 + +; A bitmask, where each bit enables or disables the appropriate Optimizer+ +; passes +;opcache.optimization_level="0xffffffff" + +; Enable this hack as a workaround for "can't redeclare class" errors. +; The Optimizer+ stores the places where DECLARE_CLASS opcodes use +; inheritance (These are the only opcodes that can be executed by PHP, +; but which may not be executed because the parent class is missing due to +; optimization). When the file is loaded, Optimizer+ tries to bind the +; inherited classes by using the current environment. The problem with this +; scenario is that, while the DECLARE_CLASS opcode may not be needed for the +; current script, if the script requires that the opcode at least be defined, +; it may not run. The default for this directive is disabled, which means +; that optimization is active. In php-5.3 and above this hack is not needed +; anymore and this setting has no effect. +;opcache.inherited_hack=1 + +; Enable this hack as a workaround for "Cannot redeclare class" errors. +;opcache.dups_fix=0 + +; The location of the Optimizer+ blacklist file. +; The Optimizer+ blacklist file is a text file that holds the names of files +; that should not be accelerated. The file format is to add each filename +; to a new line. The filename may be a full path or just a file prefix +; (i.e., /var/www/x blacklists all the files and directories in /var/www +; that start with 'x'). Files are usually triggered by one of the following +; three reasons: +; 1) Directories that contain auto generated code, like Smarty or ZFW cache. +; 2) Code that does not work well when accelerated, due to some delayed +; compile time evaluation. +; 3) Code that triggers an Optimizer+ bug. +;opcache.blacklist_filename + +; Check the cache checksum each N requests. +; The default value of "0" means that the checks are disabled. +; Because calculating the checksum impairs performance, this directive should +; be enabled only as part of a debugging process. +;opcache.consistency_checks=0 + +; How long to wait (in seconds) for a scheduled restart to begin if the cache +; is not being accessed. +; The Optimizer+ uses this directive to identify a situation where there may +; be a problem with a process. After this time period has passed, the +; Optimizer+ assumes that something has happened and starts killing the +; processes that still hold the locks that are preventing a restart. +; If the log level is 3 or above, a "killed locker" error is recorded +; in the Apache logs when this happens. +;opcache.force_restart_timeout=180 + +; Optimizer+ error_log file name. Empty string assumes "stderr". +;opcache.error_log=stderr + +; All Optimizer+ errors go to the Web server log. +; By default, only fatal errors (level 0) or errors (level 1) are logged. +; You can also enable warnings (level 2), info messages (level 3) or +; debug messages (level 4). +;opcache.log_verbosity_level=1 + +; Preferred Shared Memory back-end. Leave empty and let the system decide. +;opcache.preferred_memory_model= + +; Protect the shared memory from unexpected writing during script execution. +; Useful for internal debugging only. +;opcache.protect_memory=0 + diff --git a/php55.spec b/php55.spec index 1ad58e5..dc637d5 100644 --- a/php55.spec +++ b/php55.spec @@ -3,6 +3,7 @@ %global zendver 20121212 %global pdover 20080721 # Extension version +%global opcachever 7.0.1-dev %global oci8ver 1.4.9 # Adds -z now to the linker flags @@ -53,7 +54,7 @@ %{!?_httpd_contentdir: %{expand: %%global _httpd_contentdir /var/www}} %if 0%{?fedora} >= 12 || 0%{?rhel} >= 6 -%global with_dtrace 1 +%global with_dtrace 0 %else %global with_dtrace 0 %endif @@ -71,14 +72,14 @@ %global db_devel libdb-devel %endif -%global snapdate 201303141230 +%global snapdate 201303180830 #global rcver RC1 Summary: PHP scripting language for creating dynamic web sites Name: php Version: 5.5.0 %if 0%{?snapdate:1}%{?rcver:1} -Release: 0.18.%{?snapdate}%{?rcver}%{?dist} +Release: 0.19.%{?snapdate}%{?rcver}%{?dist} %else Release: 2%{?dist} %endif @@ -104,6 +105,8 @@ Source7: php-fpm.logrotate Source8: php-fpm.sysconfig Source9: php.modconf Source10: php.ztsmodconf +# Configuration files for some extensions +Source50: opcache.ini Source99: php-fpm.init # Build fixes @@ -317,6 +320,24 @@ The php-devel package contains the files needed for building PHP extensions. If you need to compile your own PHP extensions, you will need to install this package. +%package opcache +Summary: The Zend Optimizer+ +Group: Development/Languages +License: PHP +Requires: php-common%{?_isa} = %{version}-%{release} +Obsoletes: php-pecl-zendoptimizerplus +Provides: php-pecl-zendoptimizerplus = %{opcachever} +Provides: php-pecl-zendoptimizerplus%{?_isa} = %{opcachever} +Provides: php-pecl(opcache) = %{opcachever} +Provides: php-pecl(opcache)%{?_isa} = %{opcachever} + +%description opcache +The Zend Optimizer+ provides faster PHP execution through opcode caching and +optimization. It improves PHP performance by storing precompiled script +bytecode in the shared memory. This eliminates the stages of reading code from +the disk and compiling it on future access. In addition, it applies a few +bytecode optimization patterns that make code execution faster. + %package imap Summary: A module for PHP applications that use IMAP Group: Development/Languages @@ -875,6 +896,13 @@ if test "$ver" != "%{oci8ver}"; then exit 1 fi +ver=$(sed -n '/#define ACCELERATOR_VERSION /{s/.* "//;s/".*$//;p}' ext/opcache/ZendAccelerator.h) +if test "$ver" != "%{opcachever}"; then + : Error: Upstream PHAR version is now ${ver}, expecting %{opcachever}. + : Update the opcachever macro and rebuild. + exit 1 +fi + # https://bugs.php.net/63362 - Not needed but installed headers. # Drop some Windows specific headers to avoid installation, # before build to ensure they are really not needed. @@ -893,6 +921,9 @@ chmod 644 README.* # php-fpm configuration files for tmpfiles.d echo "d /run/php-fpm 755 root root" >php-fpm.tmpfiles +# Some extensions have their own configuration file +cp %{SOURCE50} . + %build %if 0%{?fedora} >= 11 || 0%{?rhel} >= 6 @@ -991,6 +1022,7 @@ pushd build-cgi build --enable-force-cgi-redirect \ --libdir=%{_libdir}/php \ --enable-pcntl \ + --enable-opcache \ --with-imap=shared --with-imap-ssl \ --enable-mbstring=shared \ --enable-mbregex \ @@ -1072,6 +1104,7 @@ popd without_shared="--without-gd \ --disable-dom --disable-dba --without-unixODBC \ + --disable-opcache \ --disable-xmlreader --disable-xmlwriter \ --without-sqlite3 --disable-phar --disable-fileinfo \ --disable-json --without-pspell --disable-wddx \ @@ -1128,6 +1161,7 @@ build --enable-force-cgi-redirect \ --enable-maintainer-zts \ --with-config-file-scan-dir=%{_sysconfdir}/php-zts.d \ --enable-pcntl \ + --enable-opcache \ --with-imap=shared --with-imap-ssl \ --enable-mbstring=shared \ --enable-mbregex \ @@ -1398,7 +1432,7 @@ for mod in pgsql odbc ldap snmp xmlrpc imap \ mysqlnd mysqlnd_mysql mysqlnd_mysqli pdo_mysqlnd \ mbstring gd dom xsl soap bcmath dba xmlreader xmlwriter \ simplexml bz2 calendar ctype exif ftp gettext gmp iconv \ - sockets tokenizer \ + sockets tokenizer opcache \ pdo pdo_pgsql pdo_odbc pdo_sqlite json %{zipmod} \ %{?_with_oci8:oci8} %{?_with_oci8:pdo_oci} interbase pdo_firebird \ %if 0%{?fedora} >= 11 || 0%{?rhel} >= 6 @@ -1415,16 +1449,23 @@ if [ "$mod" = "wddx" ] then ini=xml_${mod}.ini else ini=${mod}.ini fi - cat > $RPM_BUILD_ROOT%{_sysconfdir}/php.d/${ini} <$RPM_BUILD_ROOT%{_sysconfdir}/php.d/${ini} + sed -e 's:@EXTPATH@:%{_libdir}/php-zts/modules:' \ + ${ini} >$RPM_BUILD_ROOT%{_sysconfdir}/php-zts.d/${ini} + else + cat > $RPM_BUILD_ROOT%{_sysconfdir}/php.d/${ini} < $RPM_BUILD_ROOT%{_sysconfdir}/php-zts.d/${ini} < $RPM_BUILD_ROOT%{_sysconfdir}/php-zts.d/${ini} < files.${mod} < 5.5.0-0.18-201314081230 +* Mon Mar 18 2013 Remi Collet 5.5.0-0.19-201303180830 +- new snapshot +- temporary disable dtrace +- new extension opcache in php-opccache sub-package + +* Thu Mar 14 2013 Remi Collet 5.5.0-0.18-201303141230 - new snapshot - hardened build (links with -z now option) - remove %%config from /etc/rpm/macros.php -- cgit