Posts Tagged ‘performance’

InnoDB engine disabled when specifying a buffer pool size too high

Friday, March 12th, 2010

The InnoDB engine will (silently) not start if innodb_buffer_pool_size too big.

You modified your my.cnf to increase the performance of your DB by tweaking the InnoDB variables.
Then you restarted MySQL for the changes to take effect, everything seems fine, no error message.

Except your InnoDB tables are no longer working.

mysql> SELECT VERSION();
+-----------------------+
| VERSION()             |
+-----------------------+
| 5.1.37-1ubuntu5.1-log |
+-----------------------+
1 row in set (0.00 sec)

mysql>
mysql> SHOW CREATE TABLE users;
ERROR 1286 (42000): Unknown table engine 'InnoDB'
mysql>

You can’t believe your eyes and start double checking for confirmation:

mysql> SHOW VARIABLES LIKE 'have_innodb';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| have_innodb   | NO    |
+---------------+-------+
1 row in set (0.00 sec)
mysql>
mysql> SHOW ENGINES \G
*************************** 1. row ***************************
      Engine: MyISAM
     Support: DEFAULT
     Comment: Default engine as of MySQL 3.23 with great performance
Transactions: NO
          XA: NO
  Savepoints: NO
*************************** 2. row ***************************
      Engine: MRG_MYISAM
     Support: YES
     Comment: Collection of identical MyISAM tables
Transactions: NO
          XA: NO
  Savepoints: NO
*************************** 3. row ***************************
      Engine: BLACKHOLE
     Support: YES
     Comment: /dev/null storage engine (anything you write to it disappears)
Transactions: NO
          XA: NO
  Savepoints: NO
*************************** 4. row ***************************
      Engine: CSV
     Support: YES
     Comment: CSV storage engine
Transactions: NO
          XA: NO
  Savepoints: NO
*************************** 5. row ***************************
      Engine: MEMORY
     Support: YES
     Comment: Hash based, stored in memory, useful for temporary tables
Transactions: NO
          XA: NO
  Savepoints: NO
*************************** 6. row ***************************
      Engine: FEDERATED
     Support: NO
     Comment: Federated MySQL storage engine
Transactions: NULL
          XA: NULL
  Savepoints: NULL
*************************** 7. row ***************************
      Engine: ARCHIVE
     Support: YES
     Comment: Archive storage engine
Transactions: NO
          XA: NO
  Savepoints: NO
7 rows in set (0.00 sec)

mysql>

Yep, InnoDB is definitely gone.

If you try to create an InnoDB table unfortunately the command will not fail:
MySQL will create a MyISAM table behind your back without telling you it couldn’t create an InnoDB table. Ouch.

Examining your /etc/mysql/my.cnf and you see you typed some extra zeros:

innodb_buffer_pool_size=10000M

Probably you were thinking assigning 1G to the buffer pool when in fact it was 10GB, and your server only has 2GB of memory.
Change that to:

innodb_buffer_pool_size=1000M

Restart MySQL and you get your InnoDB tables working again.

mysql> SHOW VARIABLES LIKE 'have_innodb';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| have_innodb   | YES   |
+---------------+-------+
1 row in set (0.00 sec)

mysql>

It’s amazing but MySQL will actually not complain about a value too high when you restart it.
It looked like this to me when the value was too high:

bash# /etc/init.d/mysql restart
 * Stopping MySQL database server mysqld    [ OK ]
 * Starting MySQL database server mysqld    [ OK ]
 * Checking for corrupt, not cleanly closed and upgrade needing tables.
bash#

On an Amazon EC2 Standard Default Small Instance running Ubuntu server, I was surprised to find the limit is very low.
It’s a 32-bit platform with 1.7 GB of memory, 1 EC2 Compute Unit (1 virtual core with 1 EC2 Compute Unit), and 160 GB of local instance storage.

InnoDB could not start when innodb_buffer_pool_size was set to 512M.
However it worked with 256M.

Enabling Memcached on BlueHost

Thursday, March 11th, 2010

Bluehost is a pretty good web hosting company, cheap and leaving you in total control of your website.
That is if you know your way around.
I highly recommend them for dirt cheap hosting yet access to powerful features.

A common complaint against any cheap hosting is the lack of memcached installation by default.
It really doesn’t make sense even business-wise for them because memcached would allow to use less CPU/Memory per site hosted, meaning less total servers, meaning less power drawn, meaning big savings.
The hosting plans charging usually a fixed amount per month or year, reducing CPU/Memory/Servers would really make sense as the savings would be on directly on them.

Anyway, now we need to setup memcached ourselves on a machine we don’t have root access to.
No big deal, we will just have to compile everything ourselves.

Here’s how.

1/ Create an installation folder.

As we cannot write to /usr/, we cannot install any software system wide, so everything will remain local in our home folder.
Let’s call it ~/install/
It will be where you install all your compiled software, acting like the /usr/ folder we don’t have access to.

bash# mkdir ~/install

2/ Compile libevent

Why libevent? Because we will need it later to compile memcached.

bash# wget http://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz
bash# tar zxf libevent-1.4.13-stable.tar.gz
bash# cd libevent-1.4.13-stable
bash# ./configure -prefix=~/install/
bash# make
bash# make install

libevent is now neatly installed in our home directory at ~/install/

3/ Compile memcached

bash# wget http://memcached.googlecode.com/files/memcached-1.4.4.tar.gz
bash# tar xzf memcached-1.4.4.tar.gz
bash# cd memcached-1.4.4
bash# ./configure --with-libevent=~/install/ --prefix=~/install/
bash# make
bash# make install

Neat, now we have memcached installed in ~/install/bin/, so let’s try to run it.

bash# cd ~/install/bin
bash# ./memcached
failed to set rlimit for open files. Try running as root or requesting smaller maxconns value.
bash# ./memcached -c 100
^CSIGINT handled
bash#

So we hit a limitation: as we’re not root, our memcached server is limited to only 100 connections instead of the default 1024.
Maybe we can live with that.

Now the server part is done, we need to be able to use the PHP commands to communicate with memcached.
This is found in the PEAR packages.

4/ Install the PHP memcache client

(the memcache client doesn’t have the ‘d’ at the end)

bash# pecl install memcache
downloading memcache-2.2.5.tgz ...
Starting to download memcache-2.2.5.tgz (35,981 bytes)
..........done: 35,981 bytes
11 source files, building
running: phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519
Enable memcache session handler support? [yes] :
Notice: Use of undefined constant STDIN - assumed 'STDIN' in CLI.php on line 304

Warning: fgets(): supplied argument is not a valid stream resource in CLI.php on line 304

Warning: fgets(): supplied argument is not a valid stream resource in /root/lib/php/PEAR/Frontend/CLI.php on line 304
building in /usr/local/src/pear/pear-build-bottoml8/memcache-2.2.5
ERROR: could not create build dir: /usr/local/src/pear/pear-build-bottoml8/memcache-2.2.5

Ouch, we’re not root so pecl fails.
No big deal: pecl already downloaded memcache-2.2.5.tgz for us, let’s compile it manually.

bash# tar xzf memcache-2.2.5.tgz
bash# cd memcache-2.2.5
bash# phpize
bash# ./configure --prefix=~/install/
bash# make
bash# make test
bash# make install
Installing shared extensions:     /usr/lib/php/extensions/no-debug-non-zts-20060613/
cp: cannot create regular file `/usr/lib/php/extensions/no-debug-non-zts-20060613/#INST@7000#': Read-only file system
make: *** [install-modules] Error 1
bash#
bash# ls modules/
./  ../  memcache.so*
bash# cp memcache.so ~/install/lib/

Ok, make install failed, but we have already what we need: memcache.so in the memcache-2.2.5/modules/ directory.
It’s the extension we need to load in PHP (in the php.ini file) so we can use the PHP commands to access memcached.
We just moved it to ~/install/lib/ so it’s comfy with the other libraries we compiled earlier (libevent and memcached).

5/ Load the memcache module for PHP

Now for the tricky part:
As we don’t have root access, we cannot just change the server’s php.ini file to include our freshly brewed memcache.so and restart Apache to make the changes taken into account.

But Bluehost provides us with a neat way to use our own php.ini file.
By default this option is disabled.
In their cPanel it’s listed under the category ‘Software / Services’ as ‘PHP Config’.

By default the setting is Standard PHP5, we need to change that to the third option: PHP5 (FastCGI)
It will directly load the php.ini it finds in your ~/public_html/ directory.

On this same page of the cPanel, there’s an interesting button “INSTALL PHP.INI MASTER FILE”.
Just click it and magically the server’s php.ini file is copied in ~/public_html/php.ini.default

It’s now our base php.ini we’ll use to load memcache. Let’s edit it.

bash# cd ~/public_html/
bash# mv php.ini.default php.ini
bash# vi php.ini

In php.ini, find the line that reads:
extension_dir = “/usr/local/lib/php/extensions/no-debug-non-zts-20060613″
and replace it with
extension_dir = “/home/your_bluehost_user_name/install/lib”
so that we have access to our memcache.so lib.
At the end if php.ini, before the last line that loads the Zend Optimizer, include this line to load memcache.so:
extension=memcache.so

There should be some other libraries being loaded here:
;extension=pdo.so
;extension=pdo_sqlite.so
;extension=sqlite.so
;extension=pdo_mysql.so

As we changed the extension_dir path these libraries are not accessible anymore so you can just comment them.
extension_dir does not support listing multiple directories so I wish we didn’t have to do that.
At some point there was a proposal to make it happen, don’t know if it’s implemented yet, I couldn’t find anything about it.
Worst case scenario if you need PDO (and you probably do), you just need to compile it and install it in ~/install/lib/

Now that php.ini is modified, the server will pick up the configuration automagically.
But you may have to wait a little bit as php.ini will not be read again right away, you have to wait for the next poll, a few minutes.

6/ Let’s use memcached!

Now everything’s installed, let’s finally use memcached.

Create a memcache.php test file that will connect to memcached and just return the server version:

<?php
$memcache = new Memcache;
$memcache->addServer('localhost', 11211);
$memcache->connect('localhost', 11211);

echo $memcache->getVersion();
?>

Start the memcached in verbose mode so we can see our connection arriving:

bash# cd ~/install/bin/
bash#  ./memcached -h
memcached 1.4.4
-p <num>      TCP port number to listen on (default: 11211)
-U <num>      UDP port number to listen on (default: 11211, 0 is off)
-s <file>     UNIX socket path to listen on (disables network support)
-a <mask>     access mask for UNIX socket, in octal (default: 0700)
-l <ip_addr>  interface to listen on (default: INADDR_ANY, all addresses)
-d            run as a daemon
-r            maximize core file limit
-u <username> assume identity of <username> (only when run as root)
-m <num>      max memory to use for items in megabytes (default: 64 MB)
-M            return error on memory exhausted (rather than removing items)
-c <num>      max simultaneous connections (default: 1024)
-k            lock down all paged memory.  Note that there is a
              limit on how much memory you may lock.  Trying to
              allocate more than that would fail, so be sure you
              set the limit correctly for the user you started
              the daemon with (not for -u <username> user;
              under sh this is done with 'ulimit -S -l NUM_KB').
-v            verbose (print errors/warnings while in event loop)
-vv           very verbose (also print client commands/reponses)
-vvv          extremely verbose (also print internal state transitions)
-h            print this help and exit
-i            print memcached and libevent license
-P <file>     save PID in <file>, only used with -d option
-f <factor>   chunk size growth factor (default: 1.25)
-n <bytes>    minimum space allocated for key+value+flags (default: 48)
-L            Try to use large memory pages (if available). Increasing
              the memory page size could reduce the number of TLB misses
              and improve the performance. In order to get large pages
              from the OS, memcached will allocate the total item-cache
              in one large chunk.
-D <char>     Use <char> as the delimiter between key prefixes and IDs.
              This is used for per-prefix stats reporting. The default is
              ":" (colon). If this option is specified, stats collection
              is turned on automatically; if not, then it may be turned on
              by sending the "stats detail on" command to the server.
-t <num>      number of threads to use (default: 4)
-R            Maximum number of requests per event, limits the number of
              requests process for a given connection to prevent
              starvation (default: 20)
-C            Disable use of CAS
-b            Set the backlog queue limit (default: 1024)
-B            Binding protocol - one of ascii, binary, or auto (default)
-I            Override the size of each slab page. Adjusts max item size
              (default: 1mb, min: 1k, max: 128m)
bash#
bash# ./memcached -c 100 -vvv -l 127.0.0.1
slab class   1: chunk size        96 perslab   10922
slab class   2: chunk size       120 perslab    8738
slab class   3: chunk size       152 perslab    6898
slab class   4: chunk size       192 perslab    5461
...
slab class  40: chunk size    616944 perslab       1
slab class  41: chunk size    771184 perslab       1
slab class  42: chunk size   1048576 perslab       1
<26 server listening (auto-negotiate)
<27 send buffer was 124928, now 268435456
<27 server listening (udp)

---- Access the memcache.php file here in your browser ----

<28 new auto-negotiating client connection
<29 new auto-negotiating client connection
29: going from conn_new_cmd to conn_waiting
29: going from conn_waiting to conn_read
29: going from conn_read to conn_parse_cmd
29: Client using the ascii protocol
<29 version
>29 VERSION 1.4.4
29: going from conn_parse_cmd to conn_write
29: going from conn_write to conn_new_cmd
29: going from conn_new_cmd to conn_waiting
29: going from conn_waiting to conn_read
28: going from conn_new_cmd to conn_waiting
28: going from conn_waiting to conn_read
28: going from conn_read to conn_closing
<28 connection closed.

Tada! And magically the browser is displaying a magnificent “1.4.4“.

You got yourself a memcached server running on BlueHost.

Did you find this post useful? Buy this man a beer:

Setting up MySQL replication

Wednesday, March 10th, 2010

In this article the Master is 200.126.187.013 and the Slave is 200.126.187.066

On the Master, edit /etc/mysql/my.cnf:

server-id        = 126187013  # choose a unique integer
log_bin          = /var/log/mysql/mysql-bin.log
bind-address   = 0.0.0.0  # listen on all interfaces (by default 127.0.0.1 is used)
binlog_do_db   = mydb    # replicate only the 'mydb' database

Test your new configuration for syntax error:

bash# mysqld --help

Make sure the skip-networking option is not enabled.
Make sure server-id is unique. You can for instance use the last 3 octets of the IP address of the server.

Create a replication user on the Master using the IP address of the Slave that will access it (200.126.187.66):

mysql> select version();
+-------------------+
| version()         |
+-------------------+
| 5.1.37-1ubuntu5.1 |
+-------------------+
1 row in set (0.00 sec)
mysql> CREATE USER 'replication'@'200.126.187.66' IDENTIFIED BY 'slavepass';
mysql> GRANT REPLICATION SLAVE ON mydb.users TO 'replication'@'200.126.187.66';
mysql> GRANT SELECT ON mydb.users TO replication;

Restart MySQL for the changes to take effect:

bash# /etc/init.d/mysql restart

On the Slave, edit /etc/mysql/my.cnf to set the server-id:

server-id  = 126187066    # choose a unique integer

Copy the current database on the Master with mysqldump and load it on the Slave.

Check the current status of the Master by retrieving its log file name and position:

mysql> SHOW MASTER STATUS;
+------------------+----------+--------------+------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000003 |    23577 | mydb         |                  |
+------------------+----------+--------------+------------------+
1 row in set (0.00 sec)
mysql>

Start the replication on the Slave.

mysql> CHANGE MASTER TO MASTER_HOST='200.126.187.013', MASTER_USER='replication', MASTER_PASSWORD='slavepass', MASTER_LOG_FILE='mysql-bin.000003', MASTER_LOG_POS=0;
mysql> START SLAVE;

We did take some shortcuts here: the proper way would have been to:
1/ prevent the Master from committing anything
2/ backup the DB on the Master
3/ check the log file name and log position on the Master (‘SHOW MASTER STATUS’)
4/ load the backup on the Slave
5/ start replication using the log file name and position on the Master
6/ unlock the Master so the commits can happen again

A nightmare if the Master is already a live production server because it means from step 1/ to 6/ the Master is dead not committing anything.

As we did a ‘dirty’ backup, the replication will bump into errors that will stop the Slave (mainly because of entries already on the Slave, so we can safely skip them).
List them on the Slave with ’show slave status \G’ (look at the ‘Last_Error’) and if you can skip it, do it this way:

mysql> SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
mysql> START SLAVE;

Continue skipping the failed insert (if they can be skipped of course) until the slave completely catches up with the Master.

How do I know when the Slave is done catching up with the Master?

Issue a ‘SHOW SLAVE STATUS’ on the Slave:

mysql> SHOW SLAVE STATUS \G
*************************** 1. row ***************************
             Slave_IO_State: Waiting for master to send event
                Master_Host: 200.126.187.013
                Master_User: replication
                Master_Port: 3306
              Connect_Retry: 60
            Master_Log_File: mysql-bin.000003
        Read_Master_Log_Pos: 339528
             Relay_Log_File: prod1-relay-bin.000004
              Relay_Log_Pos: 339665
      Relay_Master_Log_File: mysql-bin.000003
           Slave_IO_Running: Yes
          Slave_SQL_Running: Yes
            Replicate_Do_DB:
        Replicate_Ignore_DB:
         Replicate_Do_Table:
     Replicate_Ignore_Table:
    Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
                 Last_Errno: 0
                 Last_Error:
               Skip_Counter: 0
        Exec_Master_Log_Pos: 339528
            Relay_Log_Space: 339665
            Until_Condition: None
             Until_Log_File:
              Until_Log_Pos: 0
         Master_SSL_Allowed: No
         Master_SSL_CA_File:
         Master_SSL_CA_Path:
            Master_SSL_Cert:
          Master_SSL_Cipher:
             Master_SSL_Key:
      Seconds_Behind_Master: 0
1 row in set (0.00 sec)

mysql>

You can see everything is fine because:
- ‘Seconds Behind Master’ reports 0, so the Slave is done catching up (it’s in sync with the Master)
- Both Slave IO and Slave SQL are running
- The Slave is just waiting for new data to come in: ‘Waiting for master to send event’

Source

Installing the APC cache for PHP to speed up your server

Tuesday, March 2nd, 2010

There is a simple, no friction way of improving the performance of your PHP web server by just installing the APC cache.

It will cache the php op-code and serve php files faster.

Basically PHP is a scripting language, meaning every time you load a PHP page, the server has to:
1/ read the source code file (the one you programmed in PHP language, with extension .php)
2/ compile the file into executable code (language understood by the computer), a binary file
3/ execute the generate code

If nothing has changed to your source code file, the every time somebody loads the page from your server steps 1/ and 2/ will be executed again.

APC will just cache the result of steps 1/ and 2/, store them into the binary file and execute this binary at every page load.

As it’s a one line installation and nothing needs to be changed to your installation, it’s a no brainer everyone should do it.

bash# pecl search apc
Retrieving data...0%
MATCHED PACKAGES, CHANNEL PECL.PHP.NET:
=======================================
PACKAGE STABLE/(LATEST) LOCAL
APC     3.1.7 (beta)          Alternative PHP Cache
bash#
bash# pecl install apc
downloading APC-3.1.6.tar ...
Starting to download APC-3.1.6.tar (Unknown size)
.................done: 766,976 bytes
49 source files, building
running: phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
configure.in:3: warning: prefer named diversions
configure.in:3: warning: prefer named diversions
Enable per request file info about files used from the APC cache [no] :
Enable spin locks (EXPERIMENTAL) [no] :
building in /var/tmp/pear-build-root/APC-3.1.6
running: /tmp/pear/temp/APC/configure --enable-apc-filehits=no --enable-apc-spinlocks=no
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20090626
checking for PHP installed headers prefix... /usr/local/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking whether to enable APC support... yes, shared
checking whether we should enable cache request file info... no
checking whether we should use mmap... yes
checking whether we should use semaphore locking instead of fcntl... no
checking whether we should use pthread mutex locking... yes
pthread mutex's are supported!
checking whether we should use spin locks... no
checking whether we should enable memory protection... no
checking for zend_set_lookup_function_hook... no
checking for sigaction... yes
checking for union semun... no
checking whether we should enable valgrind support... checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
yes
checking valgrind/memcheck.h usability... no
checking valgrind/memcheck.h presence... no
checking for valgrind/memcheck.h... no
checking for shm_open in -lrt... yes
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/bash /var/tmp/pear-build-root/APC-3.1.6/libtool --mode=compile cc  -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/apc.c -o apc.lo
mkdir .libs
 cc -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc.c  -fPIC -DPIC -o .libs/apc.o
/bin/bash /var/tmp/pear-build-root/APC-3.1.6/libtool --mode=compile cc  -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/php_apc.c -o php_apc.lo
 cc -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/php_apc.c  -fPIC -DPIC -o .libs/php_apc.o
/bin/bash /var/tmp/pear-build-root/APC-3.1.6/libtool --mode=compile cc  -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/apc_cache.c -o apc_cache.lo
 cc -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc_cache.c  -fPIC -DPIC -o .libs/apc_cache.o
/bin/bash /var/tmp/pear-build-root/APC-3.1.6/libtool --mode=compile cc  -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/apc_compile.c -o apc_compile.lo
 cc -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc_compile.c  -fPIC -DPIC -o .libs/apc_compile.o
/bin/bash /var/tmp/pear-build-root/APC-3.1.6/libtool --mode=compile cc  -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/apc_debug.c -o apc_debug.lo
 cc -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc_debug.c  -fPIC -DPIC -o .libs/apc_debug.o
/bin/bash /var/tmp/pear-build-root/APC-3.1.6/libtool --mode=compile cc  -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/apc_fcntl.c -o apc_fcntl.lo
 cc -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc_fcntl.c  -fPIC -DPIC -o .libs/apc_fcntl.o
/bin/bash /var/tmp/pear-build-root/APC-3.1.6/libtool --mode=compile cc  -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/apc_main.c -o apc_main.lo
 cc -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc_main.c  -fPIC -DPIC -o .libs/apc_main.o
/bin/bash /var/tmp/pear-build-root/APC-3.1.6/libtool --mode=compile cc  -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/apc_mmap.c -o apc_mmap.lo
 cc -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc_mmap.c  -fPIC -DPIC -o .libs/apc_mmap.o
/bin/bash /var/tmp/pear-build-root/APC-3.1.6/libtool --mode=compile cc  -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/apc_sem.c -o apc_sem.lo
 cc -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc_sem.c  -fPIC -DPIC -o .libs/apc_sem.o
/bin/bash /var/tmp/pear-build-root/APC-3.1.6/libtool --mode=compile cc  -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/apc_shm.c -o apc_shm.lo
 cc -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc_shm.c  -fPIC -DPIC -o .libs/apc_shm.o
/bin/bash /var/tmp/pear-build-root/APC-3.1.6/libtool --mode=compile cc  -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/apc_pthreadmutex.c -o apc_pthreadmutex.lo
 cc -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc_pthreadmutex.c  -fPIC -DPIC -o .libs/apc_pthreadmutex.o
/bin/bash /var/tmp/pear-build-root/APC-3.1.6/libtool --mode=compile cc  -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/apc_spin.c -o apc_spin.lo
 cc -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc_spin.c  -fPIC -DPIC -o .libs/apc_spin.o
/bin/bash /var/tmp/pear-build-root/APC-3.1.6/libtool --mode=compile cc  -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/pgsql_s_lock.c -o pgsql_s_lock.lo
 cc -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/pgsql_s_lock.c  -fPIC -DPIC -o .libs/pgsql_s_lock.o
/bin/bash /var/tmp/pear-build-root/APC-3.1.6/libtool --mode=compile cc  -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/apc_sma.c -o apc_sma.lo
 cc -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc_sma.c  -fPIC -DPIC -o .libs/apc_sma.o
/bin/bash /var/tmp/pear-build-root/APC-3.1.6/libtool --mode=compile cc  -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/apc_stack.c -o apc_stack.lo
 cc -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc_stack.c  -fPIC -DPIC -o .libs/apc_stack.o
/bin/bash /var/tmp/pear-build-root/APC-3.1.6/libtool --mode=compile cc  -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/apc_zend.c -o apc_zend.lo
 cc -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc_zend.c  -fPIC -DPIC -o .libs/apc_zend.o
/bin/bash /var/tmp/pear-build-root/APC-3.1.6/libtool --mode=compile cc  -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/apc_rfc1867.c -o apc_rfc1867.lo
 cc -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc_rfc1867.c  -fPIC -DPIC -o .libs/apc_rfc1867.o
/bin/bash /var/tmp/pear-build-root/APC-3.1.6/libtool --mode=compile cc  -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/apc_signal.c -o apc_signal.lo
 cc -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc_signal.c  -fPIC -DPIC -o .libs/apc_signal.o
/bin/bash /var/tmp/pear-build-root/APC-3.1.6/libtool --mode=compile cc  -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/apc_pool.c -o apc_pool.lo
 cc -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc_pool.c  -fPIC -DPIC -o .libs/apc_pool.o
/bin/bash /var/tmp/pear-build-root/APC-3.1.6/libtool --mode=compile cc  -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/apc_iterator.c -o apc_iterator.lo
 cc -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc_iterator.c  -fPIC -DPIC -o .libs/apc_iterator.o
/bin/bash /var/tmp/pear-build-root/APC-3.1.6/libtool --mode=compile cc  -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/apc_bin.c -o apc_bin.lo
 cc -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc_bin.c  -fPIC -DPIC -o .libs/apc_bin.o
/bin/bash /var/tmp/pear-build-root/APC-3.1.6/libtool --mode=compile cc  -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /tmp/pear/temp/APC/apc_string.c -o apc_string.lo
 cc -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc_string.c  -fPIC -DPIC -o .libs/apc_string.o
/bin/bash /var/tmp/pear-build-root/APC-3.1.6/libtool --mode=link cc -DPHP_ATOM_INC -I/var/tmp/pear-build-root/APC-3.1.6/include -I/var/tmp/pear-build-root/APC-3.1.6/main -I/tmp/pear/temp/APC -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -o apc.la -export-dynamic -avoid-version -prefer-pic -module -rpath /var/tmp/pear-build-root/APC-3.1.6/modules  apc.lo php_apc.lo apc_cache.lo apc_compile.lo apc_debug.lo apc_fcntl.lo apc_main.lo apc_mmap.lo apc_sem.lo apc_shm.lo apc_pthreadmutex.lo apc_spin.lo pgsql_s_lock.lo apc_sma.lo apc_stack.lo apc_zend.lo apc_rfc1867.lo apc_signal.lo apc_pool.lo apc_iterator.lo apc_bin.lo apc_string.lo -lrt
cc -shared  .libs/apc.o .libs/php_apc.o .libs/apc_cache.o .libs/apc_compile.o .libs/apc_debug.o .libs/apc_fcntl.o .libs/apc_main.o .libs/apc_mmap.o .libs/apc_sem.o .libs/apc_shm.o .libs/apc_pthreadmutex.o .libs/apc_spin.o .libs/pgsql_s_lock.o .libs/apc_sma.o .libs/apc_stack.o .libs/apc_zend.o .libs/apc_rfc1867.o .libs/apc_signal.o .libs/apc_pool.o .libs/apc_iterator.o .libs/apc_bin.o .libs/apc_string.o  -lrt  -Wl,-soname -Wl,apc.so -o .libs/apc.so
creating apc.la
(cd .libs && rm -f apc.la && ln -s ../apc.la apc.la)
/bin/bash /var/tmp/pear-build-root/APC-3.1.6/libtool --mode=install cp ./apc.la /var/tmp/pear-build-root/APC-3.1.6/modules
cp ./.libs/apc.so /var/tmp/pear-build-root/APC-3.1.6/modules/apc.so
cp ./.libs/apc.lai /var/tmp/pear-build-root/APC-3.1.6/modules/apc.la
PATH="$PATH:/sbin" ldconfig -n /var/tmp/pear-build-root/APC-3.1.6/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /var/tmp/pear-build-root/APC-3.1.6/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

running: make INSTALL_ROOT="/var/tmp/pear-build-root/install-APC-3.1.6" install
Installing shared extensions:     /var/tmp/pear-build-root/install-APC-3.1.6/usr/local/lib/php/extensions/no-debug-non-zts-20090626/
running: find "/var/tmp/pear-build-root/install-APC-3.1.6" | xargs ls -dils
3935384   4 drwxr-xr-x 3 root root   4096 2011-02-02 22:44 /var/tmp/pear-build-root/install-APC-3.1.6
3936266   4 drwxr-xr-x 3 root root   4096 2011-02-02 22:44 /var/tmp/pear-build-root/install-APC-3.1.6/usr
3936267   4 drwxr-xr-x 3 root root   4096 2011-02-02 22:44 /var/tmp/pear-build-root/install-APC-3.1.6/usr/local
3936268   4 drwxr-xr-x 3 root root   4096 2011-02-02 22:44 /var/tmp/pear-build-root/install-APC-3.1.6/usr/local/lib
3936269   4 drwxr-xr-x 3 root root   4096 2011-02-02 22:44 /var/tmp/pear-build-root/install-APC-3.1.6/usr/local/lib/php
3936270   4 drwxr-xr-x 3 root root   4096 2011-02-02 22:44 /var/tmp/pear-build-root/install-APC-3.1.6/usr/local/lib/php/extensions
3936271   4 drwxr-xr-x 2 root root   4096 2011-02-02 22:44 /var/tmp/pear-build-root/install-APC-3.1.6/usr/local/lib/php/extensions/no-debug-non-zts-20090626
3936265 648 -rwxr-xr-x 1 root root 661620 2011-02-02 22:44 /var/tmp/pear-build-root/install-APC-3.1.6/usr/local/lib/php/extensions/no-debug-non-zts-20090626/apc.so

Build process completed successfully
Installing '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/apc.so'
install ok: channel://pecl.php.net/APC-3.1.6
configuration option "php_ini" is not set to php.ini location
You should add "extension=apc.so" to php.ini
bash#

To avoid having to manually add the apc.so extension to your php.ini, execute these commands first:

bash# pear config-set php_ini /etc/php5/apache2/php.ini
bash# pecl config-set php_ini /etc/php5/apache2/php.ini

And now restart Apache for the changes to take effect:

bash# sudo apache2ctl graceful

Speed test: ON DUPLICATE KEY UPDATE statement vs (DELETE then INSERT)

Thursday, July 24th, 2008

Is it faster to issue two SQL statements (DELETE then INSERT) or craft a single query using ON DUPLICATE KEY UPDATE?

Single query:

INSERT INTO items SET user_id=3463574, item_id=1, amount = 1 ON DUPLICATE KEY UPDATE amount = amount + 1;

Multiple queries:

DELETE FROM items WHERE user_id=3463574 AND item_id=1;
INSERT INTO items SET user_id=3463574 , item_id=1, amount = 66;

Difference in time (using microtime() in PHP):
ON DUP – 0.00023600000000001
ON DUP – 0.00022699999999998
ON DUP – 0.00014599999999998
ON DUP – 0.00014899999999998
DEL AND INSERT – 0.000336
ON DUP – 0.00015000000000004
DEL AND INSERT – 0.00046600000000002

The del/insert is 3 times slower than the ON DUPLICATE statement.

Load balancing on the cheap: DNS balancing

Thursday, July 3rd, 2008

So you can’t afford a F5 load balancer? But your Apache server is dying under the load?
We had to use load balancing using DNS because we had scaling issues. Fast and good fix (just add a box and one line of code).

Create different DNS entries for different front side Apache servers:
www1.example.com
www2.example.com
www3.example.com

And in your code (PHP):

$baserUrl = "www".rand(1,3).".example.com";

Source