ITPub博客

首页 > 数据库 > MySQL > php-5.5.9+mysql+nginx moqianjun

php-5.5.9+mysql+nginx moqianjun

MySQL 作者:masouditpub 时间:2014-03-08 16:12:07 0 删除 编辑


#yum -y install gcc pcre pcre-devel gcc-c++ autoconf libxml2 libxml2-devel zlib zlib-devel glibc libjepg libjepg-devel libpng libpng-devel glibc-devel glib2 glib2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers make



#./configure  --prefix=/home/wz/local/nginx/

--with-http_sub_module

--with-http_stub_status_module

--with-poll_module

--with-http_ssl_module

--with-pcre=/home/wz/tools/pcre-8.34


#make && make install


##mysql

#cmake -DCMAKE_INSTALL_PREFIX=/home/wz/local/mysql/

-DDEFAULT_CHARSET=utf8

-DDEFAULT_COLLATION=utf8_general_ci

-DWITH_EXTRA_CHARSETS=all

-DWITH_MYISAM_STORAGE_ENGINE=1

-DWITH_INNOBASE_STORAGE_ENGINE=1

-DWITH_MEMORY_STORAGE_ENGINE=1

-DWITH_READLINE=1

-DWITH_INNODB_MEMCACHED=1

-DWITH_DEBUG=OFF

-DWITH_ZLIB=bundled

-DENABLED_LOCAL_INFILE=1

-DENABLED_PROFILING=ON

-DMYSQL_MAINTAINER_MODE=OFF

-DMYSQL_TCP_PORT=3306


#make  &&  make install  

#cp  my-default.cnf  /etc/my.cnf

#./scripts/mysql_install_db --user=mysql --basedir=/home/wz/local/mysql --datadir=/home/wz/local/mysql/data/ 

#/home/wz/local/mysql/bin/mysqladmin  -u root  -p  passsword  'king!@#'



#ln -sv /home/wz/local/mysql/include  /usr/include/mysql

#echo '/home/wz/local/mysql/lib' > /etc/ld.so.conf.d/mysql.conf 

#ldconfig

vim /etc/profile 

PATH=$PATH:/home/wz/local/mysql/bin

. /etc/profile  (别忘了前面的点)


为mysql添加启动脚本 ,添加进服务列表并开机自动启动  

# cp support-files/mysql.server  /etc/rc.d/init.d/mysqld 

# chkconfig --add mysqld 

# chkconfig mysqld on 

#vim /etc/my.cnf

[client]

port = 3306

socket = /tmp/mysql.sock

[mysql]

no-auto-rehash

prompt="(\u:D)> "


[mysqld]

user = mysql

port = 3306

socket = /tmp/mysql.sock

basedir = /home/wz/local/mysql/

datadir = /home/wz/local/mysql/data/



max_allowed_packet = 1M

net_read_timeout = 60

wait_timeout = 100

interactive_timeout = 100

open_files_limit = 10240

back_log = 150

max_connections = 1000

max_connect_errors = 100000

external-locking = FALSE

performance_schema = 0


table_open_cache = 2048  

table_definition_cache = 2048

max_heap_table_size = 246M

tmp_table_size = 246M

sort_buffer_size = 2M

join_buffer_size = 2M

thread_cache_size = 256


query_cache_size = 2M

query_cache_limit = 2M

query_cache_min_res_unit = 2k

thread_stack = 192K

read_buffer_size = 1M

read_rnd_buffer_size = 16M

bulk_insert_buffer_size = 64M


log-error=//home/wz/local/mysql/logs/mysql.err

log_warnings = 2

slow-query-log

slow-query-log-file=/home/wz/local/mysql/logs/slow-log.log

long_query_time = 2

log-queries-not-using-indexes = 1

log-slow-admin-statements = 1

log-slow-slave-statements = 1


server-id = 1

#binlog_format = ROW

#binlog-row-image = minimal


#log-bin = /home/wz/local/mysql/binlog/mysql-bin

binlog_cache_size = 4M

max_binlog_cache_size = 2G

max_binlog_size = 1G

expire_logs_days = 7

relay-log-purge = 1

sync_binlog = 0

skip-slave-start = 1

log-slave-updates  = 1


key_buffer_size = 4M

myisam_sort_buffer_size = 32M

myisam_max_sort_file_size = 10G

myisam_repair_threads = 1

myisam_recover

lower_case_table_names = 1

skip-name-resolve

slave-skip-errors = 1032,1062


innodb_additional_mem_pool_size = 16M

innodb_buffer_pool_size = 20G

#innodb_data_file_path = ibdata1:1G:autoextend

innodb_file_per_table = 1

innodb_thread_concurrency = 0

innodb_flush_log_at_trx_commit = 2

innodb_log_buffer_size = 16M

innodb_log_file_size = 256M

innodb_log_files_in_group = 3

innodb_max_dirty_pages_pct = 75

innodb_lock_wait_timeout = 120

innodb_rollback_on_timeout

innodb_status_file = 1

innodb_io_capacity = 800

transaction_isolation = READ-COMMITTED

innodb_flush_method = O_DIRECT

innodb-support-xa = 0

innodb_read_io_threads = 8

innodb_write_io_threads = 8

innodb_file_format = Barracuda


[mysqldump]

quick

max_allowed_packet = 32M

[mysqld_safe]

pid-file=/home/wz/local/mysql/data/mysqld.pid



#cd   /home/wz/tools/php-5.5.9

#

'./configure'

'--prefix=/home/wz/local/php'

'--with-config-file-path=/home/wz/local/php/etc'

'--with-mysql=/home/wz/local/mysql/'

'--with-mysqli=/home/wz/local/mysql/bin/mysql_config'

'--with-pdo-mysql=/home/wz/local/mysql'

'--disable-debug'

'--disable-ipv6'

'--with-gd=/home/wz/local/phpext/'

'--with-freetype-dir=/home/wz/local/phpext/'

'--with-jpeg-dir=/home/wz/local/phpext/'

'--with-png-dir=/home/wz/local/phpext/'

'--with-zlib'

'--with-libxml-dir=/usr'

'--enable-xml'

'--disable-rpath'

'--enable-bcmath'

'--enable-shmop'

'--enable-sysvsem'

'--enable-inline-optimization'

'--with-curl'

'--enable-mbregex'

'--enable-fpm'

'--enable-mbstring'

'--enable-gd-native-ttf'

'--with-openssl'

'--enable-pcntl'

'--enable-sockets'

'--with-xmlrpc'

'--enable-zip'

'--enable-soap'

'--without-mssql'

'--enable-opcache'

'--with-xpm-dir=/usr/lib64'

#make  

#make install  


#cp  cp  php.ini-production /home/wz/local/php/etc/php.ini

#cp sapi/fpm/init.d.php-fpm  /etc/init.d/php-fpm

#chmod +x   /etc/init.d/php-fpm

#service  php-fm start





php扩展

php_mongo的安装 源码可以在http://pecl.php.net/package/mongo

memcache扩展:http://pecl.php.net/package/memcache


#wget http://pecl.php.net/get/mongo-1.2.0.tgz

#cd mongo-1.2.0

#/home/wz/local/php/bin/phpize

#./configure --with-php-config=/home/wz/local/php/bin/php-config

 

#make && make install




#cd memcache-3.0.8

#/home/wz/local/php/bin/phpize

#./configure --with-php-config=/home/wz/local/php/bin/php-config

 

#make && make install



vim  /home/wz/local/php/etc/php.ini

把extension_dir = "./" 换成

extension_dir = "/home/wz/local/php/lib/php/extensions/no-debug-non-zts-20121212/"

在下面增加这两行

extension=memcache.so

 

extension=mongo.so





http://luhuang.sinaapp.com/php-zend-opcache/

Zend Opcache PHP 5.5 特有的, 大家知道目前PHP的缓存插件一般有三个:APC、eAccelerator、XCache,但未来它们可能都会消失,因为PHP 5.5已经集成Zend Opcache,功能和前三者相似但又有少许不同,缓存速度据说比它们更快

这几个PHP加速插件的主要原理都相同,就是把PHP执行后的数据缓冲到内存中从而避免重复的编译过程,能够直接使用缓冲区已编译的代码从而提高速度,降低服务器负载,它们的效率是显而易见的,像drupal这种庞大的CMS,每次打开一个页面要调用数十个PHP文件,执行数万行代码,效率可想而知,在安装APC等加速器后打开页面的速度明显加快。

Zend Opcache 已经集成在了PHP 5.5里面,编译安装PHP5.5的时候加上–enable-opcache就行了,这样自动会有opcache.so

[opcache]

zend_extension = "/home/wz/local/php/lib/php/extensions/no-debug-non-zts-20121212/opcache.so"

opcache.memory_consumption=1024  //共享内存大小, 这个根据你们的需求可调

opcache.optimization_level=1    

opcache.interned_strings_buffer=8  //interned string的内存大小, 也可调

opcache.max_accelerated_files=4096  //最大缓存的文件数目

opcache.revalidate_freq=60         /60s检查一次文件更新

opcache.fast_shutdown=1        //打开快速关闭, 打开这个在PHP Request Shutdown的时候 会收内存的速度会提高

opcache.enable=1

 

opcache.enable_cli=1



<!-- 正文结束 -->

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21155543/viewspace-1114542/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2009-03-19