From 0f14f536782fe415b6e62b58be9cf352ea9f0b00 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sun, 9 Sep 2012 13:17:29 +0200 Subject: php-eaccelerator: try to improve cache management --- php-eaccelerator-cache.patch | 40 +++++++++++++ php-eaccelerator-config.patch | 20 +++---- php-eaccelerator-dev.spec | 130 +++++++++++------------------------------- 3 files changed, 83 insertions(+), 107 deletions(-) create mode 100644 php-eaccelerator-cache.patch diff --git a/php-eaccelerator-cache.patch b/php-eaccelerator-cache.patch new file mode 100644 index 0000000..c0358a8 --- /dev/null +++ b/php-eaccelerator-cache.patch @@ -0,0 +1,40 @@ +--- eaccelerator.c.cache 2012-09-09 11:49:26.000000000 +0200 ++++ eaccelerator.c 2012-09-09 13:07:04.000000000 +0200 +@@ -1521,13 +1521,13 @@ + ZEND_INI_ENTRY1("eaccelerator.shm_ttl", "0", PHP_INI_SYSTEM, eaccelerator_OnUpdateLong, &ea_shm_ttl) + ZEND_INI_ENTRY1("eaccelerator.shm_prune_period", "0", PHP_INI_SYSTEM, eaccelerator_OnUpdateLong, &ea_shm_prune_period) + ZEND_INI_ENTRY1("eaccelerator.debug", "1", PHP_INI_SYSTEM, eaccelerator_OnUpdateLong, &ea_debug) +-STD_PHP_INI_ENTRY("eaccelerator.log_file", "", PHP_INI_SYSTEM, OnUpdateString, ea_log_file, zend_eaccelerator_globals, eaccelerator_globals) ++STD_PHP_INI_ENTRY("eaccelerator.log_file", "", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateString, ea_log_file, zend_eaccelerator_globals, eaccelerator_globals) + STD_PHP_INI_ENTRY("eaccelerator.check_mtime", "1", PHP_INI_SYSTEM, OnUpdateBool, check_mtime_enabled, zend_eaccelerator_globals, eaccelerator_globals) + ZEND_INI_ENTRY1("eaccelerator.shm_only", "0", PHP_INI_SYSTEM, eaccelerator_OnUpdateBool, &ea_scripts_shm_only) + #ifdef WITH_EACCELERATOR_INFO + STD_PHP_INI_ENTRY("eaccelerator.allowed_admin_path", "", PHP_INI_SYSTEM, OnUpdateString, allowed_admin_path, zend_eaccelerator_globals, eaccelerator_globals) + #endif +-STD_PHP_INI_ENTRY("eaccelerator.cache_dir", "/tmp/eaccelerator", PHP_INI_SYSTEM, OnUpdateString, cache_dir, zend_eaccelerator_globals, eaccelerator_globals) ++STD_PHP_INI_ENTRY("eaccelerator.cache_dir", "/tmp/eaccelerator", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateString, cache_dir, zend_eaccelerator_globals, eaccelerator_globals) + PHP_INI_ENTRY("eaccelerator.filter", "", PHP_INI_ALL, eaccelerator_filter) + PHP_INI_END() + +@@ -1766,17 +1766,12 @@ + int status = stat(cache_path, &buffer); + + if (status == 0) { +- // check permissions +- if (buffer.st_mode != 777) { +- status = chmod(cache_path, 0777); +- if (status < 0) { +- ea_debug_error( +- "eAccelerator: Unable to change cache directory %s permissions\n", +- cache_path); +- } +- } ++ // probaly created by us (so with 777) ++ // or by sysadmin, which know what we need + } else { + // create the cache directory if possible ++ // use 777 to allow other user to create subdir ++ // which seems acceptable under /tmp (default value) + status = mkdir(cache_path, 0777); + if (status < 0) { + ea_debug_error("eAccelerator: Unable to create cache directory %s\n", cache_path); diff --git a/php-eaccelerator-config.patch b/php-eaccelerator-config.patch index 4eb749a..d0578c8 100644 --- a/php-eaccelerator-config.patch +++ b/php-eaccelerator-config.patch @@ -1,5 +1,5 @@ ---- eaccelerator.ini.orig 2012-09-08 18:15:19.000000000 +0200 -+++ eaccelerator.ini 2012-09-08 18:22:31.000000000 +0200 +--- eaccelerator.ini.upstream 2012-09-09 12:38:47.000000000 +0200 ++++ eaccelerator.ini 2012-09-09 12:39:55.000000000 +0200 @@ -12,13 +12,8 @@ ; You must uncomment one (and only one) line from the following to load @@ -16,12 +16,12 @@ ; The amount of shared memory (in megabytes) that eAccelerator will use. ; "0" means OS default. Default value is "0". -@@ -28,7 +23,7 @@ - ; code, session data, content and user entries here. The same data can be - ; stored in shared memory also (for more quick access). Default value is - ; "/tmp/eaccelerator". --eaccelerator.cache_dir = "/tmp/eaccelerator" -+eaccelerator.cache_dir = "@CACHEDIR@" +@@ -45,7 +40,7 @@ - ; Enables or disables eAccelerator. Should be "1" for enabling or - ; "0" for disabling. Default value is "1". + ; Set the log file for eaccelerator. When this option isn't set then the data + ; will be logged to stderr +-eaccelerator.log_file = "/var/log/httpd/eaccelerator_log" ++eaccelerator.log_file = "" + + ; A string that's prepended to all keys. This allows two applications that use the + ; same key names to run on the same host by setting this in .htaccess or in the main diff --git a/php-eaccelerator-dev.spec b/php-eaccelerator-dev.spec index 3e54802..ab626bc 100644 --- a/php-eaccelerator-dev.spec +++ b/php-eaccelerator-dev.spec @@ -8,7 +8,7 @@ Summary: PHP accelerator, optimizer, encoder and dynamic content cacher Name: php-eaccelerator Version: 1.0 -Release: 0.1.git%{gitver}%{?dist} +Release: 0.2.git%{gitver}%{?dist} Epoch: 1 # The eaccelerator module itself is GPLv2+ # The PHP control panel is under the Zend license (control.php and dasm.php) @@ -22,6 +22,8 @@ Source1: %{name}.cron # Fix packaging directory path Patch0: %{name}-config.patch +# Try to improves cache management +Patch1: %{name}-cache.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: php-devel >= 5.1.0 @@ -70,23 +72,29 @@ is still based on his work. cp %{SOURCE1} . +cat >httpd.conf </dev/null || : -else # Create the ghost'ed directory with default ownership and mode - mkdir -p %{cache} - chown %{apache}:%{apache} %{cache} + mkdir -p %{cache}/%{apache} + chown %{apache}:%{apache} %{cache}/%{apache} chmod 0750 %{cache} fi +# Please remember to empty your eAccelerator disk cache +# when upgrading, otherwise things will break! +rm -rf %{cache}/*/* &>/dev/null || : + %check # Check if the built extensions can be loaded @@ -177,16 +188,21 @@ fi %defattr(-,root,root,-) %doc nts/{AUTHORS,ChangeLog,COPYING,NEWS,README} %doc nts/*.php -%{_sysconfdir}/cron.daily/php-eaccelerator +%{_sysconfdir}/cron.daily/%{name} +%config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf %config(noreplace) %{php_inidir}/eaccelerator.ini %config(noreplace) %{php_ztsinidir}/eaccelerator.ini %{php_extdir}/eaccelerator.so %{php_ztsextdir}/eaccelerator.so # We need this hack, as otherwise rpm resets ownership upon package upgrade -%ghost %{cache} +%dir %{cache} +%ghost %{cache}/%{apache} %changelog +* Sun Sep 9 2012 Remi Collet - 1:1.0-0.2.git42067ac +- try to improve cache management + * Sat Sep 8 2012 Remi Collet - 1:1.0-0.1.git42067ac - update to 1.0-dev for php 5.4 @@ -308,83 +324,3 @@ fi - Use sed instead of perl for the config file changes. - No longer use dist because we want to use the same package on F-n and n+1. -* Wed May 16 2007 Matthias Saou 5.2.2_0.9.5-2 -- Include ppc64 %%ifarch, since it's now a Fedora target. -- Include patch to fix trac bug #187. - -* Wed May 16 2007 Matthias Saou 5.2.2_0.9.5-1 -- Rebuild against PHP 5.2.2. - -* Mon Feb 19 2007 Matthias Saou 5.2.1_0.9.5-1 -- Rebuild against PHP 5.2.1. - -* Mon Dec 4 2006 Matthias Saou 5.2.0_0.9.5-2 -- Include patch to fix use of PHP 5.2 (ea #204, rh #218166). - -* Wed Nov 29 2006 Matthias Saou 5.2.0_0.9.5-1 -- Rebuild against PHP 5.2.0. - -* Wed Nov 8 2006 Matthias Saou 5.1.6_0.9.5-2 -- Change to require php-common instead of php, for fastcgi without apache. - -* Mon Oct 16 2006 Matthias Saou 5.1.6_0.9.5-1 -- Update to 0.9.5 final. -- Add cleanup of the cache directory upon package removal. - -* Thu Sep 7 2006 Matthias Saou 5.1.6_0.9.5-0.4.rc1 -- Rebuild for PHP 5.1.6, eA still checks the exact PHP version it seems :-( -- Put "Requires: php = %%{php_version}" back to avoid broken setups if/when - PHP gets updated. - -* Mon Aug 28 2006 Matthias Saou 5.1.4_0.9.5-0.4.rc1 -- FC6 rebuild. - -* Tue Aug 22 2006 Matthias Saou 5.1.4_0.9.5-0.3.rc1 -- Update to 0.9.5-rc1. -- Enable shared-memory, sessions and content-caching (#201319). -- Remove both patches of fixes, merged upstream. -- Change from creating a full eaccelerator.ini to using the included one with - path substitutions and a patch to change default values. - -* Tue May 23 2006 Matthias Saou 5.1.x_0.9.5-0.2.beta2 -- Rebuild against PHP 5.1.4. - -* Fri May 5 2006 Matthias Saou 5.1.x_0.9.5-0.2.beta2 -- Rework heavily the API version requirement detection, should work with - chroots builds where PHP isn't installed outside. -- Replace the CC way of getting the API version with php -i output. - -* Tue Apr 11 2006 Matthias Saou 5.1.x_0.9.5-0.1.beta2 -- Update to 0.9.5-beta2. - -* Tue Mar 14 2006 Matthias Saou 5.1.x_0.9.3-0.3 -- Pass userid 48 to configure script on PPC for sysvipc semaphores. - -* Tue Mar 14 2006 Matthias Saou 5.1.x_0.9.3-0.2 -- Update to latest eaccelerator-svn200603090012 snapshot. - -* Thu Feb 9 2006 Matthias Saou 5.1.x_0.9.3-0.1 -- Update to 5.1.x compatible snapshot. -- Will try to make re2c available in Extras in order to build require it. - -* Mon Oct 17 2005 Matthias Saou 4.x.x_0.9.3-4 -- Re-add %%{?_smp_mflags}, as this was a false alarm. -- Force SEM to FCNTL as the IPC version is buggy on x86_64 SMP at least. - -* Mon Jun 27 2005 Matthias Saou 4.x.x_0.9.3-3 -- Include buffer overflow patch from zoeloelip, this should fix the real - problem that wasn't in fact solved with the removal of _smp_mflags. -- Add explicit shm_and_disk defaults to the ini file. - -* Mon Jun 27 2005 Matthias Saou 4.x.x_0.9.3-2 -- Remove %%{?_smp_mflags}, since the module crashes otherwise (#161189). - -* Tue Jun 21 2005 Matthias Saou 4.x.x_0.9.3-1 -- Update to 0.9.3, bugfix release. - -* Fri Apr 7 2005 Michael Schwendt -- rebuilt - -* Tue Jan 11 2005 Matthias Saou 4.x.x_0.9.2a-0 -- Initial RPM release based on the php-mmcache spec file. - -- cgit