From a21065a68c9e0b984d39e272fbf1c56e2edec5b1 Mon Sep 17 00:00:00 2001 From: Joerg Deckert Date: Mon, 8 Oct 2018 19:49:20 +0200 Subject: [PATCH] lamp: activate opcache, php intl support --- lamp/Makefile | 1 + lamp/firstboot.start | 0 lamp/mariadb/my.cnf.orig | 144 ++++++++++++++++++++++++++++++++++ lamp/package.use | 2 +- lamp/php/php.ini-opcache.diff | 45 +++++++++++ 5 files changed, 191 insertions(+), 1 deletion(-) mode change 100644 => 100755 lamp/firstboot.start create mode 100644 lamp/mariadb/my.cnf.orig create mode 100644 lamp/php/php.ini-opcache.diff diff --git a/lamp/Makefile b/lamp/Makefile index 5e96dab..c68e61f 100644 --- a/lamp/Makefile +++ b/lamp/Makefile @@ -36,6 +36,7 @@ postinstall: timesyncd.conf firstboot.start $(inroot) bash -c 'yes gentoo | emerge --config dev-db/mariadb' # Apache-/PHP-Konfiguration + patch $(CHROOT)/etc/php/apache2-*/php.ini < php/php.ini-opcache.diff find $(CHROOT)/etc/php/apache2-*/ -iname php.ini -print | xargs \sed -i \ -e 's:.*date.timezone =.*:date.timezone = Europe/Berlin:' \ -e 's:.*max_execution_time =.*:max_execution_time = 3600:' \ diff --git a/lamp/firstboot.start b/lamp/firstboot.start old mode 100644 new mode 100755 diff --git a/lamp/mariadb/my.cnf.orig b/lamp/mariadb/my.cnf.orig new file mode 100644 index 0000000..d2cd772 --- /dev/null +++ b/lamp/mariadb/my.cnf.orig @@ -0,0 +1,144 @@ +# /etc/mysql/my.cnf: The global mysql configuration file. +# $Id$ + +# The following options will be passed to all MySQL clients +[client] +#password = your_password +port = 3306 +socket = /var/run/mysqld/mysqld.sock + +[mysql] +character-sets-dir=/usr/share/mysql/charsets +default-character-set=utf8 + +[mysqladmin] +character-sets-dir=/usr/share/mysql/charsets +default-character-set=utf8 + +[mysqlcheck] +character-sets-dir=/usr/share/mysql/charsets +default-character-set=utf8 + +[mysqldump] +character-sets-dir=/usr/share/mysql/charsets +default-character-set=utf8 + +[mysqlimport] +character-sets-dir=/usr/share/mysql/charsets +default-character-set=utf8 + +[mysqlshow] +character-sets-dir=/usr/share/mysql/charsets +default-character-set=utf8 + +[myisamchk] +character-sets-dir=/usr/share/mysql/charsets + +[myisampack] +character-sets-dir=/usr/share/mysql/charsets + +# add a section [mysqld-4.1] or [mysqld-5.0] for specific configurations +[mysqld] +character-set-server = utf8 +user = mysql +port = 3306 +socket = /var/run/mysqld/mysqld.sock +pid-file = /var/run/mysqld/mysqld.pid +log-error = /var/log/mysql/mysqld.err +basedir = /usr +datadir = /var/lib/mysql +skip-external-locking +key_buffer_size = 16M +max_allowed_packet = 4M +table_open_cache = 400 +sort_buffer_size = 512K +net_buffer_length = 16K +read_buffer_size = 256K +read_rnd_buffer_size = 512K +myisam_sort_buffer_size = 8M +lc_messages_dir = /usr/share/mysql +#Set this to your desired error message language +lc_messages = en_US + +# security: +# using "localhost" in connects uses sockets by default +# skip-networking +bind-address = 127.0.0.1 + +##log-bin +server-id = 1 + +# point the following paths to different dedicated disks +tmpdir = /tmp/ +#log-update = /path-to-dedicated-directory/hostname + +# you need the debug USE flag enabled to use the following directives, +# if needed, uncomment them, start the server and issue +# #tail -f /tmp/mysqld.sql /tmp/mysqld.trace +# this will show you *exactly* what's happening in your server ;) + +#log = /tmp/mysqld.sql +#gdb +#debug = d:t:i:o,/tmp/mysqld.trace +#one-thread + +# the rest of the innodb config follows: +# don't eat too much memory, we're trying to be safe on 64Mb boxes +# you might want to bump this up a bit on boxes with more RAM +innodb_buffer_pool_size = 128M +# +# i'd like to use /var/lib/mysql/innodb, but that is seen as a database :-( +# and upstream wants things to be under /var/lib/mysql/, so that's the route +# we have to take for the moment +#innodb_data_home_dir = /var/lib/mysql/ +#innodb_log_arch_dir = /var/lib/mysql/ +#innodb_log_group_home_dir = /var/lib/mysql/ +# you may wish to change this size to be more suitable for your system +# the max is there to avoid run-away growth on your machine +innodb_data_file_path = ibdata1:10M:autoextend:max:128M +# we keep this at around 25% of of innodb_buffer_pool_size +# sensible values range from 1MB to (1/innodb_log_files_in_group*innodb_buffer_pool_size) +innodb_log_file_size = 48M +# this is the default, increase it if you have very large transactions going on +innodb_log_buffer_size = 8M +# this is the default and won't hurt you +# you shouldn't need to tweak it +innodb_log_files_in_group=2 +# see the innodb config docs, the other options are not always safe +innodb_flush_log_at_trx_commit = 1 +innodb_lock_wait_timeout = 50 +innodb_file_per_table + +# Uncomment this to get FEDERATED engine support +#plugin-load=federated=ha_federated.so +loose-federated + +# Nextcloud-Empfehlung +log-basename=master +log-bin +binlog-format=mixed + +[mysqldump] +quick +max_allowed_packet = 16M + +[mysql] +# uncomment the next directive if you are not familiar with SQL +#safe-updates + +[isamchk] +key_buffer_size = 20M +sort_buffer_size = 20M +read_buffer = 2M +write_buffer = 2M + +[myisamchk] +key_buffer_size = 20M +sort_buffer_size = 20M +read_buffer_size = 2M +write_buffer_size = 2M + +[mysqlhotcopy] +interactive-timeout + +[mariadb] diff --git a/lamp/package.use b/lamp/package.use index e2e3db1..111826e 100644 --- a/lamp/package.use +++ b/lamp/package.use @@ -24,5 +24,5 @@ dev-php/maxmind-db-reader extension # LAMP app-eselect/eselect-php apache2 fpm -dev-lang/php apache2 bcmath curl gd imap ldap ldap-sasl mysql mysqli pdo sockets sqlite sysvipc truetype xmlreader xmlrpc xmlwriter zip +dev-lang/php apache2 bcmath curl gd imap intl ldap ldap-sasl mysql mysqli pdo sockets sqlite sysvipc truetype xmlreader xmlrpc xmlwriter zip www-servers/apache apache2_modules_proxy apache2_modules_proxy_ajp apache2_modules_proxy_connect apache2_modules_proxy_http apache2_modules_proxy_wstunnel diff --git a/lamp/php/php.ini-opcache.diff b/lamp/php/php.ini-opcache.diff new file mode 100644 index 0000000..2ef5687 --- /dev/null +++ b/lamp/php/php.ini-opcache.diff @@ -0,0 +1,45 @@ +--- php.ini.orig 2018-07-29 20:00:00.000000000 +0200 ++++ php.ini 2018-09-13 14:49:00.000000000 +0200 +@@ -1779,20 +1779,20 @@ + + [opcache] + ; Determines if Zend OPCache is enabled +-;opcache.enable=1 ++opcache.enable=1 + + ; Determines if Zend OPCache is enabled for the CLI version of PHP +-;opcache.enable_cli=0 ++opcache.enable_cli=1 + + ; The OPcache shared memory storage size. +-;opcache.memory_consumption=128 ++opcache.memory_consumption=128 + + ; The amount of memory for interned strings in Mbytes. +-;opcache.interned_strings_buffer=8 ++opcache.interned_strings_buffer=8 + + ; The maximum number of keys (scripts) in the OPcache hash table. + ; Only numbers between 200 and 1000000 are allowed. +-;opcache.max_accelerated_files=10000 ++opcache.max_accelerated_files=10000 + + ; The maximum percentage of "wasted" memory until a restart is scheduled. + ;opcache.max_wasted_percentage=5 +@@ -1810,14 +1810,14 @@ + ; 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 ++opcache.revalidate_freq=1 + + ; Enables or disables file search in include_path optimization + ;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 ++opcache.save_comments=1 + + ; If enabled, a fast shutdown sequence is used for the accelerated code + ; Depending on the used Memory Manager this may cause some incompatibilities.