pm = dynamic
pm.max_children = 100
pm.start_servers = 3
pm.min_spare_servers = 3
pm.max_spare_servers = 15
pm.max_requests = 100
max_children:
Этот параметр устанавливает ограничение на число одновременных запросов, которые будут обслуживаться
<html>
<body>
<img width="500" height="200" usemap="#somemap" src="upload.wikimedia.org/wikipedia/commons/e/e0/Figures_for_imagemap.png">
<map name="somemap">
<area shape="rect" coords="6, 7, 140, 196" href="ru.wikipedia.org/Прямоугольник">
<area shape="circle" coords="239, 98, 92" href="ru.wikipedia.org/Круг">
<area shape="poly" coords="386,16, 344,56, 350,189, 385,132, 489,190, 496,74, 386,16" href="ru.wikipedia.org/Многоугольник">
</map>
</body>
</html>
function showCart() {
total += cart[id]*goods[id].cost;
location ~ ^/auth/ {
root /var/www/news.site.ru/news;
index index.php;
}
function faq_substr($str, $start, $length, $charset = 'utf-8') {
....
if ($tempresult='0') ....
// вариант №1
if ($tempresult === 1) {
echo "Раз";
} else {
echo "$tempresult";
}
// вариант №2
$tempresult = 1;
switch ($tempresult) {
case 1:
echo 'Раз';
break;
case 2:
echo 'Два';
break;
default:
echo "$tempresult";
break;
}
MAILTO="admin@mail.ru"
* * * * * /bin/myjob.sh
MAILTO="admin@mail.ru"
* * * * * /bin/myjob.sh > /dev/null
r = 4
w = 2
x = 1
- = 0
$result = $dbh->query("SELECT id FROM test.news LIMIT 3")->fetchAll(PDO::FETCH_ASSOC);
// получили из БД список ID
// +-----+
// | id |
// +-----+
// | 100 |
// | 101 |
// | 102 |
// +-----+
$exist = [];
// делаем массив у которого ключ = ID, а значение = true
foreach ($result as $row) {
$exist[$row['id']] = true;
}
// массив новостей
$news = [
[ "id" => 102 , "titile" => "news title", "text" => "news text" ],
[ "id" => 1001, "titile" => "news title", "text" => "news text" ]
];
// проходим по каждому элементу массива с новостями
foreach ($news as $key => $item) {
// проверяем если ли в БД новость с таким ID
if (isset($exist[$item['id']]) && $exist[$item['id']] === true) {
// если такой новости нет - удаляем из массива с новостями
unset($news[$key]);
}
}
INSERT INTO ..... ON DUPLICATE KEY UPDATE updated_at = NOW()
CREATE DATABASE test;
use test;
CREATE TABLE t (a varchar(255), b varchar(255));
-- повесим триггер на INSERT
-- триггер будет брать значение из "...." и вставлять его в поле 'b'
CREATE TRIGGER before_insert_test_t
BEFORE INSERT ON test.t
FOR EACH ROW
SET new.b = SUBSTRING_INDEX(SUBSTRING_INDEX(new.a, '"', 2), '"', -1);
INSERT INTO t (a) VALUES('text text "QWERTY" text text');
SELECT * FROM t;
+------------------------------+--------+
| a | b |
+------------------------------+--------+
| text text "QWERTY" text text | QWERTY |
+------------------------------+--------+
CREATE TABLE t
(
a varchar(255),
b varchar(255) default (SUBSTRING_INDEX(SUBSTRING_INDEX(a, '"', 2), '"', -1);)
);
/var/lib/mysql/mysqld.log {
.....
postrotate
if test -x /usr/bin/mysqladmin && /usr/bin/mysqladmin ping &>/dev/null
then
/usr/bin/mysqladmin flush-logs
fi
endscript
}
curl -X POST -d 'phone[]=value1&phone[]=value2' 'http://host/page -v
<input type="text" name="phone[]" value="1" />
<input type="text" name="phone[]" value="2" />
select User from mysql.user where User = 'Root'
Empty set (0.00 sec)
select User from mysql.user where User = 'Root' COLLATE utf8_general_ci;
+------+
| User |
+------+
| root |
+------+
select User from mysql.user where User = 'Root' COLLATE utf8_bin;
Empty set (0.00 sec)
COLLATE utf8_bin;
apt-cache search php
UPDATE table_name
SET claim = CONCAT( claim, 'тут текст который надо добвить')
WHERE ...
for w in "for" "if" "continue"; do tmp=$(mktemp); grep -P "\b$w\b" * -R | grep -v 'Binary file' | awk -F":" '{print $1}' > $tmp; echo "word: $w"; cat $tmp | sort | uniq -c | sort -hr | head -n 10; rm -f $tmp; done
word: for
471 __init__.py
141 depsolve.py
127 rpmsack.py
104 sqlitesack.py
93 packageSack.py
88 comps.py
81 history.py
74 packages.py
73 yumRepo.py
58 updateinfo.py
word: if
1024 __init__.py
317 yumRepo.py
297 packages.py
248 depsolve.py
235 rpmsack.py
233 sqlitesack.py
189 history.py
155 misc.py
149 pgpmsg.py
116 config.py
word: continue
144 __init__.py
47 depsolve.py
35 rpmsack.py
30 sqlitesack.py
19 yumRepo.py
16 history.py
14 updateinfo.py
14 transactioninfo.py
14 packages.py
14 misc.py
curl -m 1 -sS -D - -X HEAD https://hsto.org/r/w120/webt/5a/80/fd/5a80fd8c368f0954751429.png 2>/dev/null | grep -Po '(?<=Content-Length: )(\d+)|((?<=Content-Type: )[a-z\-]+/[a-z\-]+)'
image/png
12597
create table t (
name varchar(255),
value varchar(255)
);
insert into t values('name1', 'value1');
insert into t values('name2', 'value2');
insert into t values('name3', 'value3');
insert into t values('name4', 'value4');
insert into t values('name5', 'value5');
insert into t values('name6', 'value6');
insert into t values('name7', 'value7');
insert into t values('name8', 'value8');
insert into t values('name9', 'value9');
insert into t values('name10', 'value10');
insert into t values('name11', 'value11');
insert into t values('name12', 'value12');
insert into t values('name13', 'value13');
insert into t values('name14', 'value14');
insert into t values('name15', 'value15');
-- каждый 5-й
SELECT
num, name, value
FROM (
SELECT (@RN:=@RN+1) AS num, name, value
FROM t, (SELECT @RN:=0) AS t
) as d
WHERE num % 5 = 0;
+------+--------+---------+
| num | name | value |
+------+--------+---------+
| 5 | name5 | value5 |
| 10 | name10 | value10 |
| 15 | name15 | value15 |
+------+--------+---------+
-- каждый 3-й
SELECT
num, name, value
FROM (
SELECT (@RN:=@RN+1) AS num, name, value
FROM t, (SELECT @RN:=0) AS t
) as d
WHERE num % 3 = 0;
+------+--------+---------+
| num | name | value |
+------+--------+---------+
| 3 | name3 | value3 |
| 6 | name6 | value6 |
| 9 | name9 | value9 |
| 12 | name12 | value12 |
| 15 | name15 | value15 |
+------+--------+---------+