Архиви на блога

php recursive delete

This function do recursive delete on files and folders in php function recursiveDelete($str){ if(is_file($str)){ return @unlink($str); } elseif(is_dir($str)){ $scan = glob(rtrim($str,’/’).’/*’); foreach($scan as $index=>$path){ recursiveDelete($path); } return @rmdir($str); } }

С етикет: , , ,
Публикувано в linux, php

debuging high IO wait under linux

To do that you can use block IO debugging capability of Linux kernel. echo 1 > /proc/sys/vm/block_dump After this run dmesg | egrep „READ|WRITE|dirtied“ |  awk ‘{print $1}’|  sort | uniq -c | sort -rn | head 1583 kjournald(2764): 545

Публикувано в linux

php post with big array

Starting from php 5.3.9 there is brand new config option max_input_vars which is limiting the input variables to posted arrays and etc. max_input_vars integer How many input variables may be accepted (limit is applied to $_GET, $_POST and $_COOKIE superglobal

С етикет: , , , ,
Публикувано в linux

mysql import all sql files from directory

for SQL in *.sql; do  echo importing $SQL; mysql -u user  -ppassword table< $SQL;rm $SQL; done

С етикет: , , , , , ,
Публикувано в linux

mysql export every table in different file

#!/bin/bash # dump-tables-mysql.sh # Descr: Dump MySQL table data into separate SQL files for a specified database. # Usage: Run without args for usage info. # Author: @Trutane # Ref: http://stackoverflow.com/q/3669121/138325 # Notes: # * Script will prompt for password

С етикет: , ,
Публикувано в linux