Category Archives: Hosting

tuning load in prestashop

Preferences / SEO & URLs

Set up URLs:
Friendly URL YES
Accented URL YES
Automatically redirect to the canonical URL YES
Disable apache multiviews YES
Disable apache mod security YES

Smarty Cache:
Never recompile template files
Check Cache
Do not open console

CCC (Combine, Compress and Cache):
Use CCC for CSS
Use CCC for JavaScript.
Keep HTML as original
Keep inline JavaScript in HTML as original
Check Apache optimization

Ciphering
Use Rijndael with mcrypt lib.

Caching
Check Use cache
Caching system : File System

Implementing browser static cached file for prestashop
Its a fancy name, but its really just some .htaccess rules with some expire and caching headers. Se bellow:
Apache


ForceType text/html
FileETag None

AddEncoding gzip .gz
AddType text/html .gz


SetEnvIfNoCase Request_URI .gz$ no-gzip


Header set Vary “Accept-Encoding, Cookie”
Header set Cache-Control ‘max-age=3600, must-revalidate’


ExpiresActive On
ExpiresByType text/html A3600

change domain in Magento

Update your core_config_data table to edit the two records for web/unsecure/base_url and web/secure/base_url
Delete the contents of WEBROOT/var/cache
Update / edit any .htaccess domain redirects you may have added
Restart Apache
Make sure Apache has write permissions to WEBROOT/var
If you created a new DB, ensure that the WEBROOT/app/etc/local.xml is pointing to it.
If you’re using Chrome, clear your browser cache! (Chrome caches 301s)

configuring PHP and suEXEC command line suphp

Usage: /usr/local/cpanel/bin/rebuild_phpconf [–dryrun] [–no-restart] [–no-htaccess]
[–current|–available]
–dryrun : Only display the changes that would be made
–no-restart : Don’t restart Apache after updating the php.conf link
–no-htaccess : Don’t update user configurable PHP mime mapping.
–current : Show current settings
–available : Show available handlers and PHP SAPIs
: Version of PHP to set as default handler for .php files
<PHP# Handler> : Type of Apache module to use in serving PHP requests
: enabled, disabled, 1 or 0

/usr/local/cpanel/bin/rebuild_phpconf 5 cgi cgi 1

startup script for memcached processes

#!/bin/sh
#
# memcached Startup script for memcached processes
#
# chkconfig: – 90 10
# description: Memcache provides fast memory based storage.
# processname: memcached

# These mappings correspond one-to-one with Drupal’s settings.php file.

[ -f memcached ] || exit 0

prog=”memcached”

start() {
echo -n $”Starting $prog ”
# Sessions cache.
memcached -m 16 -l 0.0.0.0 -p 11211 -d -u nobody
# Default cache.
memcached -m 32 -l 0.0.0.0 -p 11212 -d -u nobody
# Block cache.
memcached -m 32 -l 0.0.0.0 -p 11213 -d -u nobody
# Content cache. Holds fully loaded content type structures.
memcached -m 16 -l 0.0.0.0 -p 11214 -d -u nobody
# Filter cache. Usually the busiest cache after the default.
memcached -m 32 -l 0.0.0.0 -p 11215 -d -u nobody
# Form cache.
memcached -m 32 -l 0.0.0.0 -p 11216 -d -u nobody
# Menu cache.
memcached -m 32 -l 0.0.0.0 -p 11217 -d -u nobody
# Page cache. Bigger than most other caches.
memcached -m 128 -l 0.0.0.0 -p 11218 -d -u nobody
# Views definition cache.
memcached -m 1 -l 0.0.0.0 -p 11219 -d -u nobody
# Views data cache (may need to be increased if heavily used).
memcached -m 32 -l 0.0.0.0 -p 11220 -d -u nobody

# More caches that might be added later:

# Users table.
#/usr/bin/memcached -m 24 -l 0.0.0.0 -p 11219 -d -u nobody
# Path source cache.
#/usr/bin/memcached -m 4 -l 0.0.0.0 -p 11220 -d -u nobody
# Path destination cache.
#/usr/bin/memcached -m 6 -l 0.0.0.0 -p 11221 -d -u nobody
RETVAL=$?
echo
return $RETVAL
}

stop() {
if test “x`pidof memcached`” != x; then
echo -n $”Stopping $prog ”
killall memcached
echo
fi
RETVAL=$?
return $RETVAL
}

case “$1” in
start)
start
;;

stop)
stop
;;

restart)
stop
start
;;
condrestart)
if test “x`pidof memcached`” != x; then
stop
start
fi
;;

*)
echo $”Usage: $0 {start|stop|restart|condrestart}”
exit 1

esac

exit $RETVAL

memcache on CentOS

yum install memcached php-pecl-memcache
pecl install memcache

if pecl fail you can install from source:
wget http://pecl.php.net/get/memcache
tar xvfz memcache-*
cd memcache*
phpize
./configure
make && make install
echo extension=memcache.so >> /etc/php.ini

service httpd restart
service memcached start
or maybe run manually:
memcached -d -m 512 -l 127.0.0.1 -p 11211 -u nobody

php_pcre.h:29:18: error: pcre.h: No such file or directory

/usr/local/include/php/ext/pcre/php_pcre.h:29:18: error: pcre.h: No such file or directory
In file included from /root/tmp/pear/APC/apc.c:45:
/usr/local/include/php/ext/pcre/php_pcre.h:37: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/usr/local/include/php/ext/pcre/php_pcre.h:38: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
/usr/local/include/php/ext/pcre/php_pcre.h:44: error: expected specifier-qualifier-list before ‘pcre’
/root/tmp/pear/APC/apc.c:449: error: expected specifier-qualifier-list before ‘pcre’
/root/tmp/pear/APC/apc.c: In function ‘apc_regex_compile_array’:
/root/tmp/pear/APC/apc.c:510: error: ‘apc_regex’ has no member named ‘preg’
/root/tmp/pear/APC/apc.c:510: error: ‘apc_regex’ has no member named ‘preg’
/root/tmp/pear/APC/apc.c:511: error: ‘apc_regex’ has no member named ‘nreg’
/root/tmp/pear/APC/apc.c:511: error: ‘apc_regex’ has no member named ‘nreg’
/root/tmp/pear/APC/apc.c: In function ‘apc_regex_match_array’:
/root/tmp/pear/APC/apc.c:552: error: ‘apc_regex’ has no member named ‘preg’
/root/tmp/pear/APC/apc.c:552: error: ‘apc_regex’ has no member named ‘preg’
/root/tmp/pear/APC/apc.c:553: error: ‘apc_regex’ has no member named ‘nreg’
/root/tmp/pear/APC/apc.c:553: error: ‘apc_regex’ has no member named ‘nreg’
make: *** [apc.lo] Error 1
ERROR: `make’ failed

How to fix?
yum install pcre-devel

ftp xferlog format

xferlog.legacy:Mon Nov 25 14:21:37 2013 0 79.132.164.230 1830 var/www/html/test.php a _ o r web_user ftp 0 * c

Fri May 14 05:16:12 2010

Date/time stamp, nothing complicated.

0

Transfer time, in whole seconds (this transfer took less than a second, so zero).

::ffff:1.2.3.4

Remote host where the user connected from.

11974

Size of the transferred file (in bytes).

/home/user/public_html/index.php

Full path to the uploaded file.

a

Transfer type, a = ASCII (plain-text files), b = binary (everything else)

_

Action flag, C = compressed, U = uncompressed; T = tar’ed; _ = no action was taken.

i

Direction, i = incoming, o = outgoing, d = deleted.

r

Access mode, a = anonymous user, r = real (normal) user.

user

Local username authenticated with.

ftp

The service being invoked (almost always FTP).

0

Authentication method, 0 = none, 1 = RFC931 authetication.

*

User ID or * if not available (virtual user).

c

Completion status, c = completed, i = incomplete.