linux apache php 环境搭建 (笔记)

apache 禁止爬虫


<Directory "/home/wwwroot/xxx">
SetEnvIfNoCase User-Agent ".*(FeedDemon|JikeSpider|Indy Library|Alexa Toolbar|AskTbFXTV|AhrefsBot|CrawlDaddy|CoolpadWebkit|Java|Feedly|UniversalFeedParser|ApacheBench|Microsoft URL Control|Swiftbot|ZmEu|oBot|jaunty|Python-urllib|lightDeckReports Bot|YYSpider|DigExt|YisouSpider|HttpClient|MJ12bot|heritrix|EasouSpider|Ezooms)" BADBOT
        Order allow,deny
        Allow from all
       deny from env=BADBOT
</Directory>


linux ssh coding 配置

1. 检查SSH keys是否存在

ls -al ~/.ssh
# Lists the files in your .ssh directory, if they exist


2. 生成新的ssh key
第一步:生成public/private rsa key pair

在命令行中输入

ssh-keygen -t rsa -C "fyj@xxx.com"

默认会在相应路径下(/your_home_path)生成id_rsa和id_rsa.pub两个文件,如下面代码所示

cat id_rsa.pub

复制里面的内容 添加到 coding 配置里面








可是这机器不是我的,各种报错 ‘onfigure: error: APR not found . Please read the documentation’
为了保守起见,把相关关联包都安装一下:

1、下载相关的包

wget http://mirrors.shu.edu.cn/apache/apr/apr-1.6.3.tar.gz


wget http://mirrors.shu.edu.cn/apache/apr/apr-1.6.5.tar.gz

tar -zxf apr-1.6.3.tar.gz    

cd  apr-1.6.3   

./configure --prefix=/usr/local/apr    

make && make install    


wget http://mirrors.hust.edu.cn/apache/apr/apr-util-1.6.1.tar.gz

tar -zxf apr-util-1.6.1.tar.gz    

cd apr-util-1.6.1  

./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config --enable-utf8

make && make install

报错 make: *** No targets specified and no makefile found. Stop.

只有 yum update

make[1]: * [xml/apr_xml.lo] Error 1
make[1]: Leaving directory `/root/Downloads/apache_svn/apr-util-1.6.0'
make: * [all-recursive] Error 1

安装 yum install expat-devel



wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip 

unzip -o pcre-8.10.zip  

cd pcre-8.10    

./configure --prefix=/usr/local/pcre    

make && make install  

报错
make[1]: *** [libpcrecpp.la] 错误 1
make[1]: Leaving directory `/usr/app/pcre-8.00'
make: *** [all] 错误 2

./configure --disable-shared --with-pic    

make && make install  

安装zlib

wget http://www.zlib.net/fossils/zlib-1.2.8.tar.gz

tar zxf zlib-1.2.8.tar.gz 

cd zlib-1.2.8/

./configure --prefix=/usr/local/zlib

make && make install




apache install

获得一个httpd-2.4.23.tar.gz  

wget http://archive.apache.org/dist/httpd/httpd-2.4.23.tar.gz

tar -zxf httpd-2.4.23.tar.gz

cd  httpd-2.4.23

./configure --prefix=/usr/local/apache --enable-proxy=shared --enable-proxy-balancer=shared --enable-proxy-http=shared --with-include-apr --enable-proxy-connect=shared --enable-asis=shared --enable-isapi=shared --enable-mods-shared=all--enable-so --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre --enable-mpms-shared=all  --with-mpm=event --with-z=/usr/local/zlib --enable-rewrite --libdir=/usr/lib64


报错 checking for pcre-config... false
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

执行  yum -y install pcre-devel

make && make install

make[2]: [htpasswd] 错误 1
make[2]: 离开目录“/usr/local/src/httpd-2.4.27/support”
make[1]: [all-recursive] 错误 1
make[1]: 离开目录“/usr/local/src/httpd-2.4.27/support”
make: *** [all-recursive] 错误 1

解决办法:

cd /usr/local/src/
cp -r apr-1.6.2  /usr/local/src/httpd-2.4.27/srclib/apr
cd apr-1.6.3
./configure --prefix=/usr/local/apr
make && make install
cp -r apr-util-1.6.0  /usr/local/src/httpd-2.4.27/srclib/apr-util
cd /usr/local/src/apr-util-1.5.4
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install


/usr/local/apache/bin/apachectl start  


PHP7 install

安装php需要的扩展

yum install libxml2 libxml2-devel openssl openssl-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libmcrypt libmcrypt-devel -y  


1. 源码包下载地址 7.2.6

wget http://cn2.php.net/get/php-7.2.6.tar.gz/from/this/mirror  


tar –zxvf mirror

# tar –zxvf php-7.2.0.tar.gz 

cd php7.2.0  

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysqli --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-simplexml --enable-xml --disable-rpath --enable-bcmath --enable-soap --enable-zip --with-curl --enable-fpm --with-fpm-user=nobody --with-fpm-group=nobody --enable-mbstring --enable-sockets --with-gd --with-openssl --with-mhash --enable-opcache --disable-fileinfo



# ./configure --prefix=/usr/local/phpnew --with-apxs2=/usr/local/apache/bin/apxs --with-mysqli --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-simplexml --enable-xml --disable-rpath --enable-bcmath --enable-soap --enable-zip --with-curl --enable-fpm --with-fpm-user=nobody --with-fpm-group=nobody --enable-mbstring --enable-sockets --with-gd --with-openssl --with-mhash --enable-opcache --disable-fileinfo



make && make install  

安装PHP出现make: *** [sapi/cli/php] Error 1 解决办法

在安裝 PHP 到系统中时要是发生「undefined reference to libiconv_open'」之类的错误信息,
那表示在「./configure 」沒抓好一些环境变数值。错误发生点在建立「-o sapi/cli/php」是出错,
没給到要 link 的 iconv 函式库参数。
解决方法:编辑Makefile 大约100 行左右的地方: 
EXTRA_LIBS = ..... -lcrypt 在最后加上 -liconv,
例如: EXTRA_LIBS = ..... -lcrypt -liconv 然后重新再次 make 即可。

重新 make


cp php.ini-production /usr/local/php/php.ini

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值