php+mysql+apache+nginx

來源:互聯網
上載者:User

標籤:

http://www.cnblogs.com/xiaoluo501395377/archive/2013/04/07/3003278.html 安裝mysql

rpm -qa | grep mysql  // 這個命令就會查看該作業系統上是否已經安裝了mysql資料庫

rpm -e --nodeps mysql  // 強力刪除模式,如果使用上面命令刪除時,提示有依賴的其它檔案,則用該命令可以對其進行強力刪除

yum install -y mysql-server mysql mysql-deve

service mysqld start

service mysqld restart

mysqladmin -u root password ‘root‘  // 通過該命令給root帳號設定密碼為 root

此時我們就可以通過 mysql -u root -p 命令來登入我們的mysql資料庫了

二 安裝apache

yum install -y gcc gcc-c++

wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz 

wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz 

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

2.編譯安裝:yum remove apr-util-devel apr apr-util-mysql apr-docs apr-devel apr-util apr-util-docs

具體步驟如下:  a:解決apr not found問題>>>>>>

[[email protected] test]# tar -zxf apr-1.4.5.tar.gz 

[[email protected] test]# cd  apr-1.4.5 

[[email protected] apr-1.4.5]# ./configure --prefix=/usr/local/apr 

[[email protected] apr-1.4.5]# make && make install   

 

b:解決APR-util not found問題>>>>

 

[[email protected] test]# tar -zxf apr-util-1.3.12.tar.gz 

[[email protected] test]# cd apr-util-1.3.12 

[[email protected] apr-util-1.3.12]# ./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr/bin/apr-1-config 

[[email protected] apr-util-1.3.12]# make && make install  

 

c:解決pcre問題>>>>>>>>>

 

[[email protected] test]#unzip -o pcre-8.10.zip 

[[email protected] test]#cd pcre-8.10 

[[email protected] pcre-8.10]#./configure --prefix=/usr/local/pcre 

[[email protected] pcre-8.10]#make && make install

 

wget http://apache.fayea.com//httpd/httpd-2.4.10.tar.gz

執行命令 tar -zxvf httpd-2.4.10.tar.gz,解壓縮後會產生httpd-2.4.10目錄cd httpd-2.4.10 進入httpd-2.4.10目錄,搜尋設定內容,執行:

./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-ssl --enable-ssl --enable-module=so --enable-rewrite --enable-cgid --enable-cgi

make

make install

/usr/local/apache/bin/apachectl start  開啟

 

修改連接埠號碼 listen 81

ServerName localhost:81

 三 PHP

1: wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz

 

tar -zxvf libiconv-1.13.1.tar.gz cd libiconv-1.13.1 ./configure --prefix=/usr/local/libiconv

make

make install

 

configure error xml2-config not found. please check your libxml2 installation

yum install libxml2

yum install libxml2-devel -y

[[email protected] /] # find / -name "xml2-config"
/usr/bin/xml2-config

如果安裝成功以後,在/usr/local/libxml2/目錄下將產生bin、include、lib、man和share五個目錄。在後面安裝PHP5原始碼包的配置時,會通過在configure命令的選項中加上"--with-libxml-dir=/usr/ local/libxml2"選項,用於指定安裝libxml2庫檔案的位置。

 

undefined reference to `libiconv_open 無法編譯PHP libiconv

解決方案: #wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz #tar -zxvf libiconv-1.13.1.tar.gz #cd libiconv-1.13.1 # ./configure --prefix=/usr/local/libiconv # make # make install

加上一下這句

--with-iconv=/usr/local/libiconv

 

wget http://cn2.php.net/distributions/php-5.5.20.tar.gz

 

tar zvxf php-5.5.20.tar.gz
cd php-5.5.20
./configure --prefix=/usr/local/php --disable-fileinfo --enable-maintainer-zts --with-apxs2=/usr/local/apache/bin/apxs --with-iconv=/usr/local/libiconv --with-config-file-path=/usr/local/php/etc 
make 
make install

4.重新設定apache2讓他支援php

  • 配置 httpd.conf 讓apache支援PHP:

  # vi /usr/local/apache/conf/httpd.conf

  找到 AddType application/x-gzip .gz .tgz 在其下添加如下內容

  AddType application/x-httpd-php .php      (.前面有空格)

  AddType application/x-httpd-php-source .phps        (.前面有空格)

 

在LoadModule php5_module modules/libphp5.so這一行下面添加: AddType application/x-httpd-php .php  (注意:php .php這個點前面有一個空格)

 

找到:;open_basedir =
修改為:open_basedir = .:/tmp/   #防止php木馬跨站
找到:;date.timezone =
修改為:date.timezone = PRC

 

  • 然後CPOPY PHP的設定檔

  cp php-5.3.8/php.ini.dist /usr/local/php/etc/php.ini 

    (如果沒有php.ini.dist 則把php.ini-development php.ini-production中的任何一個重新命名為php.ini.dist即可。)

  修改php.ini檔案 register_globals = On

 

4: NGINX

yum install libtool yum install zlib zlib-devel

 

yum install openssl

 

configure: error: You need a C++ compiler for C++ support.  (解決辦法: yum install -y gcc gcc-c++)

http://chenzhou123520.iteye.com/blog/1817563  [pcre]安裝

http://nginx.org/  下載nginx

wget http://nginx.org/download/nginx-1.0.1.tar.gz

tar zxvf nginx-1.0.1.tar.gz

cd nginx-1.0.1/

./configure --prefix=/usr/local/nginx --with-http_stub_status_module   --with-pcre=這裡是pcre的原始碼目錄 ,不是安裝目錄

make && make install

 

nginx的啟動命令是:

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

# /usr/local/nginx/sbin/nginx -s  reload 
nginx已經重啟成功

 

配置 :

location / {
            root   /usr/local/apache/htdocs;
            index  index.html index.htm;
        }

   location ~ \.php$ {
            proxy_set_header Host $http_host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass   http://127.0.0.1:81;
        }
        location ~.*\.(jpg|jepg|png)$ {
            root   /usr/local/apache/htdocs;
            access_log off;
            expires  3d;
        }
        location ~.*\.(js|css)$ {
            root   /usr/local/apache/htdocs;
            access_log off;
            expires 3d;
        }

 

 

php+mysql+apache+nginx

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.