zkg510168343的专栏

我是将下载好的软件包放到虚拟机 /home目录下,虚拟机是centos6.4如果想了解nginx源码安装mysql源码安装 PHP安装前准备,软件包下载地址libmcrypt包mhashmcryptphp首先来安装几个源码包依赖:tar -jxvf libmcrypt-2.5.8.tar.bz2 # 这个包是bz2的 使用-j参数解压cd libmcrypt-2.5.8./configuremake && make install####################################################tar -jxvf mhash-0.9.9.9.tar.bz2cd mhash-0.9.9.9./configuremake && make install# 这两个包安装完成后要把动态链接库做一个软连接到/usr/lib,以为接下来的mcrypt依赖于这两个包ln -s /usr/local/lib/libmcrypt* /usr/libln -s /usr/local/lib/libmhash.* /usr/lib/ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config###########################################################tar -zxvf mcrypt-2.6.8.tar.gzcd mcrypt-2.6.8./configuremake && make installphp安装安装依赖:yum –y install libxml2-devel curl-devel libpng-devel openldap-develtar -jxvf php-5.4.0.tar.bz2cd php-5.4.0./configure –prefix=/usr/local/php –with-mysql=/usr/local/mysql/ –with-zlib –enable-xml –disable-rpath –enable-safe-mode –enable-bcmath –enable-shmop –enable-sysvsem –with-curl –with-curlwrappers –enable-fpm –enable-fastcgi –with-mcrypt –with-gd –with-openssl –with-mhash –enable-sockets –with-ldap –with-ldap-sasl –with-xmlrpc -enable-zip –enable-soap这一步会出现各种各样的问题,大多是因为缺少软件首先预编译第一次提示了configure: error: *** libmcrypt was not found这个是因为环境变量的问题,gcc编译的时候根据自身定义的变量寻找相关函数库等文件,libmcrypt也是刚安装的,在变量中没有定义出来,所以手动添加:[root@localhost modules]# export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH再次编译,又一次出错checking for cURL in default path… not foundconfigure: error: Please reinstall the libcurl distribution -easy.h should be in /include/curl/这个是curl的dev包没有安装, 解决方案:yum -y install curl-devel再次编译,报错:If configure fails try –with-vpx-dir=<DIR>If configure fails try –with-jpeg-dir=<DIR>configure: error: png.h not found.这个是因为libpng没有安装,于是我执行命令yum install libpng-devel再次编译,仍然报错configure: error: Cannot find ldap.h好吧缺少openldap库yum install openldap-devel继续编译,还是报错configure: error: Cannot find ldap libraries in /usr/lib.这个错误一般是在编译安装PHP的时候会出现这个提示。解决方法如下:cp -frp /usr/lib64/libldap* /usr/lib/可能的原因是安装了64位的系统,,在lib64下面有这个文件,可能在lib这文件夹里面没有,所以强制复制一次。快要崩溃了,再一次编译,当出现thanks you using php界面,终于预编译通过了,这里其实每个人遇到的错误会不一样,这些是我编译遇到的问题执行make && make install 感觉一切要结束的时候,问题又来了提示错误:/root/dev/php-5.4.0/sapi/cli/php: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directorymake: *** [ext/phar/phar.php] Error 127网上找到的解决办法是ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/照做后仍然报错,原因是该方法适用于32位系统,64位系统应使用下面的这行ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/再次make && make install偶也PHP安装成功到这里整个LNMP已经安装完成.下面我们就配置php和nginx能运行php网站:首先为php创建配置文件:cp php.ini-production /usr/local/php/php.ini # 如果是开发就复制php.ini-developmentcp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.confln -s /usr/local/php/bin/php /usr/bin/启动php-fpm/usr/local/php/sbin/php-fpmnetstat -tunlp | grep php-fpmphp-fpm启动配置nginx与php找到这段,前面添加 index.php类型location / { root html; index index.php index.htm index.html; }打开这段注释location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html/$fastcgi_script_name;//这里目录就是web服务器站点代码存放目录 include fastcgi_params; }保存后重启nginx service nginx restart在/usr/local/nginx/html里添加 index.php文件里面输入<?php echo phpinfo();?>访问站点 192.168.2.151出现php配置信息,这样一个简单的站点算是部署完成,如果想在一台服务器上部署多个虚拟站点,阅读:当然nginx功能强大,这里只是一个开始

用积极的拼搏迎接雨后的彩虹,相信自己

zkg510168343的专栏

相关文章:

你感兴趣的文章:

标签云: