时间:2021-07-01 10:21:17 帮助过:17人阅读
libmcrypt-2.5.8.tar.gz,加密库
mcrypt-2.6.8.tar.gz
mhash-0.9.9.9.tar.gz
5、安装PHP
wget tar zxvf php-5.6.30.tar.gz cd php-5.6.30/ yum install libxml2-devel.x86_64 libxml2.x86_64 openssl-devel.x86_64 libcurl-devel.x86_64 libjpeg-turbo.x86_64 libjpeg-turbo-devel.x86_64 png* libpng-devel.x86_64 freetype.x86_64 freetype-devel.x86_64 libxslt-devel.x86_64 libxslt.x86_64 zlib libxml libjpeg freetype libpng gd curl libiconv zlib-devel libxml2-devellibjpeg-devel freetype-devel libpng-devel gd-devel curl-devel -y 编译安装libiconv1.14: ============================================== tar zxvf libiconv-1.14.tar.gz cd libiconv-1.14/ ./configure --prefix=/usr/local/libiconv make make install =============================================== 编译安装mhash-0.9.9.9: ================================================= tar zxvf mhash-0.9.9.9.tar.gz cd mhash-0.9.9.9/ ./configure make && make install ================================================ 编译安装libmcrypt ================================================== tar zxvf libmcrypt-2.5.8.tar.gz cd libmcrypt-2.5.8/ ./configure make && make install cp /usr/local/lib/* /usr/local/lib64/ -av ##只正对64位操作系统,32为操作系统直接往下走 ln -s /usr/local/lib64/libmcrypt.la/usr/lib64/libmcrypt.la ln -s/usr/local/lib64/libmcrypt.so /usr/lib64/libmcrypt.so ln -s/usr/local/lib64/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4 ln -s/usr/local/lib64/libmcrypt.so.4.4.8 /usr/lib64/libmcrypt.so.4.4.8 ln -s /usr/local/lib64/libmhash.a/usr/lib64/libmhash.a ln -s/usr/local/lib64/libmhash.la /usr/lib64/libmhash.la ln -s/usr/local/lib64/libmhash.so /usr/lib64/libmhash.so ln -s/usr/local/lib64/libmhash.so.2 /usr/lib64/libmhash.so.2 ln -s/usr/local/lib64/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1 ln -s/usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config ##提示我搭好的环境中我并没有在/usr/local/lib64/下找到文件,文件都在/usr/local/lib, 可以把/usr/local/lib/下的文件复制到/usr/local/lib64/下 ================================================= yum install libxslt* -y ##安装libxslt* 编译安装mcrypt-2.6.8: ================================================ tar zxvf mcrypt-2.6.8.tar.gz cd mcrypt-2.6.8/ ./configure LD_LIBRAPY_PATH=/usr/local/lib ##原因未知,这个我是百度搜出来的 make && make install ================================================ ================================================= vim 1.txt ./configure --prefix=/application/php5.6.30 --with-mysql=/application/mysql --enable-mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir=/usr/local/libiconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-short-tags --enable-zend-multibyte --enable-static --with-xsl --with-fpm-user=nginx --with-fpm-group=nginx --enable-ftp --enable-embedded-mysqli --with-mysqli --with-pdo-mysql=/application/mysql cat 1.txt | bash echo $? make echo $? make install echo $? ln -s /application/php5.6.30/ /application/php cp php.ini-production /application/php/lib/php.ini ##提醒:如果是做开发的话就把php.ini-development复制过去 由于nginx调用PHP是通过一个fcgi的程序,所以,这个程序也是有配置文件的。 cd /application/php/etc/ cp php-fpm.conf.default php-fpm.conf egrep -v "^$|;" php-fpm.conf ------------------------------------------------------------------------ [global] pid = /app/logs/php-fpm.pid error_log = /app/logs/php-fpm.log log_level = error rlimit_files = 32768 events.mechanism = epoll [www] user = nginx group = nginx listen = 127.0.0.1:9000 listen.owner = nginx listen.group = nginx pm = dynamic pm.max_children = 1024 pm.start_servers = 16 pm.min_spare_servers = 5 pm.max_spare_servers = 20 pm.max_requests = 2048 slowlog = /app/logs/$pool.log.slow request_slowlog_timeout = 10 -------------------------------------------------------------------------- ../sbin/php-fpm -t +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 错误:ERROR: Unable to create or open slowlog(/applog/logs/www.log.slow): No such file or directory (2) 解决:mkdir /applog/logs/ -p +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ../sbin/php-fpm lsof -i :9000 ================================================
我编译PHP遇到的错误:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
错误:configure: error: Don‘t know how to define struct flock on this system, set --enable-opcache=no
解决:
ln -s /application/mysql/lib/libmysqlclient.so /usr/lib64/
ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
问题:checking whether to enable embeddedMySQLi support... yes
checking for mysql_set_server_optionin -lmysqlclient... no
configure: error: wrong mysql libraryversion or lib not found. Check config.log for more information.
解决:--with-mysqli后面不加路径
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
问题:Don‘t know how to define struct flockon this system, set --enable-opcache=no
解决:
以下红色路径看具体mysql安装路径而定
32位系统:
ln -s /usr/local/MySQL/lib/libmysqlclient.so /usr/lib/
ln -s /usr/local/mysql/lib/libmysqlclient.so.18/usr/lib/libmysqlclient.so.18
64位系统:
ln -s /usr/local/MySQL/lib/libmysqlclient.so /usr/lib64/libmysqlclient.so
ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
问题:configure: error: Please reinstallreadline - I cannot find readline.h
解决:yum install readline-devel.x86_64 -y
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
问题:make: *** [sapi/cli/php] Error 1
解决:
网上统一的解决方式: makeZEND_EXTRA_LIBS=‘-liconv‘
ln -s /usr/local/lib/libiconv.so.2/usr/lib64/
我自己的解决方式:重新编译安装libiconv(注意编译的的参数--with-iconv-dir的路径)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
=================测试LNMP环境==========================
cd /application/nginx/
--------------------------------------------------
vim html/blog/index.php
<?php
phpinfo();
?>
--------------------------------------------------
vim conf/extra/blog.conf
server {
listen 80;
server_name www.blog.vperson.org.cn;
access_log logs/blog.access.log main;
location / {
root html/blog;
index index.php index.html index.htm;
}
location ~ \.php$ {
root html/blog;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
include fastcgi.conf;
}
}
-----------------------------------------------------------------------------
./sbin/nginx -t
./sbin/nginx -s reload
curl www.blog.vperson.org.cn
错误集:
|
隐藏PHP版本:
vim /application/php/lib/php.ini
expose_php = On
搭建一个自己的开源网站:
opensns、phpcms、wiki等。
步骤:
下载开源软件包
#如http://kaiyuan.hudong.com/
创建数据库
#create database wiki;
创建数据库中的用户用于管理这个网站的数据
#grant all on wiki.* towiki@’localhost’ identified by ‘wiki’;
#flush privileges;
#quit
解压开源网站到指定的站点目录
#修改权限chown -Rnginx:nginx 目录
用浏览器访问
安装站点
总结: LNMP搭建对于新手来说是比较困难但是要细心,前后要有呼应,理解。 遇到困难先看错误,别急着百度,因为搜出来的大部分都是复制粘贴的。 记录下来每次的错误方便下次解决。 遇到困难,做了好久的,先放松放松,去散步什么的回来说不定就会了。 二进制的mysql不推荐新手完,因为他只是预设了一些参数。 |
##以上可能有错误,但是还请原谅因为我也是新手,刚刚开始学习linux,请多多指教。
本文出自 “10846118” 博客,请务必保留此出处http://10856118.blog.51cto.com/10846118/1916817
centos 6.8 安装LNMP环境(linux+nginx+mysql+php)
标签:centos 6.8 安装lnmp环境(linux+nginx+mysql+php)