二、安装PHP 5.2.14(法斯特CGI方式)【LNMP安装 】

作者:ca88编程

错误

 

tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure
make
make install
cd ../

[文章作者:张宴 本文版本:v1.1 最终修改:二零零七.03.02 转载请注解出处:http://blog.s135.com]

一、安装PHP 5.2.8(FastCGI模式)
1、编译安装PHP 5.2.8所需的扶助库:

      }


  操作系统:Linux
  
  一、安装eaccelerator-0.9.5(同不经常间扶助ZendOptimizer-3.2.2)
  
  1、首先安装ZendOptimizer-3.2.2
  
  # wget 
  # tar zxvf ZendOptimizer-3.2.2-linux-glibc21-i386.tar.gz
  # cd ZendOptimizer-3.2.2-linux-glibc21-i386
  # ./install.sh
  
  在Please specify the location for installing ZendOptimizer:提醒后输入ZendOptimizer安装路线,举个例子/data/webserver/zend
  在Confirm the location of your PHP.ini file:提示后输入PHP.ini文件所在目录,比方/data/webserver/PHP/etc
  在Specify the full path to the Apache control utility (apachectl):提示输入apachectl相对路线,举个例子/data/webserver/apache/bin/apachectl
  
  
  2、再安装eaccelerator-0.9.5加速软件
  
  # wget 
  # tar jxvf eaccelerator-0.9.5.tar.bz2
  # cd eaccelerator-0.9.5
  
  指定PHP所在路子:
  # export PHP_PREFIX="/data/webserver/PHP"
  # $PHP_PREFIX/bin/PHPize
  # ./configure --enable-eaccelerator=shared --with-PHP-config=$PHP_PREFIX/bin/PHP-config
  # make
  # make install
  
  那时会将eaccelerator安装到PHP目录中,荧屏会展现eaccelerator.so所在路子,举例:
  Installing shared extensions: /data/webserver/PHP/lib/PHP/extensions/no-debug-zts-20060613/
  记住这几个门路。
  
  eaccelerator即能够设置为PHP扩大,也得以设置为zend增加,以下安装为PHP扩展。
  
  假使存在/etc/PHP.d目录,供给拷贝eaccelerator.ini到该目录下,然后修改缺省值。要是不设有,修改PHP.ini,在[zend]前边参与以下内容(注:必须放在[zend]之前):
  
  [eaccelerator]
  extension="/data/webserver/PHP/lib/PHP/extensions/no-debug-zts-20060613/eaccelerator.so"
  eaccelerator.shm_size="32"
  eaccelerator.cache_dir="/data/cache/eaccelerator"
  eaccelerator.enable="1"
  eaccelerator.optimizer="1"
  eaccelerator.check_mtime="1"
  eaccelerator.debug="0"
  eaccelerator.filter=""
  eaccelerator.shm_max="0"
  eaccelerator.shm_ttl="0"
  eaccelerator.shm_prune_period="0"
  eaccelerator.shm_only="0"
  eaccelerator.compress="1"
  eaccelerator.compress_level="9"
  
  建构缓存目录:
  # mkdir -p /data/cache/eaccelerator
  # chmod 0777 /data/cache/eaccelerator
  
  重启Apache:
  # service httpd restart
  
  
  3、检查ZendOptimizer和eaccelerator是不是安装成功
  
  创制三个PHPinfo.PHP文件,内容如下:
  <?PHP
      PHPinfo();
  ?>
  
  将该公文放置到网址目录,在浏览器中走访,借使出现以下内容则设置成功:
  This program makes use of the Zend Scripting Language Engine:
  Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
      with eAccelerator v0.9.5, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
      with Zend Extension Manager v1.0.11, Copyright (c) 2003-2006, by Zend Technologies
      with Zend Optimizer v3.2.2, Copyright (c) 1998-2006, by Zend Technologies 
  
  
  
  二、eaccelerator配置音信详解(依照官方英文表达翻译)
  
  extension="/data/webserver/PHP/lib/PHP/extensions/no-debug-zts-20060613/eaccelerator.so"
  
  解释:PHP扩展eaccelerator.so的路径。
  
  --------------------
  
  eaccelerator.shm_size="32"
  
  解释:eaccelerator可应用的共享内部存款和储蓄器大小(单位为MB)。
  
  在Linux下,单个进度的最大内部存款和储蓄器使用量受/proc/sys/kernel/shmmax中装置的数字限制(单位为字节),举例CentOS 4.4的shmmax默许值为33554432字节(33554432bytes/1024/1024=32MB)。
  
  有时转移该值:
  # echo 字节数 > /proc/sys/kernel/shmmax
  
  依照以上办法更动,在每一次重启系统时,该值会被电动还原。假如想永恒更改,能够修改/etc/sysctl.conf文件,设置:
  kernel.shmmax = 字节数
  
  --------------------
  
  eaccelerator.cache_dir="/data/cache/eaccelerator"
  
  解释:缓存路线,能够动用命令mkdir -p /data/cache/eaccelerator成立该目录,然后利用命令chmod 0777 /data/cache/eaccelerator设置该目录权限为0777
  
  --------------------
  
  eaccelerator.enable="1"
  
  解释:展开只怕关闭eaccelerator。"1"指打开,"0"指关闭。私下认可值为"1"。
  
  --------------------
  
  eaccelerator.optimizer="1"
  
  解释:展开恐怕关闭代码优化,开启能够加速代码的实践进度。"1"指展开,"0"指关闭。私下认可值为"1"。
  
  --------------------
  
  eaccelerator.check_mtime="1"
  
  解释:当展开此项时,eaccelerator会在每一趟请求时检查PHP文件的改变时间,看其是不是被改换过,那会损耗一点时光,假使PHP文件被改动过,eaccelerator会重新编写翻译缓存该PHP文本。当关闭此项时,借使PHP文本被改变,则供给手工业删除eaccelerator缓存,手艺显得被涂改的PHP文本。"1"指展开,"0"指关闭。私下认可值为"1"。
  
  --------------------
  
  eaccelerator.debug="0"
  
  解释:展开只怕关闭调试记录。当展开时,eaccelerator会将对叁个缓存文件的每回请求都写进log。展开此项只对调节和测试eaccelerator是或不是有BUG时有益处。"1"指张开,"0"指关闭。暗中同意值为"0"。
  
  --------------------
  
  eaccelerator.filter=""
  
  解释:决定哪些PHP文本应当被缓存。能够内定二个限量(譬如"*.PHP *.pHTML"),那样被钦点的公文就能够被缓存。假设该限制以!伊始,被内定的公文就不会被缓存。私下认可值为"",表示缓存全体的PHP文件。 
  
  --------------------
  
  eaccelerator.shm_max="0"
  
  解释:多个用户使用举个例子eaccelerator_put之类的函数能够往共享内部存储器中加载的最大数额。私下认可值为"0",表示不限量。(单位为字节)
  
  --------------------
  
  eaccelerator.shm_ttl="0"
  
  解释:当未有丰富的空余共享内部存款和储蓄器去尝试缓冲叁个新本申时,将去除至少在shm_ttl秒在此之前从没被访问过的文件。默许值为"0",表示不尝试从共享内部存款和储蓄器中删除任何旧的台本。(单位为秒)
  
  --------------------
  
  eaccelerator.shm_prune_period="0"
  
  解释:当未有足够的闲暇共享内部存款和储蓄器去尝试缓冲八个新网络TV剧本时,将删全数旧脚本,前提是以此尝试在超越shm_prune_period秒此前被施行过。暗许值为"0",表示不尝试从共享内存中删除任何旧的剧本。(单位为秒)
  
  --------------------
  
  eaccelerator.shm_only="0"
  
  解释:展开只怕关闭在磁盘上缓存编译过的台本。这么些参数对会话数据和内容缓存未有意义。暗中认可值为"0",表示使用磁盘和共享内部存储器来缓存。
  
  --------------------
  
  eaccelerator.compress="1"
  
  解释:张开也许关闭缓存内容减弱。"1"指张开,"0"指关闭。暗中认可值为"1"。
  
  --------------------
  
  eaccelerator.compress_level="9"
  
  解释:内部存款和储蓄器压缩的等第。暗中同意值为"9",表示最大压缩。
  
  
  参考资料:
  1、Installing from source (http://www.eaccelerator.net/wiki/InstallFromSource)
  2、eAccelerator settings (http://www.eaccelerator.net/wiki/Settings)


    log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '

tar zxvf ImageMagick.tar.gz
cd ImageMagick-6.5.1-2/
./configure
make
make install
cd ../

cd /home/xuxx/software
wget http://blog.s135.com/soft/linux/nginx_php/nginx/nginx-0.7.51.tar.gz
wget http://blog.s135.com/soft/linux/nginx_php/php/php-5.2.8.tar.gz
wget http://blog.s135.com/soft/linux/nginx_php/phpfpm/php-5.2.8-fpm-0.5.10.diff.gz
wget http://blog.s135.com/soft/linux/nginx_php/mysql/mysql-5.1.33.zip
wget http://blog.s135.com/soft/linux/nginx_php/libiconv/libiconv-1.13.tar.gz
wget http://blog.s135.com/soft/linux/nginx_php/mcrypt/libmcrypt-2.5.8.tar.gz
wget http://blog.s135.com/soft/linux/nginx_php/mcrypt/mcrypt-2.6.8.tar.gz
wget http://blog.s135.com/soft/linux/nginx_php/memcache/memcache-2.2.5.tgz
wget http://blog.s135.com/soft/linux/nginx_php/mhash/mhash-0.9.9.9.tar.gz
wget http://blog.s135.com/soft/linux/nginx_php/pcre/pcre-7.8.tar.gz
wget http://blog.s135.com/soft/linux/nginx_php/eaccelerator/eaccelerator-0.9.5.3.tar.bz2
wget http://blog.s135.com/soft/linux/nginx_php/pdo/PDO_MYSQL-1.0.2.tgz
wget http://blog.s135.com/soft/linux/nginx_php/imagick/ImageMagick.tar.gz
wget http://blog.s135.com/soft/linux/nginx_php/imagick/imagick-2.2.2.tgz

解决imagemagick问题     

#master-host     =   192.168.1.2
#master-user     =   username
#master-password =   password
#master-port     =  3306

4]mcrypt库

  client_max_body_size 8m;

  修改为extension_dir

"/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/"
  并在此行后增添以下几行,然后保留:
  extension = "memcache.so"
  extension = "pdo_mysql.so"
  extension = "imagick.so"

  再查找output_buffering = Off
  修改为output_buffering = On

  再查找; cgi.fix_pathinfo=0
  修改为cgi.fix_pathinfo=0,防止Nginx文件类型错误解析漏洞。

自动修改:若嫌手工业修改麻烦,可进行以下shell命令,自动完毕对php.ini文件的修改:sed -i 's#extension_dir = "./"#extension_dir = "/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/"nextension = "memcache.so"nextension = "pdo_mysql.so"nextension = "imagick.so"n#' /usr/local/webserver/php/etc/php.ini
sed -i 's#output_buffering = Off#output_buffering = On#' /usr/local/webserver/php/etc/php.ini
sed -i "s#; always_populate_raw_post_data = On#always_populate_raw_post_data = On#g" /usr/local/webserver/php/etc/php.ini
sed -i "s#; cgi.fix_pathinfo=0#cgi.fix_pathinfo=0#g" /usr/local/webserver/php/etc/php.ini

  6、配置eAccelerator加速PHP:mkdir -p /usr/local/webserver/eaccelerator_cache
vi /usr/local/webserver/php/etc/php.ini
  按shift g键跳到布署文件的最末尾,加上以下配置音信:引用[eaccelerator]
zend_extension="/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="64"
eaccelerator.cache_dir="/usr/local/webserver/eaccelerator_cache"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="3600"
eaccelerator.shm_prune_period="3600"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"


  7、创建www用户和组,以及供blog.s135.com和www.s135.com多个虚拟主机使用的目录:/usr/sbin/groupadd www
/usr/sbin/useradd -g www www
mkdir -p /data0/htdocs/blog
chmod w /data0/htdocs/blog
chown -R www:www /data0/htdocs/blog
mkdir -p /data0/htdocs/www
chmod w /data0/htdocs/www
chown -R www:www /data0/htdocs/www

  8、创设php-fpm配置文件php-fpm是为PHP打客车一个FastCGI管理补丁,能够平滑更改php.ini配置而无需重启php-cgi):
  在/usr/local/webserver/php/etc/目录中创制php-fpm.conf文件:rm -f /usr/local/webserver/php/etc/php-fpm.conf
vi /usr/local/webserver/php/etc/php-fpm.conf
  输入以下内容如果你安装 Nginx PHP 用于程序调节和测试,请将以下的<value name="display_errors">0</value>改为<value name="display_errors">1</value>,以便展现PHP错误消息,不然,Nginx 会报状态为500的空域错误页):<?xml version="1.0" ?>
<configuration>

 All relative paths in this config are relative to php's install prefix

 <section name="global_options">

   Pid file
   <value name="pid_file">/usr/local/webserver/php/logs/php-fpm.pid</value>

   Error log file
   <value name="error_log">/usr/local/webserver/php/logs/php-fpm.log</value>

   Log level
   <value name="log_level">notice</value>

   When this amount of php processes exited with SIGSEGV or SIGBUS ...
   <value name="emergency_restart_threshold">10</value>

   ... in a less than this interval of time, a graceful restart will be initiated.
   Useful to work around accidental curruptions in accelerator's shared memory.
   <value name="emergency_restart_interval">1m</value>

   Time limit on waiting child's reaction on signals from master
   <value name="process_control_timeout">5s</value>

   Set to 'no' to debug fpm
   <value name="daemonize">yes</value>

 </section>

 <workers>

   <section name="pool">

     Name of pool. Used in logs and stats.
     <value name="name">default</value>

     Address to accept fastcgi requests on.
     Valid syntax is 'ip.ad.re.ss:port' or just 'port' or '/path/to/unix/socket'
     <value name="listen_address">127.0.0.1:9000</value>

     <value name="listen_options">

       Set listen(2) backlog
       <value name="backlog">-1</value>

       Set permissions for unix socket, if one used.
       In Linux read/write permissions must be set in order to allow connections from web server.
       Many BSD-derrived systems allow connections regardless of permissions.
       <value name="owner"></value>
       <value name="group"></value>
       <value name="mode">0666</value>
     </value>

     Additional php.ini defines, specific to this pool of workers.
     <value name="php_defines">
       <value name="sendmail_path">/usr/sbin/sendmail -t -i</value>
       <value name="display_errors">0</value>
     </value>

     Unix user of processes
     <value name="user">www</value>

     Unix group of processes
     <value name="group">www</value>

     Process manager settings
     <value name="pm">

       Sets style of controling worker process count.
       Valid values are 'static' and 'apache-like'
       <value name="style">static</value>

       Sets the limit on the number of simultaneous requests that will be served.
       Equivalent to Apache MaxClients directive.
       Equivalent to PHP_FCGI_CHILDREN environment in original php.fcgi
       Used with any pm_style.
       <value name="max_children">128</value>

       Settings group for 'apache-like' pm style
       <value name="apache_like">

         Sets the number of server processes created on startup.
         Used only when 'apache-like' pm_style is selected
         <value name="StartServers">20</value>

         Sets the desired minimum number of idle server processes.
         Used only when 'apache-like' pm_style is selected
         <value name="MinSpareServers">5</value>

         Sets the desired maximum number of idle server processes.
         Used only when 'apache-like' pm_style is selected
         <value name="MaxSpareServers">35</value>

       </value>

     </value>

     The timeout (in seconds) for serving a single request after which the worker process will be terminated
     Should be used when 'max_execution_time' ini option does not stop script execution for some reason
     '0s' means 'off'
     <value name="request_terminate_timeout">0s</value>

     The timeout (in seconds) for serving of single request after which a php backtrace will be dumped to slow.log file
     '0s' means 'off'
     <value name="request_slowlog_timeout">0s</value>

     The log file for slow requests
     <value name="slowlog">logs/slow.log</value>

     Set open file desc rlimit
     <value name="rlimit_files">65535</value>

     Set max core size rlimit
     <value name="rlimit_core">0</value>

     Chroot to this directory at the start, absolute path
     <value name="chroot"></value>

     Chdir to this directory at the start, absolute path
     <value name="chdir"></value>

     Redirect workers' stdout and stderr into main error log.
     If not set, they will be redirected to /dev/null, according to FastCGI specs
     <value name="catch_workers_output">yes</value>

     How much requests each process should execute before respawn.
     Useful to work around memory leaks in 3rd party libraries.
     For endless request processing please specify 0
     Equivalent to PHP_FCGI_MAX_REQUESTS
     <value name="max_requests">1024</value>

     Comma separated list of ipv4 addresses of FastCGI clients that allowed to connect.
     Equivalent to FCGI_WEB_SERVER_ADDRS environment in original php.fcgi (5.2.2 )
     Makes sense only with AF_INET listening socket.
     <value name="allowed_clients">127.0.0.1</value>

     Pass environment variables like LD_LIBRARY_PATH
     All $VARIABLEs are taken from current environment
     <value name="environment">
       <value name="HOSTNAME">$HOSTNAME</value>
       <value name="PATH">/usr/local/bin:/usr/bin:/bin</value>
       <value name="TMP">/tmp</value>
       <value name="TMPDIR">/tmp</value>
       <value name="TEMP">/tmp</value>
       <value name="OSTYPE">$OSTYPE</value>
       <value name="MACHTYPE">$MACHTYPE</value>
       <value name="MALLOC_CHECK_">2</value>
     </value>

   </section>

 </workers>

</configuration>  9、运维php-cgi进度,监听127.0.0.1的柒仟端口,进度数为128万一服务器内部存款和储蓄器小于3GB,能够只开启六11个进度),用户为www:ulimit -SHn 65535
/usr/local/webserver/php/sbin/php-fpm start
  注:/usr/local/webserver/php/sbin/php-fpm还恐怕有别的参数,包涵:start|stop|quit|restart|reload|logrotate,修改php.ini后不重启php-cgi,重新加载配置文件使用reload。

本文出自 “FlyHome” 博客,请务必保留此出处

5.2.14所需的协助库: 注意:下边包车型客车libiconv比方装在/usr/local下因为php在make会要求 tar zxvf libiconv-1.13.1.tar.gz cd libiconv-1.13.1/ ./c...

3] mhash库

    index index.html index.htm index.php;

function_stop_mysql()
{
   printf "Stoping MySQL...n"
   /usr/local/webserver/mysql/bin/mysqladmin -u ${mysql_username} -p${mysql_password} -S /tmp/mysql.sock shutdown
}

修改配置文件:
vi /etc/sysctl.conf
kernel.shmmax = 134217728
然后执行以下命令使配置生效:/sbin/sysctl -p

以下的步骤和张宴步骤中一样配置,不再赘诉

  default_type  application/octet-stream;


tar zxvf libiconv-1.13.tar.gz  cd libiconv-1.13/  ./configure --prefix=/usr/local  make  make install  make clean
make distclean
cd ../  

ps -ef | grep "nginx: master process" | grep -v "grep" | awk -F ' ' '{print $2}'


在终极一步拷贝的时候,小编设置完在support-files下没有my-medium.cnf而唯有my-medium.cnf.sh所以将这些文件拷贝过去。

[client]

  5、修改php.ini文件
手工业修改:查找/usr/local/webserver/php/etc/php.ini中的extension_dir = "./"

是因为path的难题,所以进行:

net.ipv4.tcp_max_syn_backlog = 65536

3.假设提醒"configure: error: Cannot find ldap libraries in /usr/lib."的话.

自个儿设置的下载来自张宴博文下的地方,下载保存的是home下团结目录的二个文书夹下:

 

function_kill_mysql()
{
   kill -9 $(ps -ef | grep 'bin/mysqld_safe' | grep ${mysql_port} | awk '{printf $2}')
   kill -9 $(ps -ef | grep 'libexec/mysqld' | grep ${mysql_port} | awk '{printf $2}')
}

 4、编写翻译安装PHP5扩张模块--可选安装

    stub_status on;

ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config

     ②、运转MySQL(最后的&表示在后台运转)

read_buffer = 2M

mysql_port=3306
mysql_username="admin"
mysql_password="12345678"

    安装教程互连网有好多,放在google或是baidu一搜就有广大了,小编也是新手,安装的时候也是从网络找寻资料然后安装,首要服从的是张宴的一篇博文《

pm.max_requests = 512

2.注意进度中还会提示" Configure: error: libpng.(also) not found."错误,化解办法和上面包车型大巴同样.

@张宴原来的小说:

MySQL>flush privileges;

  附:以下为附加步骤,假设您想在那台服务器上运转MySQL数据库,则举办以下几步。如若你只是梦想让PHP帮忙MySQL增加库,能够再三再四其余服务器上的MySQL数据库,那么,以下两步无需实践。

checking for libmcrypt – version >= 2.5.0…  *** ‘libmcrypt-config –version’ returned 2.4.0, but LIBMCRYPT (2.5.8)  *** was found! If libmcrypt-config was correct, then it is best  *** to remove the old version of LIBMCRYPT. You may also be able to fix the error  *** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing  *** /etc/ld.so.conf. Make sure you have run ldconfig if that is  *** required on your system.  *** If libmcrypt-config was wrong, set the environment variable LIBMCRYPT_CONFIG  *** to point to the correct copy of libmcrypt-config, and remove the file config.cache  *** before re-running configure  configure: error: *** libmcrypt was not found   

max_connect_errors = 3000

1、编写翻译安装PHP 5.2.14所需的支撑库:注意:上边包车型大巴libiconv譬喻装在/usr/local下因为php在make会要求tar zxvf libiconv-1.13.1.tar.gz
cd libiconv-1.13.1/
./configure --prefix=/usr/local
make
make install
cd ../

建议一旦是新装置的连串,使用yum upgrade更新下系统。

      #fastcgi_pass  unix:/tmp/php-cgi.sock;

if [ "$1" = "start" ]; then
   function_start_mysql
elif [ "$1" = "stop" ]; then
   function_stop_mysql
elif [ "$1" = "restart" ]; then
function_restart_mysql
elif [ "$1" = "kill" ]; then
function_kill_mysql
else
   printf "Usage: /data0/mysql/${mysql_port}/mysql {start|stop|restart|kill}n"
fi注意:如若上边报错语法错误{注释掉function_kill_mysql方法和调用}  ⑤、赋予shell脚本可举办权限:chmod x /data0/mysql/3306/mysql

tar zxvf memcache-2.2.5.tgz
cd memcache-2.2.5/
/usr/local/webserver/php/bin/phpize
./configure --with-php-config=/usr/local/webserver/php/bin/php-config
make
make install
make clean
make distclean
cd ../

tar jxvf eaccelerator-0.9.5.3.tar.bz2
cd eaccelerator-0.9.5.3/
/usr/local/webserver/php/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=/usr/local/webserver/php/bin/php-config
make
make install
make clean
make distclean
cd ../

tar zxvf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2/
/usr/local/webserver/php/bin/phpize
./configure --with-php-config=/usr/local/webserver/php/bin/php-config --with-pdo-mysql=/usr/local/webserver/mysql
make
make install
make clean
make distclean
cd ../

tar zxvf ImageMagick.tar.gz
cd ImageMagick-6.5.1-2/
./configure
make
make install
make clean
make distclean
cd ../

tar zxvf imagick-2.2.2.tgz
cd imagick-2.2.2/
/usr/local/webserver/php/bin/phpize
./configure --with-php-config=/usr/local/webserver/php/bin/php-config
make
make install
make clean
make distclean
cd ../


5、修改php.ini文件
  手工修改:查找/usr/local/webserver/php/etc/php.ini中的extension_dir = "./"
  修改为extension_dir = "/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/"
  并在此行后增加以下几行,然后保存:
  extension = "memcache.so"
  extension = "pdo_mysql.so"
  extension = "imagick.so"

  再查找output_buffering = Off
  修改为output_buffering = On

6、配置eAccelerator加速PHP:
   mkdir -p /usr/local/webserver/eaccelerator_cache
   vi /usr/local/webserver/php/etc/php.ini
按shift g键跳到配置文件的最末尾,加上以下配置信息:

fastcgi_param  CONTENT_LENGTH     $content_length;

tar zxvf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2/
/usr/local/webserver/php/bin/phpize
./configure --with-php-config=/usr/local/webserver/php/bin/php-config --with-pdo-mysql=/usr/local/webserver/mysql
make
make install
cd ../

tar zxvf mhash-0.9.9.9.tar.gz  cd mhash-0.9.9.9/  ./configure  make  make install  cd ../  

kill -INT `cat /usr/local/php/var/run/php-fpm.pid`

#log-slow-queries = /data0/mysql/3306/slow.log
#long_query_time = 10

2、计划编译安装遇到,需求编写翻译源码用到gc

socket  = /tmp/mysql.sock

[mysqld]
character-set-server = utf8
replicate-ignore-db = mysql
replicate-ignore-db = test
replicate-ignore-db = information_schema
user    = mysql
port    = 3306
socket  = /tmp/mysql.sock
basedir = /usr/local/webserver/mysql
datadir = /data0/mysql/3306/data
log-error = /data0/mysql/3306/mysql_error.log
pid-file = /data0/mysql/3306/mysql.pid
open_files_limit    = 10240
back_log = 600
max_connections = 5000
max_connect_errors = 6000
table_cache = 614
external-locking = FALSE
max_allowed_packet = 32M
sort_buffer_size = 1M
join_buffer_size = 1M
thread_cache_size = 300
#thread_concurrency = 8
query_cache_size = 512M
query_cache_limit = 2M
query_cache_min_res_unit = 2k
default-storage-engine = MyISAM
thread_stack = 192K
transaction_isolation = READ-COMMITTED
tmp_table_size = 246M
max_heap_table_size = 246M
long_query_time = 3
log-slave-updates
log-bin = /data0/mysql/3306/binlog/binlog
binlog_cache_size = 4M
binlog_format = MIXED
max_binlog_cache_size = 8M
max_binlog_size = 1G
relay-log-index = /data0/mysql/3306/relaylog/relaylog
relay-log-info-file = /data0/mysql/3306/relaylog/relaylog
relay-log = /data0/mysql/3306/relaylog/relaylog
expire_logs_days = 30
key_buffer_size = 256M
read_buffer_size = 1M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover

 1] libiconv库

  1. /usr/sbin/groupadd mysql 
  2. /usr/sbin/useradd -g mysql mysql 
  3. tar zxvf mysql-5.5.25a.tar.gz 
  4. cd mysql-5.5.25a 

  4、编写翻译安装PHP5扩大模块tar zxvf memcache-2.2.5.tgz
cd memcache-2.2.5/
/usr/local/webserver/php/bin/phpize
./configure --with-php-config=/usr/local/webserver/php/bin/php-config
make
make install
cd ../

tar zxvf mcrypt-2.6.8.tar.gz  cd mcrypt-2.6.8/  /sbin/ldconfig  ./configure  make  make install  cd ../  

back_log = 300

cp -frp /usr/lib64/libpng* /usr/lib/
/usr/local/webserver/mysql/bin/mysql_install_db --basedir=/usr/local/webserver/mysql --datadir=/usr/local/webserver/mysql/data --user=xxx

  server

说明:

3、编写翻译安装PHP(法斯特CGI情势)

log-slave-updates

  ③、创制my.cnf配置文件:vi /data0/mysql/3306/my.cnf
  输入以下内容:引用[client]
character-set-server = utf8
port    = 3306
socket  = /tmp/mysql.sock

1、下载;

fastcgi_param  SERVER_ADDR        $server_addr;

因此这里大家要求复制一份libjpeg.so到/usr/lib/目录里技术够.再度施行./configure命令就可以.

在意:因为该库和libmcrypt有依据,所以在安装前务必明白libmcrypt,否则的话汇合世:

/usr/local/webserver/mysql/bin/mysql -u admin -p -S /tmp/mysql.sock

}上面包车型客车make之后要运维make install,而且若是是陆13位操作系统 则大概报错。假如报错:缺少libicon.so.2 那么只须求转移/etc/ld.so.conf 扩展一行: /usr/local/lib然后运营:/sbin/sdconfig假若继续报错:/usr/lib64/mysqlclient.so is empty 那么则需求删除那一个空文件,并复制/usr/local/webserver/mysql/lib/mysqlclient.so文件过来继续实践/sbin/sdconfig

/bin/sh /usr/local/webserver/mysql/bin/mysqld_safe --defaults-file=/usr/local/webserver/mysql/my.cnf &  

#master-password =   password

  ⑧、输入以下SQL语句,成立二个颇具root权限的用户admin)和密码12345678):GRANT ALL PEnclaveIVILEGES ON *.* TO 'admin'@'localhost' IDENTIFIED BY '12345678';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'127.0.0.1' IDENTIFIED BY '12345678';

[eaccelerator]
zend_extension="/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="128"
eaccelerator.cache_dir="/usr/local/webserver/eaccelerator_cache"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="300"
eaccelerator.shm_prune_period="120"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"

  gzip_min_length  1k;

[mysqldump]
quick
max_allowed_packet = 32M

留意:这里全体的吩咐是单排的而不能够有换行符,如若是copy的时候,注意要去处该换行符

max_heap_table_size = 246M

innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_size = 512M
innodb_data_file_path = ibdata1:256M:autoextend
innodb_file_io_threads = 4
innodb_thread_concurrency = 8
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 16M
innodb_log_file_size = 128M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_file_per_table = 0

自个儿设置的系列:Centos5

#my-large.cnf (内存 512M)

function_restart_mysql()
{
   printf "Restarting MySQL...n"
   function_stop_mysql
   sleep 5
   function_start_mysql
}

tar zxvf php-5.2.8.tar.gz  gzip -cd php-5.2.8-fpm-0.5.10.diff.gz | patch -d php-5.2.8 -p1  cd php-5.2.8/  ./configure --prefix=/usr/local/webserver/php --with-config-file-path=/usr/local/webserver/php/etc --with-mysql=/usr/local/webserver/mysql 
--with-mysqli=/usr/local/webserver/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib 
--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem 
--enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect 
--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap 
--with-ldap-sasl  make ZEND_EXTRA_LIBS='-liconv'  make install  cp php.ini-dist /usr/local/webserver/php/etc/php.ini  cd ../  

修改为:date.timezone = PRC #设置时区

  ④、创造管理MySQL数据库的shell脚本:vi /data0/mysql/3306/mysql
  输入以下内容这里的用户名admin和密码12345678接下去的步调会创设):#!/bin/sh

/usr/sbin/groupadd mysql  /usr/sbin/useradd -g mysql xxx
unzip mysql-5.1.33.zip  cd mysql-5.1.33/  ./configure --prefix=/usr/local/webserver/mysql/ --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables 
--with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=innobase  make   make install  make clean  make distclean  chmod  w /usr/local/webserver/mysql  chown -R xxx:mysql /usr/local/webserver/mysql  cp support-files/my-medium.cnf.sh /usr/local/webserver/mysql/my.cnf 
cd ../  

 

function_start_mysql()
{
   printf "Starting MySQL...n"
   /bin/sh /usr/local/webserver/mysql/bin/mysqld_safe --defaults-file=/data0/mysql/${mysql_port}/my.cnf 2>&1 > /dev/null &
}

留意:这里编写翻译./configure命令是单排的而无法有换行符,假诺是copy的时候,注意要去处该换行符

user    = mysql

4.举例提醒:/usr/bin/ld: cannot find -liconv

接下来再设置:

}

interactive_timeout = 120
wait_timeout = 120

make clean 和make distclean都以去除安装进程中变化的缓存文件。当然倘使您不介意放着也能够跳过这两步清理操作。

server-id = 1

  ②、以mysql用户帐号的身份营造数据表:/usr/local/webserver/mysql/bin/mysql_install_db --basedir=/usr/local/webserver/mysql --datadir=/data0/mysql/3306/data --user=mysql

tar zxvf libmcrypt-2.5.8.tar.gz  cd libmcrypt-2.5.8/  ./configure  make  make install  make clean
make distclean
/sbin/ldconfig  cd libltdl/  ./configure --enable-ltdl-install  make  make install  make clean
make distclean
cd http://www.cnblogs.com/  

(1)查看用户音讯

1.举个例子提醒"configure: error: libjpeg.(a|so) not found"错误

sudo -s  LANG=C  yum -y install gcc gcc-c   autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel 
glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel 
openldap openldap-devel nss_ldap openldap-clients openldap-servers  

[eaccelerator]

亟需查阅是不是安装了libiconv 和是或不是在/usr/local下。且/usr/lib 下存在libiconv.so文件,假如不设有须要查找libiconv.so到/usr/lib下。

ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la  ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so  ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4  ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8  ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a  ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la  ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so  ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2  ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
ln -s /usr/local/bin/libmcrypt-config   /usr/bin/libmcrypt-config

               '$status $body_bytes_sent "$http_referer" '

  ⑦、通过命令行登陆管理MySQL服务器提醒输入密码时一贯回车):/usr/local/webserver/mysql/bin/mysql -u root -p -S /tmp/mysql.sock

附:以下为附加步骤,假诺您想在那台服务器上运维MySQL数据库,则进行以下两步。假让你只是梦想让PHP扶助MySQL扩充库,能够三番五次其余服务器上的MySQL数据库,那么,以下两步没有需求实施。
  ①、以xxx用户帐号的身价创设数据表:

  client_header_buffer_size 32k;

  ⑥、启动MySQL:/data0/mysql/3306/mysql start

2]libmcrypt库

      #fastcgi_pass  unix:/tmp/php-cgi.sock;

透过下边包车型大巴物色其实就知晓有些原因了,configure一般的研究编写翻译路线为/usr/lib/下,因为php暗许就在/usr/lib/下找相关库文件,而x64机器上是在:/usr/lib64.那时你就可以直接把必要的库文件从/usr/lib64中拷贝到/usr/lib/中去就能够了.

只顾:这里./configure命令是单排的而不可能有换行符,借使是copy的时候,注意要去处该换行符

 2、设置crontab,天天凌晨00:00切割nginx访问日志

skip-name-resolve
#master-connect-retry = 10
slave-skip-errors = 1032,1062,126,1114,1146,1048,1396

担保卫安全装成功!手艺准确使用编写翻译。

就可以安装 gcc 了。

  3、编写翻译安装PHP法斯特CGI方式)tar zxvf php-5.2.14.tar.gz
gzip -cd php-5.2.14-fpm-0.5.14.diff.gz | patch -d php-5.2.14 -p1
cd php-5.2.14/
./configure --prefix=/usr/local/webserver/php --with-config-file-path=/usr/local/webserver/php/etc --with-mysql=/usr/local/webserver/mysql --with-mysqli=/usr/local/webserver/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap
make ZEND_EXTRA_LIBS='-liconv'
make install
cp php.ini-dist /usr/local/webserver/php/etc/php.ini
cd ../注意:倘使布置php报错,且机器是60个人系统:{

二、安装mysql

exclude=kernel* 

tar zxvf imagick-2.3.0.tgz
cd imagick-2.3.0/
/usr/local/webserver/php/bin/phpize
./configure --with-php-config=/usr/local/webserver/php/bin/php-config
make
make install
cd ../

3、安装:

 7、创制www用户和组,以及供四个虚拟主机使用的目录:

  ⑨、可选)停止MySQL:/data0/mysql/3306/mysql stop

  fastcgi_buffer_size 64k;

  ①、创制MySQL数据仓库储存放目录mkdir -p /data0/mysql/3306/data/
mkdir -p /data0/mysql/3306/binlog/
mkdir -p /data0/mysql/3306/relaylog/
chown -R mysql:mysql /data0/mysql/

  ①、对于Nginx 0.8.x版本,以往平坦重启Nginx配置特别不难,施行以下命令就可以:


              '"$http_user_agent" $http_x_forwarded_for';

tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
/sbin/ldconfig
./configure
make
make install
cd ../

 

server-id = 1

#master-connect-retry = 10

  2、编写翻译安装MySQL 5.5.3-m3/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
tar zxvf mysql-5.5.3-m3.tar.gz
cd mysql-5.5.3-m3/
./configure --prefix=/usr/local/webserver/mysql/ --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=partition,innobase,myisammrg
make && make install
chmod w /usr/local/webserver/mysql
chown -R mysql:mysql /usr/local/webserver/mysql
cd ../

 使配置立刻生效:

cp -frp /usr/lib64/libjpeg.* /usr/lib/

  fastcgi_read_timeout 300;

tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install
cd ../../

}

cp -frp /usr/lib64/libldap* /usr/lib/

events 

tar jxvf eaccelerator-0.9.6.1.tar.bz2
cd eaccelerator-0.9.6.1/
/usr/local/webserver/php/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=/usr/local/webserver/php/bin/php-config
make
make install
cd ../

eaccelerator.debug="0"

修改为:expose_php = OFF #禁止展现php版本的音信

eaccelerator.shm_prune_period="3600"

    root  /data0/htdocs/www;

thread_stack = 192K

  gzip_comp_level 2;

centos 6.2 64位 nginx-1.2.1 php-5.3.14 mysql-5.5.25

#默认128

  1. tar zxvf pcre-8.30.tar.gz 
  2. cd pcre-8.30/ 
  3. ./configure 
  4. make && make install 
  5. cd ../ 

  worker_connections 65535;

  1. /usr/local/webserver/php/sbin/php-fpm & 

 

 

#默认256

user  www www;

#my-medium.cnf (内存 128M)

eaccelerator.compress="1"

 

  gzip_http_version 1.0;

INT, TERM 立时终止

  gzip_buffers     4 16k;

              '$status $body_bytes_sent "$http_referer" '

四、配置开机自动运维Nginx PHP

#在support-files目录中有四个布局音信文件:这里大家挑选内部存款和储蓄器1-2G的

port    = 3306

阳台处境

找到:expose_php = On

  ①、在/usr/local/webserver/nginx/conf/目录中开创nginx.conf文件:

group = www 

sort_buffer_size = 128M

  fastcgi_connect_timeout 300;

myisam_repair_threads = 1

 

fastcgi_param  SERVER_NAME        $server_name;

#net.ipv4.tcp_tw_len = 1

在最终增添以下内容:

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;

    location ~ .*.(php|php5)?$

 按shift g键跳到陈设文件的最末尾,加上以下配置音信:

  1. mkdir -p /data0/mysql/3306/data/ 
  2. mkdir -p /data0/mysql/3306/binlog/ 
  3. mkdir -p /data0/mysql/3306/relaylog/ 
  4. chown -R mysql:mysql /data0/mysql/ 

socket  = /tmp/mysql.sock

  1. tar zxvf ImageMagick.tar.gz 
  2. cd ImageMagick-6.5.1-2/ 
  3. ./configure 
  4. make 
  5. make install 
  6. cd ../ 

short_open_tag = On

    }

(2)输入以下SQL语句,成立一个颇具root权限的用户(admin)和密码(12345678):

sort_buffer_size = 1M

fastcgi_param  DOCUMENT_ROOT      $document_root;

    listen       80;

  the configuration file /usr/local/webserver/nginx/conf/nginx.conf was tested successfully

max_connections = 2000

#master-port     =  3306

  1. vi /etc/rc.d/rc.local 

    #limit_conn   crawler  20;                        

[mysqld]

  }

      expires      1h;

  1. cp php.ini-production /usr/local/webserver/php/etc/php.ini 
  2. cd ../ 

3、创建Nginx日志目录

#net.ipv4.tcp_fin_timeout = 30

;pm = static ;进度数静态格局不亮堂的不要涂改

在末了扩充以下内容:

net.core.wmem_max = 16777216

 

tmp_table_size = 128M

{

pm.start_servers = 5 ;动态方式下的伊始php-fpm进度数量。

fastcgi_param  SERVER_SOFTWARE    nginx;

fastcgi_param  REMOTE_PORT        $remote_port;

 

    location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$

query_cache_limit = 2M

kill -USR1 `cat /usr/local/webserver/nginx/nginx.pid`

query_cache_size = 256M

error_log  /data0/logs/nginx_error.log  crit;

    access_log   off;

本文由ca88发布,转载请注明来源

关键词: ca88网址 cabet667