centos+nginx+php+mysql配置1

centos6.3_x64
nginx-1.2.8
php-5.3.23
mysql-5.6.10
fastcgimemcache等優化,另外,因爲8萬字符的原因,錯誤截圖未能放上來,儘量在下次把錯誤代碼發上來
 
yum install autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml* zlib* glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel openldap-clients openldap-servers libxslt-devel gd gd-devel libtool-ltdl-devel* pcre-devel mysql-devel
tar zxvf libiconv-1.13.tar.gz
cd libiconv-1.13
./configure --prefix=/usr/local/
make
make install
cd ..
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make
make install
ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install
ldconfig
cd ..
tar zxvf cmake-2.8.10.2.tar.gz
cd cmake-2.8.10.2
./configure
make
make install
cd ..
groupadd mysql
useradd -g mysql -s /sbin/nologin -M mysql
tar zxvf mysql-5.6.10.tar.gz
cd mysql-5.6.10
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_SSL=bundled -DWITH_SSL=system -DCURSES_LIBRARY=/usr/lib64/libncurses.so -DCURSES_INCLUDE_PATH=/usr/include
make
make install
cd /usr/local/mysql/
chown -R mysql:mysql .
cd mysql-5.6.10/support-files/
cp my-default.cnf /etc/my.cnf
cp mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
cd /usr/local/mysql/
/usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/my.cnf --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
/etc/init.d/mysqld restart
echo "/usr/local/mysql/lib/" >> /etc/ld.so.conf
ldconfig
echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
source /etc/profile
mysql
         show variables like '%character%';
tar zxvf php-5.3.23.tar.gz
cd php-5.3.23
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/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 --enable-sockets --enable-zip --without-pear --enable-pdo --with-pdo-mysql
第一個錯誤和解決方法

ln -s /usr/local/mysql/bin/mysql_config /usr/bin/mysql_config
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql/ --with-mysqli=/usr/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 --enable-sockets --enable-zip --without-pear --enable-pdo --with-pdo-mysql
標紅的地方不管怎麼樣都得這麼改,我很不理解這樣就能通過了
第二個錯誤和解決方法

yum install mysql-devel
第三個錯誤的地方和解決方法,錯誤地方在--disable-rpath參數,

export LD_LIBRARY_PATH=/lib/:/usr/lib/:/usr/local/lib
第四個錯誤及解決辦法

make ZEND_EXTRA_LIBS='-liconv'
make install
cp php.ini-production /usr/local/php/etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
vim /usr/local/php/etc/php-fpm.conf
啓用如下選項:
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 2
pm.max_spare_servers = 8

pm.max_requests = 1024
pid = run/php-fpm.pid
/usr/local/php/sbin/php-fpm -t
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod 755 /etc/init.d/php-fpm
cd ..
tar zxvf pcre-8.10.tar.gz
cd pcre-8.10
./configure
make
cd ..
tar zxvf openssl-1.0.0e.tar.gz
cd openssl-1.0.0e
./config
make
cd ..
tar zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure
make
cd ..
tar zxvf nginx-1.2.8.tar.gz
cd nginx-1.2.8
./configure --prefix=/usr/local/nginx --with-openssl=/root/src/openssl-1.0.0e --with-http_stub_status_module --with-http_ssl_module --with-zlib=/root/src/zlib-1.2.3 --with-pcre
make
make install
cd ..
cd php-5.3.23/ext/pdo_mysql/
/usr/local/php/bin/phpize #測試
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql/
make
make install
vim /usr/local/php/etc/php.ini
找到extension_dir = "./"改成下面,並增加第2
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/"
extension = "pdo_mysql.so"
vim /usr/local/nginx/conf/nginx.conf
user  nobody;
worker_processes  1;
events {
    use epoll;
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    server {
        listen       80;
        server_name  localhost;
        location / {
            root   html;
            index  index.php index.html index.htm;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
        location ~ .*\.(php|php5)?$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx/html$fastcgi_script_name;
            include        fastcgi_params;
        }
    }
}
/usr/local/nginx/sbin/nginx -t
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
/etc/init.d/php-fpm start
nginx php mysql配置完成,優化下次
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章