Ubuntu指令

tail -f /var/log/mysql/error.log
tail -f /var/log/apache2/error.log

/etc/init.d/apache2 restart
/etc/init.d/mysql restart

vi /etc/apache2/apache2.conf
vi /etc/php5/apache2/php.ini
vi /etc/mysql/my.cnf

cd /etc/apache2/sites-enabled/
cd /var/www/

tar -xvzf

apt-get install memcached
memcached -d -u root -l localhost -m 64 -p 11211

apt-get update
apt-get dist-upgrade

dpkg –get-selections|grep linux
uname -a
apt-get remove linux-image-3.x.x-generic

mysql>SHOW GLOBAL VARIABLES LIKE ‘%log%’;
mysql>SHOW GLOBAL VARIABLES LIKE ‘long%’;

安装MySQL
apt-get install mysql-server mysql-client
TCMalloc优化MySQL
配置、安装PHP和扩展
a2enmod rewrite
php timezone
apt-get install php5 php5-dev
apt-get install curl libcurl3 libcurl3-dev php5-curl
apt-get install php5-apc php5-gd imagemagick php5-imagick php5-intl php5-mcrypt
apt-get install php5-memcache php5-mysql php5-sqlite php5-tidy php5-xsl

dpkg-reconfigure tzdata

vi /etc/php5/apache2/php.ini
mysql.connect_timeout = 20
expose_php = Off
vi /etc/apache2/conf.d/security
ServerTokens Prod

vi /etc/mysql/my.cnf
default-character-set = utf8

[xdebug]
zend_extension=”/usr/lib/php5/20121212/xdebug.so”
xdebug.idekey=”PHPSTORM”
xdebug.remote_host=127.0.0.1
xdebug.remote_enable=on

git config –global user.name “yannanfei”
git config –global user.email xx@xx.com

清除OS Cache:
sync
echo “3” > /proc/sys/vm/drop_caches

FLUSH QUERY CACHE;

sudo apt-get install sysstat
sudo iostat -x 2

sudo apt-get autoclean
sudo apt-get clean
sudo apt-get autoremove

Mac OS X 10.8编译PHP5.4

./configure 
--prefix=/usr 
--mandir=/usr/share/man 
--infodir=/usr/share/info 
--sysconfdir=/private/etc 
--with-apxs2=/usr/sbin/apxs 
--enable-cli 
--with-config-file-path=/etc 
--with-libxml-dir=/usr 
--with-openssl=/usr 
--with-kerberos=/usr 
--with-zlib=/usr 
--enable-bcmath 
--with-bz2=/usr 
--enable-calendar 
--with-curl=/usr 
--enable-dba 
--enable-exif 
--enable-ftp 
--with-gd 
--enable-gd-native-ttf 
--with-icu-dir=/usr 
--with-iodbc=/usr 
--with-ldap=/usr 
--with-ldap-sasl=/usr 
--with-libedit=/usr 
--enable-mbstring 
--enable-mbregex 
--with-mysql=mysqlnd 
--with-mysqli=mysqlnd 
--without-pear 
--with-pdo-mysql=mysqlnd 
--with-mysql-sock=/var/mysql/mysql.sock 
--with-readline=/usr 
--enable-shmop 
--with-snmp=/usr 
--enable-soap 
--enable-sockets 
--enable-sysvmsg 
--enable-sysvsem 
--enable-sysvshm 
--with-tidy 
--enable-wddx 
--with-xmlrpc 
--with-iconv-dir=/usr 
--with-xsl=/usr 
--enable-zip 
--with-imap=/usr/local/imap-2007 
--with-kerberos 
--with-imap-ssl 
--enable-intl 
--with-pcre-regex 
--with-pgsql=/usr 
--with-pdo-pgsql=/usr 
--with-freetype-dir=/usr/X11 
--with-jpeg-dir=/usr 
--with-png-dir=/usr/X11

 

checking for jpeg_read_header in -ljpeg... yes
If configure fails try --with-vpx-dir=<dir>
configure: error: png.h not found.

$ brew install libpng

 

configure: error: freetype.h not found.

$ brew install freetype

 

checking for U8T_DECOMPOSE...
configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.

$ brew install openssl
http://blog.xeonxai.com/2009/12/03/160/
http://www.september28.co.uk/blog/2011/11/24/php-imap-support-in-mac-os-x-lion-without-recompiling-php/
while in the /usr/local/imap-2007 folder:
sudo cp c-client/c-client.a /usr/local/lib/libc-client.a

 

checking for location of ICU headers and libraries... not found
configure: error: Unable to detect ICU prefix or /usr/bin/icu-config failed. Please verify ICU install prefix and make sure icu-config works.

you can remove the –enable-intl option while running ./configure

 

+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+

Thank you for using PHP.

config.status: creating php5.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating main/php_config.h
config.status: executing default commands

 

$ make test

 

$ sudo make install

 

$ php -v

 

PHP 5.4.24 (cli) (built: Mar 6 2014 17:02:57)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

让Mac OS X中的PHP支持mcrypt

下载并解压libmcrypt-2.5.8.tar.gz。
在终端执行如下命令:
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure --disable-posix-threads --enable-static
make
sudo make install

下载并解压PHP源码文件php-5.x.tar.gz。
在终端执行如下命令:
tar zxvf php-5.x.tar.gz
cd php-5.x/ext/mcrypt
phpize
./configure
make
sudo make install

打开php.ini
sudo vi /etc/php.ini

在php.ini中加入如下代码,并保存后退出,然后重启Apache
extension=mcrypt.so