nginx+php+mysql 编译笔记

匿名 (未验证), 23 五月, 2010

lamp的编译安装最复杂的环节就是php的编译,以下记录是安装的一些要点。

环境:Centos5,nginx/php/mysql全部装在/opt下,其余的软件或库在默认路径(php编译参数和路径有关)。

命令:

./configure --prefix=/opt/php --with-mysql=/opt/mysql --with-mysqli=/opt/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-xmlrpc --enable-zip --enable-soap

make ZEND_EXTRA_LIBS='-liconv'

(make test出错)

echo "/usr/local/lib" >> /etc/ld.so.conf

(make test还是出错,不过可以忽略了)

make install

vim /opt/php/etc/php-fpm.conf

ulimit -SHn 65535

/opt/php/sbin/php-fpm start

至此,php应该正常生效,下一步可配置nginx

 

编译nginx

./configure --prefix=/opt/nginx --with-http_stub_status_module

编译mysql

CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/opt/mysql --enable-assembler --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-unix-socket-path=/tmp/mysql.sock

安装mysql一般步骤

shell> groupadd mysql
shell> useradd -g mysql mysql
shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
shell> cd mysql-VERSION
shell> ./configure --prefix=/usr/local/mysql
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> bin/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql var
shell> bin/mysqld_safe --user=mysql &
 

评论