Обсуждение Magento и PHP7

How to make Magento 1.9.2.3 work with PHP 7
from
Для просмотра ссылки Войди или Зарегистрируйся

If you've been reading all about PHP 7, you've been thinking about taking full advantage of the speed and optimization of PHP 7 by operating your Magento store using this new improved version of PHP.

However, Magento 1.9.2.3 requires a couple of tweaks under the hood to work with PHP 7.

The only work required is to simply alter 7 Magento files and you're good to go...

Of course, be sure to make a complete backup of your Magento installation and always rename your original file in case you need to revert back to the original.

File #1 is located at: /app/code/core/Mage/Core/Model/Layout.php
Edit line 552
Original: $out .= $this->getBlock($callback[0])->$callback[1]();
Edited: $out .= $this->getBlock($callback[0])->{$callback[1]}();

File #2 is located at: /app/code/core/Mage/Core/Model/Resource/Session.php
Edit line 215
Original: return $data;
Edited: return (string)$data;

File #3 is located at: /app/code/core/Mage/ImportExport/Model/Export/Entity/Customer.php
Edit line 247
Original: $data['filter_options'] = $this->$data['options_method']();
Edited: $data['filter_options'] = $this->{$data['options_method']}();
File #4 is located at: /app/code/core/Mage/ImportExport/Model/Export/Entity/Product/Type/Abstract.php
Edit line 96
Original: $data['filter_options'] = $this->$data['options_method']();
Edited: $data['filter_options'] = $this->{$data['options_method']}();

File #5 is located at: /app/code/core/Mage/ImportExport/Model/Import/Uploader.php
Edit line 132
Original: $params['object']->$params['method']($filePath);
Edited: $params['object']->{$params['method']}($filePath);

File #6 is located at: /app/code/core/Mage/Sales/etc/config.xml
Edit line 1218
Original: < after>subtotal,freeshipping,tax_subtotal< /after>
Edited: < after>subtotal,freeshipping,tax_subtotal,msrp< /after>
Edit line 1227
After Line: < class>sales/quote_address_total_msrp< /class>
Add This Line: < before>grand_total< /before>

File #7 is located at: /lib/Varien/File/Uploader.php
Edit line 271
Original: $params['object']->$params['method']($this->_file['tmp_name']);
Edited: $params['object']->{$params['method']}($this->_file['tmp_name']);

...and that's all there is to it.
Now your Magento version 1.9.2.3 will work flawlessly with the latest and greatest PHP 7.

*note: be sure to remove the space after each "<" in file 6 line 1218 and 1228 (you're adding a new line after 1227).
Also, thanks and recognition to David Robinson on github for his work on making Magento PHP 7 compatible.

1. Step
Performance Tuning for Magento CE 1.9.2.4 with PHP 7
Root-Server Debian 8.3 plesk 12.5

  • Intel® Core™ i7-6700 Quad-Core Skylake
  • 32 GB DDR4 RAM
  • 2 x 500 GB 6 Gb/s SSD (Software-RAID 1)
  • 1 Gbit/s

1. Tuning for Nginx
Для просмотра ссылки Войди или Зарегистрируйся

etc/nginx/nginx.conf
----------------------------

#user nginx;
worker_processes auto;

#error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;

#pid /var/run/nginx.pid;


events {
use epoll;
worker_connections 2048;
multi_accept on;
}


http {
include mime.types;
default_type application/octet-stream;

#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';

#access_log /var/log/nginx/access.log main;
open_file_cache max=1000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 5;
open_file_cache_errors off;
client_max_body_size 100m;
client_body_timeout 15;
client_header_timeout 15;
client_body_buffer_size 1K;
client_header_buffer_size 1k;
large_client_header_buffers 4 8k;
reset_timedout_connection on;
server_names_hash_bucket_size 100;
types_hash_max_size 2048;

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;

gzip on;
gzip_static on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_min_length 1400;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/x-javascript application/json application/xml application/rss+xml font/truetype application/x-font-ttf font/opentype application/vnd.ms-fontobject image/svg+xml;

server_tokens off;

include /etc/nginx/conf.d/*.conf;
}

# override global parameters e.g. worker_rlimit_nofile
include /etc/nginx/*global_params;
------------------------------------------------------

2. Step
Performance Tuning for Magento CE 1.9.2.4 with PHP 7
Root-Server Debian 8.3 plesk 12.5

  • Intel® Core™ i7-6700 Quad-Core Skylake
  • 32 GB DDR4 RAM
  • 2 x 500 GB 6 Gb/s SSD (Software-RAID 1)
  • 1 Gbit/s

2. Tuning for PHP-FPM - event
/etc/apache2/mods-available/mpm_event.conf

----------------------------------------------------

<IfModule mpm_event_module>
StartServers 16
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxRequestWorkers 400
MaxConnectionsPerChild 2000
</IfModule>
---------------------------------------------------

3. Step
Performance Tuning for Magento CE 1.9.2.4 with PHP 7
Root-Server Debian 8.3 plesk 12.5

  • Intel® Core™ i7-6700 Quad-Core Skylake
  • 32 GB DDR4 RAM
  • 2 x 500 GB 6 Gb/s SSD (Software-RAID 1)
  • 1 Gbit/s

3. Tuning for MariaDB
-----------------------------------------------
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# Для просмотра ссылки Войди или Зарегистрируйся

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0

[mysqld]
bind-address = ::
skip_name_resolve
local-infile=0
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#
# * Fine Tuning
#
key_buffer = 16M
#max_allowed_packet = 16M
thread_stack = 192K
#thread_cache_size = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover = BACKUP
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10

### CACHES AND LIMITS #
back_log = 20
interactive_timeout = 7200
wait_timeout = 7200
net_read_timeout = 120
net_write_timeout = 300
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
join_buffer_size = 4M
tmp_table_size = 256M
max_heap_table_size = 256M
query_cache_type = 1
query_cache_size = 128M
query_cache_limit = 4M
max_connections = 150
thread_cache_size= 32
open_files_limit = 65535
table_definition_cache = 4000
table_open_cache = 4000
key_buffer = 512M
thread_concurrency = 24
table_cache = 1024
max_allowed_packet = 16M
bulk_insert_buffer_size = 64M

#
# * Query Cache Configuration
#
#query_cache_limit = 1M
#query_cache_size = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Here you can see queries with especially long duration
#slow_query_log_file = /var/log/mysql/mysql-slow.log
#slow_query_log = 1
#long_query_time = 2
#log_queries_not_using_indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# * InnoDB


innodb_thread_concurrency = 18
innodb_lock_wait_timeout = 7200
innodb_flush_method = O_DIRECT
innodb_log_files_in_group = 2
innodb_log_file_size = 256M
innodb_log_buffer_size = 16M
innodb_flush_log_at_trx_commit = 2
innodb_file_per_table = 1
#innodb_io_capacity = 1000
innodb_read_io_threads = 8
innodb_write_io_threads = 8
innodb_buffer_pool_instances = 4
innodb_buffer_pool_size = 8G
innodb_autoextend_increment=512
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem



[mysqldump]
quick
quote-names
max_allowed_packet = 16M

[mysql]
#no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
key_buffer = 16M

#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/

--------------------------------------------------------------------

4. Step
Performance Tuning for Magento CE 1.9.2.4 with PHP 7
Root-Server Debian 8.3 plesk 12.5

  • Intel® Core™ i7-6700 Quad-Core Skylake
  • 32 GB DDR4 RAM
  • 2 x 500 GB 6 Gb/s SSD (Software-RAID 1)
  • 1 Gbit/s

4. Tuning for APCu

Install First
apt-get -V install php5-apcu
service php5-fpm restart

-------------------------------------------------------

extension=apcu.so
apc.enabled=1
apc.stat = 0
apc.max_file_size = 10M
apc.localcache = 1
apc.localcache.size = 256
apc.shm_segments = 1
apc.ttl = 48000
apc.user_ttl = 48000
apc.enable_cli=0
apc.gc_ttl = 3600
apc.cache_by_default = 1
apc.filters =
apc.write_lock = 1
apc.num_files_hint= 8096
apc.user_entries_hint=8096
apc.shm_size = 2048M
apc.mmap_file_mask=/tmp/apc.XXXXXX
apc.include_once_override = 0
apc.file_update_protection=2
apc.canonicalize = 1
apc.report_autofilter=0
apc.stat_ctime=0
--------------------------------------------------

5. Step
Performance Tuning for Magento CE 1.9.2.4 with PHP 7
Root-Server Debian 8.3 plesk 12.5

  • Intel® Core™ i7-6700 Quad-Core Skylake
  • 32 GB DDR4 RAM
  • 2 x 500 GB 6 Gb/s SSD (Software-RAID 1)
  • 1 Gbit/s

5. mcrypt for Magento

apt-get install php5-mcrypt
service php5-fpm restart

---memcached---???

apt-get install memcached
service memcached start
ps -eaf | grep memcached
Memcached configuration file is /etc/memcached.conf
PORT="11211"
USER="memcached"
MAXCONN="2048"
CACHESIZE="2048"
OPTIONS="-l 127.0.0.1"

service memcached restart
apt-get install php5-memcached
------------------------------------------

DEBIAN COMMANDS:
service php5-fpm restart
service nginx restart
service mysql restart
service apache2 restart

6. Step
Performance Tuning for Magento CE 1.9.2.4 with PHP 7
Root-Server Debian 8.3 plesk 12.5

  • Intel® Core™ i7-6700 Quad-Core Skylake
  • 32 GB DDR4 RAM
  • 2 x 500 GB 6 Gb/s SSD (Software-RAID 1)
  • 1 Gbit/s

6. Tuning PHP Plesk for Domain
----------------------------
pm.max_children = 500
pm.process_idle_timeout = 5s
realpath_cache_size = 5M
realpath_cache_ttl = 86400
max_execution_time = 18000
max_input_time = 18000
memory_limit = 1024M
default_socket_timeout = 120
pdo_mysql.cache_size = 2000
output_buffering = 4096
post_max_size = 200M
upload_max_filesize = 200M
opcache.revalidate_freq=0
opcache.validate_timestamps=0
opcache.max_accelerated_files=16000
opcache.memory_consumption=512
opcache.interned_strings_buffer=12
opcache.fast_shutdown=1
opcache.save_comments=0
opcache.load_comments=0
opcache.enable_file_override=1
opcache.log_verbosity_level=1
opcache.error_log=/var/log/php5/php5-opcache.error.log
opcache.error_log=/var/log/php5/php5-opcache.error.log

7. Step
Performance Tuning for Magento CE 1.9.2.4 with PHP 7
Root-Server Debian 8.3 plesk 12.5

  • Intel® Core™ i7-6700 Quad-Core Skylake
  • 32 GB DDR4 RAM
  • 2 x 500 GB 6 Gb/s SSD (Software-RAID 1)
  • 1 Gbit/s

7. Tuning for syctl in etc/sysctl.conf _!!!!!!!!!! Very carefully Please!!!!!!!!
-------------------------
# Kernel sysctl configuration file for Linux
#
# Version 1.12 - 2015-09-30
# Michiel Klaver - IT Professional
# Для просмотра ссылки Войди или Зарегистрируйся for the latest version - Для просмотра ссылки Войди или Зарегистрируйся for a BSD variant
#
# This file should be saved as /etc/sysctl.conf and can be activated using the command:
# sysctl -e -p /etc/sysctl.conf
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and sysctl.conf(5) for more details.
#
# Tested with: Ubuntu 14.04 LTS kernel version 3.13
# Debian 7 kernel version 3.2
# CentOS 7 kernel version 3.10

#
# Intended use for dedicated server systems at high-speed networks with loads of RAM and bandwidth available
# Optimised and tuned for high-performance web/ftp/mail/dns servers with high connection-rates
# DO NOT USE at busy networks or xDSL/Cable connections where packetloss can be expected
# ----------

# Credits:
# Для просмотра ссылки Войди или Зарегистрируйся
# Для просмотра ссылки Войди или Зарегистрируйся
# Для просмотра ссылки Войди или Зарегистрируйся
# Для просмотра ссылки Войди или Зарегистрируйся
# Для просмотра ссылки Войди или Зарегистрируйся
# Для просмотра ссылки Войди или Зарегистрируйся
# Для просмотра ссылки Войди или Зарегистрируйся
# Для просмотра ссылки Войди или Зарегистрируйся
# Для просмотра ссылки Войди или Зарегистрируйся
# Для просмотра ссылки Войди или Зарегистрируйся
# Для просмотра ссылки Войди или Зарегистрируйся
# Для просмотра ссылки Войди или Зарегистрируйся
# Для просмотра ссылки Войди или Зарегистрируйся



###
### GENERAL SYSTEM SECURITY OPTIONS ###
###

# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1

#Allow for more PIDs
kernel.pid_max = 65535

# The contents of /proc/<pid>/maps and smaps files are only visible to
# readers that are allowed to ptrace() the process
kernel.maps_protect = 1

#Enable ExecShield protection
kernel.exec-shield = 1
kernel.randomize_va_space = 2

# Controls the maximum size of a message, in bytes
kernel.msgmnb = 65535

# Controls the default maxmimum size of a mesage queue
kernel.msgmax = 65535

# Restrict core dumps
fs.suid_dumpable = 0

# Hide exposed kernel pointers
kernel.kptr_restrict = 1



###
### IMPROVE SYSTEM MEMORY MANAGEMENT ###
###

# Increase size of file handles and inode cache
fs.file-max = 209708

# Do less swapping
vm.swappiness = 30
vm.dirty_ratio = 30
vm.dirty_background_ratio = 5

# specifies the minimum virtual address that a process is allowed to mmap
vm.mmap_min_addr = 4096

# 50% overcommitment of available memory
vm.overcommit_ratio = 50
vm.overcommit_memory = 0

# Set maximum amount of memory allocated to shm to 256MB
kernel.shmmax = 268435456
kernel.shmall = 268435456

# Keep at least 64MB of free RAM space available
vm.min_free_kbytes = 65535



###
### GENERAL NETWORK SECURITY OPTIONS ###
###

#Prevent SYN attack, enable SYNcookies (they will kick-in when the max_syn_backlog reached)
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_syn_retries = 2
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_max_syn_backlog = 4096

# Disables packet forwarding
net.ipv4.ip_forward = 0
net.ipv4.conf.all.forwarding = 0
net.ipv4.conf.default.forwarding = 0
net.ipv6.conf.all.forwarding = 0
net.ipv6.conf.default.forwarding = 0

# Disables IP source routing
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.default.accept_source_route = 0
net.ipv6.conf.all.accept_source_route = 0
net.ipv6.conf.default.accept_source_route = 0

# Enable IP spoofing protection, turn on source route verification
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1

# Disable ICMP Redirect Acceptance
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.all.secure_redirects = 0
net.ipv4.conf.default.secure_redirects = 0
net.ipv6.conf.all.accept_redirects = 0
net.ipv6.conf.default.accept_redirects = 0

# Enable Log Spoofed Packets, Source Routed Packets, Redirect Packets
net.ipv4.conf.all.log_martians = 1
net.ipv4.conf.default.log_martians = 1

# Decrease the time default value for tcp_fin_timeout connection
net.ipv4.tcp_fin_timeout = 7

# Decrease the time default value for connections to keep alive
net.ipv4.tcp_keepalive_time = 10
net.ipv4.tcp_keepalive_probes = 5
net.ipv4.tcp_keepalive_intvl = 15

# Don't relay bootp
net.ipv4.conf.all.bootp_relay = 0

# Don't proxy arp for anyone
net.ipv4.conf.all.proxy_arp = 0

# Turn on the tcp_timestamps, accurate timestamp make TCP congestion control algorithms work better
net.ipv4.tcp_timestamps = 1

# Don't ignore directed pings
net.ipv4.icmp_echo_ignore_all = 0

# Enable ignoring broadcasts request
net.ipv4.icmp_echo_ignore_broadcasts = 1

# Enable bad error message Protection
net.ipv4.icmp_ignore_bogus_error_responses = 1

# Allowed local port range
net.ipv4.ip_local_port_range = 16384 65535

# Enable a fix for RFC1337 - time-wait assassination hazards in TCP
net.ipv4.tcp_rfc1337 = 1

# Do not auto-configure IPv6
net.ipv6.conf.all.autoconf=0
net.ipv6.conf.all.accept_ra=0
net.ipv6.conf.default.autoconf=0
net.ipv6.conf.default.accept_ra=0
net.ipv6.conf.eth0.autoconf=0
net.ipv6.conf.eth0.accept_ra=0



###
### TUNING NETWORK PERFORMANCE ###
###

# For high-bandwidth low-latency networks, use 'htcp' congestion control
# Do a 'modprobe tcp_htcp' first
net.ipv4.tcp_congestion_control = htcp

# For servers with tcp-heavy workloads, enable 'fq' queue management scheduler (kernel > 3.12)
net.core.default_qdisc = fq

# Turn on the tcp_window_scaling
net.ipv4.tcp_window_scaling = 1

# Increase the read-buffer space allocatable
net.ipv4.tcp_rmem = 8192 87380 16777216
net.ipv4.udp_rmem_min = 16384
net.core.rmem_default = 262144
net.core.rmem_max = 16777216

# Increase the write-buffer-space allocatable
net.ipv4.tcp_wmem = 8192 65536 16777216
net.ipv4.udp_wmem_min = 16384
net.core.wmem_default = 262144
net.core.wmem_max = 16777216

# Increase number of incoming connections
net.core.somaxconn = 32768

# Increase number of incoming connections backlog
net.core.netdev_max_backlog = 16384
net.core.dev_weight = 64

# Increase the maximum amount of option memory buffers
net.core.optmem_max = 65535

# Increase the tcp-time-wait buckets pool size to prevent simple DOS attacks
net.ipv4.tcp_max_tw_buckets = 1440000

# try to reuse time-wait connections, but don't recycle them (recycle can break clients behind NAT)
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_tw_reuse = 1

# Limit number of orphans, each orphan can eat up to 16M (max wmem) of unswappable memory
net.ipv4.tcp_max_orphans = 10
net.ipv4.tcp_orphan_retries = 1

# Increase the maximum memory used to reassemble IP fragments
net.ipv4.ipfrag_high_thresh = 512000
net.ipv4.ipfrag_low_thresh = 446464

# don't cache ssthresh from previous connection
net.ipv4.tcp_no_metrics_save = 1
net.ipv4.tcp_moderate_rcvbuf = 1

# Increase size of RPC datagram queue length
net.unix.max_dgram_qlen = 50

# Don't allow the arp table to become bigger than this
net.ipv4.neigh.default.gc_thresh3 = 2048

# Tell the gc when to become aggressive with arp table cleaning.
# Adjust this based on size of the LAN. 1024 is suitable for most /24 networks
net.ipv4.neigh.default.gc_thresh2 = 1024

# Adjust where the gc will leave arp table alone - set to 32.
net.ipv4.neigh.default.gc_thresh1 = 32

# Adjust to arp table gc to clean-up more often
net.ipv4.neigh.default.gc_interval = 30

# Increase TCP queue length
net.ipv4.neigh.default.proxy_qlen = 96
net.ipv4.neigh.default.unres_qlen = 6

# Enable Explicit Congestion Notification (RFC 3168), disable it if it doesn't work for you
net.ipv4.tcp_ecn = 1
net.ipv4.tcp_reordering = 3

# How many times to retry killing an alive TCP connection
net.ipv4.tcp_retries2 = 15
net.ipv4.tcp_retries1 = 3

# Avoid falling back to slow start after a connection goes idle
# keeps our cwnd large with the keep alive connections (kernel > 3.6)
net.ipv4.tcp_slow_start_after_idle = 0

# Allow the TCP fastopen flag to be used, beware some firewalls do not like TFO! (kernel > 3.7)
net.ipv4.tcp_fastopen = 3

# This will enusre that immediatly subsequent connections use the new values
net.ipv4.route.flush = 1
net.ipv6.route.flush = 1



###
### Comments/suggestions/additions are welcome!
###
--------------------------------------

8. Step
Performance Tuning for Magento CE 1.9.2.4 with PHP 7
Root-Server Debian 8.3 plesk 12.5

  • Intel® Core™ i7-6700 Quad-Core Skylake
  • 32 GB DDR4 RAM
  • 2 x 500 GB 6 Gb/s SSD (Software-RAID 1)
  • 1 Gbit/s

8. Tuning for .htaccess fim Magento root for more speed




############################################
## uncomment these lines for CGI mode
## make sure to specify the correct cgi php binary file name
## it might be /cgi-bin/php-cgi

# Action php5-cgi /cgi-bin/php5-cgi
# AddHandler php5-cgi .php

############################################
## GoDaddy specific options

# Options -MultiViews

## you might also need to add this line to php.ini
## cgi.fix_pathinfo = 1
## if it still doesn't work, rename php.ini to php5.ini

############################################
## this line is specific for 1and1 hosting

#AddType x-mapp-php5 .php
#AddHandler x-mapp-php5 .php

############################################
## default index file

DirectoryIndex index.php

############################################
## force the latest IE version, in various cases when it may fall back to IE7 mode
## github.com/rails/rails/commit/123eb25#commitcomment-118920
## Use ChromeFrame if it's installed for a better experience for the poor IE folk
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
BrowserMatch MSIE ie
Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
</IfModule>
</IfModule>

<IfModule mod_headers.c>
## Because X-UA-Compatible isn't sent to non-IE (to save header bytes),
## We need to inform proxies that content changes based on UA
Header append Vary User-Agent
## Cache control is set only if mod_headers is enabled, so that's unncessary to declare
</IfModule>

<IfModule mod_php5.c>

############################################
## Serve cross-domain ajax requests, disabled.
# enable-cors.org
# code.google.com/p/html5security/wiki/CrossOriginRequestSecurity
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>

############################################
## webfont access
# allow access from all domains for webfonts
# alternatively you could only whitelist
# your subdomains like "sub.domain.com"
<FilesMatch "\.(ttf|otf|eot|woff|font.css)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>

############################################
## proper MIME type for all files
# audio
AddType audio/ogg oga ogg

# video
AddType video/ogg ogv
AddType video/mp4 mp4
AddType video/webm webm

# Proper svg serving. Required for svg webfonts on iPad
# twitter.com/FontSquirrel/status/14855840545
AddType image/svg+xml svg svgz
AddEncoding gzip svgz

# webfonts
AddType application/vnd.ms-fontobject eot
AddType font/truetype ttf
AddType font/opentype otf
AddType application/x-font-woff woff

# assorted types
AddType image/x-icon ico
AddType image/webp webp
AddType text/cache-manifest appcache manifest
AddType text/x-component htc
AddType application/x-chrome-extension crx
AddType application/x-xpinstall xpi
AddType application/octet-stream safariextz

############################################
## adjust memory limit

# php_value memory_limit 64M
# php_value memory_limit 256M
# php_value max_execution_time 18000

############################################
## disable magic quotes for php request vars

php_flag magic_quotes_gpc off

############################################
## disable automatic session start
## before autoload was initialized

php_flag session.auto_start off

############################################
## enable resulting html compression

php_flag zlib.output_compression on

###########################################
# disable user agent verification to not break multiple image upload

php_flag suhosin.session.cryptua off

###########################################
# turn off compatibility with PHP4 when dealing with objects

php_flag zend.ze1_compatibility_mode Off

</IfModule>

<IfModule mod_security.c>
###########################################
# disable POST processing to not break multiple image upload

SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

<IfModule mod_deflate.c>

############################################
## enable apache served files compression
## Для просмотра ссылки Войди или Зарегистрируйся

# Insert filter on all content
SetOutputFilter DEFLATE
# Insert filter on selected content types only
#AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript

# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# Don't compress images
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary

</IfModule>

<IfModule mod_ssl.c>

############################################
## make HTTPS env vars available for CGI mode

SSLOptions StdEnvVars

</IfModule>

<IfModule mod_rewrite.c>

############################################
## enable rewrites

Options +FollowSymLinks
RewriteEngine on

############################################
## you can put here your magento root folder
## path relative to web root

#RewriteBase /magento/

############################################
## workaround for HTTP authorization
## in CGI environment

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

############################################
## always send 404 on missing files in these folders

RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

############################################
## never rewrite for existing files, directories and links

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

############################################
## rewrite "Для просмотра ссылки Войди или Зарегистрируйся -> domain.com"

#RewriteCond %{HTTPS} !=on
#RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
#RewriteRule ^(.*)$ Для просмотра ссылки Войди или Зарегистрируйся [R=301,L]

############################################
## to rewrite "domain.com -> Для просмотра ссылки Войди или Зарегистрируйся" uncomment the following lines.
# be aware that the following rule might not be a good idea if you
# use "real" subdomains for certain parts of your website.

#RewriteCond %{HTTPS} !=on
#RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
#RewriteCond %{HTTP_HOST} (.+)$ [NC]
#RewriteRule ^(.*)$ Для просмотра ссылки Войди или Зарегистрируйся [R=301,L]

############################################
## rewrite everything else to index.php

RewriteRule .* index.php [L]

</IfModule>


############################################
## Prevent character encoding issues from server overrides
## If you still have problems, use the second line instead

#AddDefaultCharset Off
AddDefaultCharset UTF-8
# force utf-8 for a number of file formats
AddCharset utf-8 .html .css .js .xml .json .rss

<IfModule mod_expires.c>

############################################
## Add default Expires header
# these are pretty far-future expires headers
# they assume you control versioning with cachebusting query params like
# <script src="application.js?20100608">
# additionally, consider that outdated proxies may miscache
# Для просмотра ссылки Войди или Зарегистрируйся

# if you don't use filenames to version, lower the css and js to something like
# "access plus 1 week" or so instead of "access plus 2 months"

ExpiresActive on

# Perhaps better to whitelist expires rules? Perhaps.
ExpiresDefault "access plus 1 month"

# cache.appcache needs re-requests in FF 3.6 (thx Remy ~Introducing HTML5)
ExpiresByType text/cache-manifest "access plus 0 seconds"

# your document html
ExpiresByType text/html "access plus 0 seconds"

# data
ExpiresByType text/xml "access plus 0 seconds"
ExpiresByType application/xml "access plus 0 seconds"
ExpiresByType application/json "access plus 0 seconds"

# rss feed
ExpiresByType application/rss+xml "access plus 1 hour"

# favicon (cannot be renamed)
ExpiresByType image/x-icon "access plus 1 week"

# media: images, video, audio
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType video/ogg "access plus 1 month"
ExpiresByType audio/ogg "access plus 1 month"
ExpiresByType video/mp4 "access plus 1 month"
ExpiresByType video/webm "access plus 1 month"

# htc files (css3pie)
ExpiresByType text/x-component "access plus 1 month"

# webfonts
ExpiresByType font/truetype "access plus 1 month"
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType application/x-font-woff "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"

# css and javascript
ExpiresByType text/css "access plus 1 week"
ExpiresByType application/javascript "access plus 1 week"
ExpiresByType text/javascript "access plus 1 week"

<IfModule mod_headers.c>
Header append Cache-Control "public"
</IfModule>

</IfModule>

############################################
## By default allow all access

Order allow,deny
Allow from all

############################################
## Since we're sending far-future expires, we don't need ETags for static content.
## developer.yahoo.com/performance/rules.html#etags

FileETag none

.htaccess
 

Вложения

  • magento-htaccess-master.zip
    3,4 KB · Просмотры: 20
  • Magento-htaccess-Boilerplate-master.zip
    4,1 KB · Просмотры: 22
Последнее редактирование модератором:
Народ, выручайте. не работает сохранения параметров в атрибуте с типом multiselect. на php5 все ок

Ошибки в логах есть? Как заставили работать с PHP7 ???
Модули какие??? Версия Мадженты? Или на кофейной гуще гадать?
ошибок нет,
конфигурация: vestacp (nginx+apache) PHP Version 7.0.4-1+deb.sury.org~trusty+1
Версия мадженты 1.9.2.4
Установка:
  1. sudo apt-get -y purge php5
  2. sudo apt-get remove php5-common
  3. apt-get autoremove php5
  4. sudo apt-get install python-software-properties
  5. sudo apt-get install software-properties-common python-software-properties
  6. sudo add-apt-repository ppa:eek:ndrej/php-7.0 или LC_ALL=en_US.UTF-8 add-apt-repository ppa:eek:ndrej/php
  7. sudo apt-get update
  8. sudo apt-get install -y php7.0 или sudo apt-get install php7.0
  9. apt-get install php7.0-mysql
  10. sudo apt-get install php7.0-mcrypt
  11. sudo apt-get install php-curl
  12. sudo apt-get install php7.0-gd
  13. apt-get install libapache2-mod-php
  14. apt-get install php7.0-mbstring php7.0-zip php7.0-xml
  15. apt-get install php7.0-soap
  16. sudo reboot


Доп. (перепроверить)
sudo apt-get install php7.0-cli php7.0-common libapache2-mod-php7.0 php7.0 php7.0-mysql php7.0-fpm php7.0-curl php7.0-json php7.0-cgi php7.0-mcrypt
sudo apt-get install php7.0-intl php7.0-xsl php7.0-gd
sudo apt-get install libapache2-mod-php7.0
sudo apt-get install php7.0-mcrypt
udo apt-get install php7.0-soap php7.0-mbstring
 
Последнее редактирование модератором:
Народ, выручайте. не работает сохранения параметров в атрибуте с типом multiselect. на php5 все ок
Ошибки в логах есть? Как заставили работать с PHP7 ???
Модули какие??? Версия Мадженты? Или на кофейной гуще гадать?
 
Присутствует аналогичная проблема:
2016-03-08 22-53-59 Скриншот экрана.png
После сохранения, параметры в карточке не сохраняются. Артибут Multiselect Magento вер. 1.9.2.3 на PHP 7.0.3 запущен с модулем Inchoo. Инсталляция с нуля, т.е. не перенос с локала.
Update:
Через magento manager параметры сохраняются, но через админку вновь не поддаются изменениям.
 
ошибок нет,
конфигурация: vestacp (nginx+apache) PHP Version 7.0.4-1+deb.sury.org~trusty+1

В схожей конфигурации (и nginx + php-fpm, и apache + libapache2-mod-php) все работает...
multiple.jpg
server.jpg

вот что еще обнаружил, если выбрать параметры через
Посмотреть вложение 70309
то параметры мультивыбора сохраняются, баг только при сохранении через карточку товара
Дело скорее всего не в версии PHP. У меня в обоих случаях сохраняются значения атрибута.
 
Последнее редактирование модератором:
В схожей конфигурации (и nginx + php-fpm, и apache + libapache2-mod-php) все работает...
Посмотреть вложение 70295
Посмотреть вложение 70296
может модуль какой пропустил, скинь свой список

В схожей конфигурации (и nginx + php-fpm, и apache + libapache2-mod-php) все работает...
Посмотреть вложение 70295
Посмотреть вложение 70296
вот что еще обнаружил, если выбрать параметры через
upload_2016-3-9_13-26-12.png
то параметры мультивыбора сохраняются, баг только при сохранении через карточку товара
 
Последнее редактирование модератором:
настроил php7 dotweb + php7.0-fpm + nginx + magentoCE 1.9.2.4 - вроде быстро летает
 
В схожей конфигурации (и nginx + php-fpm, и apache + libapache2-mod-php) все работает...
Посмотреть вложение 70295
Посмотреть вложение 70296


Дело скорее всего не в версии PHP. У меня в обоих случаях сохраняются значения атрибута.
Коллеги, подскажите, как сделать апгрейд версии php7
текущая
PHP Version 7.0.4-6+deb.sury.org~trusty+5
нужна
PHP Version 7.0 7.0.4-6+deb.sury.org~trusty+5
 
так вроде
update php
из консоли под рутом. (если linux система)

только смотри какие пакеты будут обновлены (и смотри какие репозитории у тебя прописаны)
 
Апдейтнуться попробуй по стандартному методу:

Код:
add-apt-repository ppa:ondrej/php (если не добавил)
apt-get update
apt-get install php7.0

Либо можешь просто качнуть .deb файл свежий и с помощью dpkg -i его поставить.
 
Назад
Сверху