CentOS6.5下編譯安裝LAMP環境和YAF架構

來源:互聯網
上載者:User

CentOS6.5下編譯安裝LAMP環境和YAF架構

昨天在今天學習手動編譯安裝LAMP環境和YAF架構吧~

首先使用yum 將昨天搭建的LAMP都刪除掉

# sudo yum erase httpd php* mysql*

然後開始手動安裝編譯吧~ 我先在usr下建立了一個test檔案夾,怕之後操作多了會不知道下載到哪裡去了。

#  mkdir /usr/test# cd /usr/test

1.- Apache

# wget http://mirrors.cnnic.cn/apache//httpd/httpd-2.4.16.tar.bz2


解壓並進入

# tar -jxvf httpd-2.4.26.tar.bz2# cd httpd-2.4.26

安裝 gcc

# sudo yum install gcc

configure

# ./configure --prefix=/test/httpd --enable-so --enable-rewrite

若出現apr問題,解決方案請看這裡

//configure沒問題後# make && make install# sudo /usr/test/prefix/httpd -k start

如果出現error:httpd: Could not reliably determine the server’s fully qualified domain name, ……. 解決方案是找到剛剛編譯的httpd檔案夾,比如 我的是:/usr/test/prefix/httpd,進入之後找到conf檔案夾下的httpd.conf檔案,編輯,將#ServerName www.example.con:80前面的#去掉,再重啟。

這樣開啟你的地址,出現It works! Apache就算安裝編譯成功啦~ PS 如果想要刪除掉前面下載的壓縮檔 可以用 rm -f 檔案名稱 命令刪除哦~

2.-php

# sudo yum install libxml2 libxml2-devel curl curl-devel libjpeg libjpeg-devel libpng libpng-devel libmcrypt libmcrypt-deel libtool-ltdl-devel
# wget http://cn2.php.net/get/php-5.5.28.tar.gz/from/this/mirror# mv mirror php-5.5.28.tar.gz# tar -zxvf php-5.5.28.tar.gz# cd php-5.5.28# ./configure --prefix=/usr/test/prefix/php --with-apxs2=/usr/test/prefix/httpd/bin/apxs --with-curl --with-mcrypt --enable-mbstring --with-iconv --with-gd --with-jpeg-dir=/usr/test/local/lib --enable-pdo --with-pdo-mysql=mysqlnd --with-mysql=mysqlnd --with-mysqli=mysqlnd# make && make install

然後要等久一點咯

編譯完成後

# sudo cp php.ini-development /usr/test/prefix/php/lib/php.ini# sudo ln -s /usr/test/prefix/php/bin/php /usr/bin/php

cp賦值命令詳解 ln命令詳解

# sudo vi /usr/test/prefix/php/lib/php.ini

把include_path前面的分號刪除,改成include_path = “/opt/php/lib/php”把include_path前面的分號刪除,改成include_path = “/usr/test/prefix/php/lib/php”

# sudo vi /usr/test/prefix/httpd/conf/httpd.conf

在最下面加入一行AddHandler application/x-httpd-php .php

# sudo /usr/test/prefix/httpd/bin/httpd -k restart# sudo vi /usr/test/prefix/httpd/htdocs/phpinfo.php

phpinfo.php的內容為

<?phpphpinfo();?>

然後 http://地址/phpinfo.php 可以看到php的配置資訊說明php裝好了~ 搜尋 mysqlnd pdo_mysql mysqli 如果有,說明php能訪問mysql

接下來把Apache加入系統service,開機自啟動

# sudo cp /usr/test/prefix/httpd/bin/apachectl /etc/init.d/httpd# sudo vi etc/init.d/httpd

在檔案開頭加上

#!:/bin/sh# chkconfig: 2345 85 15# description: Apache is World Wide Web server

接著

# sudo chmod +x /etc/init.d/httpd# /sbin/chkconfig --add httpd# sudo /sbin/chkconfig --list httpd# sudo ln -s /sbin/chkconfig /usr/bin/chkconfig# sudo ln -s /sbin/service /usr/bin/service

3-. mysql mysql就直接使用yum安裝吧 教程見上一篇搭建LAMP環境

4.-安裝PHP擴充ssh2 先安裝libssh2

# cd /usr/test/# wget https://github.com/libssh2/libssh2/releases/download/libssh2-1.6.0/libssh2-1.6.0.tar.gz#tar -zxvf libssh2-1.6.0.tar.gz#cd libssh2-1.6.0# ./configure --prifex=/usr/test/prefix/libssh2# make && make install

報錯說no cryoto library found. 這是因為我沒有安裝OpenSSLeep加密庫。 所以先安裝下吧

# yum install openssl-devel

再回到原來的檔案夾下完成編譯

再安裝ssh2

# cd /usr/test/# wget http://pecl.php.net/get/ssh2-0.11.3.tgz# tar -zxvf ssh2-0.11.3.tgz# cd ssh2-0.11.3.tgz# /usr/test/prefix/php/bin/phpize# ./configure --prefix=/usr/test/prefix/ssh2 --with-ssh2=/usr/test/prefix/libssh2 --with-php-config=/usr/test/prefix/php/bin/php-config# make && make install

然後再/usr/test/prefix/php/lib/php.ini中加上一句 extension=ssh2.so

如此 接下來就是Yaf啦~

# cd /usr/test# wget http://pecl.php.net/get/yaf-2.3.1.tgz# tar -zxvf yaf-2.3.1.tgz# cd yaf-2.3.1# /usr/test/prefix/php/bin/phpize# ./configure --prefix=/usr/test/prefix/yaf --with-php-confi=/usr/test/prefix/php/bin/php-config# make && make install

編譯安裝完畢後需在php.ini配置裡進行配置

extendsion = yaf.so[yaf]yaf.environ = productyaf.library = NULLyaf.cache_config = 0yaf.name_suffix = 1yaf.name_separator = ""yaf.forward_limit = 5yaf.use_namespace = 0yaf.use_spl_autoload = 0

然後重啟伺服器,查看phpinfo()中是否有yaf擴充

大功告成~ 接下來可以用yaf架構搭建自己的網站啦~

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.