пятница, 11 мая 2012 г.

mysqlcheck

http://www.informit.com/articles/article.aspx?p=174365&seqNum=5

понедельник, 9 апреля 2012 г.

php disable_functions

disable_functions = "apache_child_terminate, apache_setenv, define_syslog_variables, escapeshellarg, escapeshellcmd, eval, exec, fp, fput, ftp_connect, ftp_exec, ftp_get, ftp_login, ftp_nb_fput, ftp_put, ftp_raw, ftp_rawlist, highlight_file, ini_alter, ini_get_all, ini_restore, inject_code, openlog, passthru, php_uname, phpAds_remoteInfo, phpAds_XmlRpc, phpAds_xmlrpcDecode, phpAds_xmlrpcEncode, popen, posix_getpwuid, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, posix_setuid, posix_uname, proc_close, proc_get_status, proc_nice, proc_open, proc_terminate, shell_exec, syslog, system, xmlrpc_entity_decode,mail"
or

disable_functions= "exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source "
for VirtualMin
#!/bin/bash
cd /home

for i in `ls`; do
   dir=/home/$i/etc/php5
   if [ -d $dir ]; then

        cd  $dir
        lsattr php.ini
        chattr -i php.ini
        sed -i.bak -e "s@\W*open_basedir\s*=.*@open_basedir = /home/$i@" \
        -e 's@\W*disable_functions\s*=.*@disable_functions = "apache_child_terminate, apache_setenv, define_syslog_variables, escapeshellarg, escapeshellcmd, eval, exec, fp, fput, ftp_connect, ftp_exec, ftp_get, ftp_login, ftp_nb_fput, ftp_put, ftp_raw, ftp_rawlist, highlight_file, ini_alter, ini_get_all, ini_restore, inject_code, openlog, passthru, php_uname, phpAds_remoteInfo, phpAds_XmlRpc, phpAds_xmlrpcDecode, phpAds_xmlrpcEncode, popen, posix_getpwuid, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, posix_setuid, posix_uname, proc_close, proc_get_status, proc_nice, proc_open, proc_terminate, shell_exec, syslog, system, xmlrpc_entity_decode,mail"@' php.ini
        chattr +i php.ini
   else
        echo $i empty           
   fi;
done

суббота, 31 марта 2012 г.

openmeetings over proxy

Relevant section of openmeetings virtual host:

 <VirtualHost *:80>
        ServerAdmin developer@xxxxxxxxxxxx
        ServerName openmeetings.mydomain.com

        ProxyPass / http://openmeetings.mydomain.com:5080/
        ProxyPassReverse / http://openmeetings.mydomain.com:5080/
 ...
 </VirtualHost>

 Relevant section of openmeetings-rtmpt virtual host:

 <VirtualHost *:80>
        ServerAdmin developer@xxxxxxxxxxxx
        ServerName rtmpt.mydomain.com

        ProxyPass /openmeetings http://openmeetings.mydomain.com:5080/openmeetings
        ProxyPassReverse /openmeetings http://openmeetings.mydomain.com:5080/openmeetings

        ProxyPass / http://openmeetings.mydomain.com:8088/
        ProxyPassReverse / http://openmeetings.mydomain.com:8088/
 ...
 </VirtualHost>

 OpenMeetings config:

 red5/webapps/openmeetings/config.xml:

 <rtmphostlocal>rtmpt.mydomain.com</rtmphostlocal>

 <rtmpTunnelport>80</rtmpTunnelport>

 <red5httpport>80</red5httpport>

 --

понедельник, 27 февраля 2012 г.

программы и скрипты для мониторинга здоровья системы

top
htop
atop
iotop
sysstat: sar iostat
vmstat
ps .....
netstat .....
lsof
fuser
smem
pmap
ps -e -O rss,user | awk '/php[^[]/{sum+=$2}END{print sum}'

Prestashop multishop

1) make soft link of image folder from main shop to new shop
ln -fs main_shop/img new_shop/img
2)Rename new_shop_db and main_shop_db to your names in sql procedure and run sql script
DELIMITER $$
DROP PROCEDURE if exists make_linked_tables $$

CREATE PROCEDURE make_linked_tables() 
BEGIN
DECLARE done INT DEFAULT FALSE;
DECLARE str VARCHAR(250);
DECLARE cur CURSOR FOR 
 SELECT table_name FROM information_schema.tables WHERE 
table_schema = 'new_shop_db' AND (table_name LIKE 'ps_product%'
OR  table_name LIKE 'ps_category%') 
UNION
SELECT 'ps_image'
UNION
SELECT 'ps_image_lang'
;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
OPEN cur;
REPEAT
 FETCH cur INTO str;
 SET @s = CONCAT("RENAME TABLE ", str," TO ");
 SET @s = CONCAT(@s,str,"_orig");
 PREPARE sth FROM @s;
 EXECUTE sth;
 DEALLOCATE PREPARE sth;

 SET @s = CONCAT("CREATE VIEW ",str," as SELECT * FROM main_shop_db.",str);
 PREPARE sth2 FROM @s;
 EXECUTE sth2;
 DEALLOCATE PREPARE sth2;

UNTIL done END REPEAT;
CLOSE cur;
END$$
DELIMITER ;
3)Run procedure
CALL make_linked_tables();
DROP PROCEDURE if exists make_linked_tables; 
Manually customize categories list of new shop:
drop table if exists ps_category;
create OR replace view ps_category AS
SELECT * FROM MAIN_SHOP_DB.`ps_category` WHERE 
id_category in ( 1,17,28,35) OR id_parent in (17,28,35);

drop table if exists ps_category_group;
create OR replace view ps_category_group AS
SELECT * FROM MAIN_SHOP_DB.`ps_category_group` WHERE 
id_category in ( SELECT id_category FROM `ps_category` ) ;

drop table if exists ps_category_lang;
create OR replace view ps_category_lang AS
SELECT * FROM MAIN_SHOP_DB.`ps_category_lang` WHERE 
id_category in ( SELECT id_category FROM `ps_category`);

drop table if exists ps_category_product;
create OR replace view ps_category_product AS
SELECT * FROM MAIN_SHOP_DB.`ps_category_product` WHERE 
id_category in ( SELECT id_category FROM `ps_category`) ;

There are  id_category = 1 - main category(required), 17(subcategory optional)  .... 

среда, 25 января 2012 г.

custom php.ini для fastcgi

php5.fcgi  :

#!/bin/bash
PHPRC=$PWD/../etc/php5
#PHPINIDir=$PWD/../etc/php5
#PHP_INI_SCAN_DIR=$PWD/../etc/php5/conf.d
#export PHPINIDir
#export PHP_INI_SCAN_DIR

export PHPINIDIR=$PWD/../etc/php5
export PHP_INI_PATH=$PWD/../etc/php5

export PHPRC
umask 022
export PHP_FCGI_CHILDREN
SCRIPT_FILENAME=$PATH_TRANSLATED
export SCRIPT_FILENAME
exec /usr/bin/php5-cgi
или же в php.ini раскоментировать строчку
; Name for user-defined php.ini (.htaccess) files. Default is ".user.ini"
user_ini.filename = ".user.ini"
и в корневой вебдиректории можно создать файл .user.ini и писать в него конфигурацию php

bash Test

http://www.ibm.com/developerworks/library/l-bash-test/index.html