一、安裝apache
2. 安裝必要的元件
檢視是否安裝了pcre pcre-devel
3. 解除安裝系統原來的apache
因為centos6.5預設已經安裝了apache2.2,所以先要解除安裝
依賴包很多,依次順藤摸瓜解除安裝就好了
4. 安裝apr
配置過程會彈出 not found 'libtoolt' 的錯誤,還是用網上流行的辦法tar zxvf apr-1.5.1.tar.gz
cd apr-1.5.1
./configure --prefix=/usr/local/apr
vim configure
/$rm "$cfgfile"
找到了語句後直接#注釋掉就ok啦!
然後老步驟,make && make install
5. 安裝apr-uti
6. 安裝apachetar zxvf apr-util-1.5.3.tar.gz
cd apr-util-1.5.3
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
如果想多了解一下配置引數可以./configure --help一下,如果要搜尋某個引數,如apr可以./configure --help | grep apr,都是題外話。
7.其他配置./configure --prefix=/usr/local/apache2 \
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr-util \
--enable-so --enable-rewrite
make && make install
將apache安裝為系統服務
然後 vi /etc/rc.d/init.d/httpd 新增(# !/bin/sh下面)
# chkconfig: 2345 50 90
# description: activates/deactivates apache web server
最後,執行chkconfig把apache新增到系統的啟動服務組裡面:
然後再service httpd start
記得最後放開防火牆埠
大功告成!!!vim /etc/sysconfig/iptables
-a input -m state --state new -m tcp -p tcp --dport 80 -j accept
service iptables restart
二、安裝php
1. 安裝extension
2. 編譯安裝yum install libxml2-devel
yum install openssl-devel
yum install gd-devel
3. 其他配置./configure \
--prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-config-file-scan-dir=/usr/local/php/etc/conf.d \
--with-pear \
--with-gd \
--with-zlib \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-openssl \
--disable-debug \
--enable-zip \
--enable-calendar \
--enable-ftp \
--enable-mbstring \
--enable-soap \
--enable-sockets
make && make test && make install
確保以下字串是否存在
loadmodule php5_module modules/libphp5.so
注意:一定要先service httpd stop->service httpd start,而不能直接直接restart,否則errorlog會報「child pid ***xx exit signal segmentation fault (11)」!
4. 最後就是測試php了
cd /usr/local/apache2/htdocs
vim hello.php
***xx(此處省略了)
測試連線mariadb
vim mysql_test.php
如果要設定web目錄許可權,很easy<?php
$link=mysql_connect('127.0.0.1','root','mysql_pass');
if(!$link) echo 'cannot connect!';
else echo 'success';
mysql_close();
chmod -r 775 /var/www
nice!lamp在64位伺服器完美三合一!! CentOS原始碼安裝PHP
先安裝需要的庫 yum y install libxml2 yum y install libxml2 devel yum y install gd yum y install gd devel yum y install curl curl devel yum y install libjpeg ...
CentOS 原始碼安裝PHP
2 解壓縮並且進入解壓縮後的檔案目錄下 4 make make install 遇到問題 1 configure error xml2 config not found.please check your libxml2 installation 參看 安裝php時的報錯 checking libx...
Centos 原始碼安裝apache
安裝apache前準備 1 檢查該環境中是否已經存在httpd服務的配置檔案,預設儲存路徑 etc httpd httpd.conf 這是centos預裝的apache的乙個ent版本,一般我們安裝源 版的apache 如果已經存在 etc httpd httpd.conf,請先解除安裝或者關閉ce...