Skip to content

Instantly share code, notes, and snippets.

View youyo's full-sized avatar

Naoto Ishizawa youyo

View GitHub Profile
@youyo
youyo / fio.sh
Created February 23, 2015 11:40
#!/bin/bash -u
#BS=('4k' '16k' '1m')
#TYPE=('read' 'write' 'randread' 'randwrite')
#IODEPTH=(1 2 4 8 16 32 64)
BS=('4k')
TYPE=('read' 'write' 'randread' 'randwrite')
IODEPTH=(1 2 4 8 16 32 64)
OUTPUT='/tmp/fio.json'
BASE_CMD='fio -ioengine=libaio -direct=1 -invalidate=1 -filename=/tmp/fio.bin -size=10G -numjobs=1 -runtime=60 -group_reporting -name=fio --output-format=json'
#!/usr/bin/env ruby
require 'gruff'
require 'json'
require 'yajl'
require 'pp'
giops = Gruff::Line.new
giops.title = "IOPS Result (bs=4k)"
giops.x_axis_label = 'IO depth'
#!/bin/bash -u
if [ $# -ne 9 ]; then
echo -e "Usage:\t${0} HOSTNAME PASSWORD VCPU MEMORY SWAP DISK IPADDRESS NETMASK GATEWAY"
exit 99
fi
HOSTNAME=${1?need hostname}
PASSWORD=${2?need password}
VCPU=${3?need vcpu}
#!/bin/bash -u
if [ $# -ne 11 ]; then
echo -e "Usage:\t${0} HOSTNAME PASSWORD VCPU MEMORY SWAP DISK IPADDRESS NETMASK GATEWAY OS-TYPE[centos6,centos7] NIC[1,2]"
exit 99
fi
HOSTNAME=${1?need hostname}
PASSWORD=${2?need password}
VCPU=${3?need vcpu}
/usr/local/src/php-5.2.17/ext/dom/node.c: In function 'dom_canonicalization':
/usr/local/src/php-5.2.17/ext/dom/node.c:1953:21: error: dereferencing pointer to incomplete type
ret = buf->buffer->use;
^
In file included from /usr/local/src/php-5.2.17/main/php.h:38:0,
from /usr/local/src/php-5.2.17/ext/dom/node.c:26:
/usr/local/src/php-5.2.17/ext/dom/node.c:1955:40: error: dereferencing pointer to incomplete type
RETVAL_STRINGL((char *) buf->buffer->content, ret, 1);
^
/usr/local/src/php-5.2.17/Zend/zend_API.h:472:14: note: in definition of macro 'ZVAL_STRINGL'
@youyo
youyo / php52install
Last active February 10, 2016 06:00
$ cd /usr/local/src/
$ wget http://museum.php.net/php5/php-5.2.17.tar.gz
$ tar xvzf php-5.2.17.tar.gz
$ cd php-5.2.17
$ cp -a /usr/lib64/apr-1/build/libtool libtool
$ yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel curl curl-devel libjpeg libjpeg-devel \
libpng libpng-devel libXpm libXpm-devel freetype freetype-devel t1lib t1lib-devel gmp gmp-devel libmcrypt libmcrypt-devel \
libmhash libmhash-devel readline readline-devel net-snmp net-snmp-devel libtidy libtidy-devel libxslt libxslt-devel patch \
libtool-ltdl libtool-ltdl-devel
$ patch -p0 -b < ../php-5.2.17.patch
patching file ext/dom/node.c
Hunk #1 succeeded at 1950 (offset 55 lines).
patching file ext/dom/documenttype.c
Hunk #1 succeeded at 215 (offset 10 lines).
patching file ext/simplexml/simplexml.c
Hunk #1 succeeded at 1343 (offset -74 lines).
error: '__GMP_BITS_PER_MP_LIMB' undeclared (first use in this function)
EXT/GMP/GMP.C: IN FUNCTION ‘ZIF_GMP_RANDOM’:
EXT/GMP/GMP.C:1399:69: ERROR: ‘__GMP_BITS_PER_MP_LIMB’ UNDECLARED (FIRST USE IN THIS FUNCTION)
EXT/GMP/GMP.C:1399:69: NOTE: EACH UNDECLARED IDENTIFIER IS REPORTED ONLY ONCE FOR EACH FUNCTION IT APPEARS IN
This time it's PHP bug #50990. In one of comments there susan dot smith dot dev at gmail dot com suggested solution which works and does its magic:
I solved replacing the outdated __GMP_BITS_PER_MP_LIMB defined constant with GMP_LIMB_BITS. The latter is present in all previous versions, and MPIR define it too.
You have to edit file ext/gmp/gmp.c and replace one occurence of __GMP_BITS_PER_MP_LIMB with GMP_LIMB_BITS, in my case it was in line 1399.
@youyo
youyo / php_functions.c
Created February 10, 2016 10:15
sapi/apache2handler/php_functions.c
//AP_DECLARE_DATA extern unixd_config_rec unixd_config;
AP_DECLARE_DATA extern unixd_config_rec ap_unixd_config;
//snprintf(tmp, sizeof(tmp), "%s(%d)/%d", unixd_config.user_name, unixd_config.user_id, unixd_config.group_id);
snprintf(tmp, sizeof(tmp), "%s(%d)/%d", ap_unixd_config.user_name, ap_unixd_config.user_id, ap_unixd_config.group_id);