linux 配置 Apache mysql php最新版

來源:互聯網
上載者:User

標籤:blog   http   使用   os   io   檔案   for   art   

第一部分:安裝mysql

官方下載 mysql5.6.19 64位的rpm格式檔案

0、rpm 四個mysql5.6.19

卸載預設的mysql 

yum -y remove mysql-libs-*

 yum -y remove mysql-libs-5.1.52* 

1、su命令
2、/etc/init.d/mysql start 開啟mysql
3、mysql -uroot -p

出現錯誤:ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)

------------------------------------
解決方案:
在這個目錄下找密碼/root/.mysql_secret
cd /root
ls -la
cat .mysql_secret 複製密碼
4、查看mysql啟動狀態/etc/rc.d/init.d/mysql status

登陸進去重新設定密碼
set password=password(‘admin‘); 

第二部分:安裝apache

1、

# tar zxvf httpd-2.2.11.tar.gz

# ./configure --prefix=/usr/local/apache2 --enable-dav --enable-modules=so

./configure  --prefix=/usr/local/apache  --enable-so【這個也行】

make

make install

一般出現這個-bash: make: command not found提示,是因為安裝系統的時候使用的是最小化mini安裝,系統沒有安裝make、vim等常用命令,直接yum安裝下即可。

-------------------------------------------------------

解決方案: 

yum -y install gcc automake autoconf libtool make 直接ssh運行即可,安裝make。 

啟動Apache服務:

# /usr/local/apache2/bin/apachectl start

出現錯誤:

httpd: apr_sockaddr_info_get() failed for VM_74_204_centos
httpd: Could not reliably determine the server‘s fully qualified domain name, using 127.0.0.1 for ServerName

-------------------------------

解決方案:

 在Apache的安裝目錄下的conf檔案修改如下
   (1) ServerName localhost:80                       

   或者在 /etc/hosts 中填入自己的主機名稱 bogon,如下:
   (2)127.0.0.1 bogon
---------------------------------------------

 

/usr/local/apache2/modules/libphp5.so: cannot open shared object file: No such file or directory

-------------------------------------------------

解決方案:Apache 安裝目錄http。conf檔案增加這一行

LoadModule php5_module       /usr/local/apache2/modules/libphp5.so

還是/usr/local/apache2/modules/libphp5.so: cannot open shared object file: No such file or directory 錯誤,那就先裝php吧 

 

第三部分:安裝php

安裝libxml2

1 tar zxvf libxml2-2.6.32.tar.gz
2 cd libxml2-2.6.32
3 ./configure --prefix=/usr/local/libxml2
4 make
5 make install

安裝php

1、tar zvxf php-5.3.8.tar.gz
2、cd php-5.3.8
3、./configure --prefix=/usr/local/php --with-mysqli=/usr/bin/mysql_config --with-apxs2=/usr/local/apache2/bin/apxs --with-libxml-dir=/usr/local/libxml2

出現錯誤

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

------------------------------------

解決方案:http://www.cnblogs.com/happyhotty/articles/2539864.html

【檢查是否安裝了libxm包

[[email protected] php-5.3.8]# rpm -qa |grep  libxml2
libxml2-2.6.26-2.1.12
libxml2-python-2.6.26-2.1.12 

重新安裝libxml2和libxml2-devel包

yum install libxml2

yum install libxml2-devel -y 

安裝完之後尋找xml2-config檔案是否存在

[[email protected] php-5.3.8]# find / -name "xml2-config"

/usr/bin/xml2-config

然後再重新 config

+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE.  By continuing this installation |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+

Thank you for using PHP.

出現這個,成功安裝php

 然後再

make  make install

出現這個

[PEAR] Console_Getopt - installed: 1.3.1
warning: pear/PEAR requires package "pear/Structures_Graph" (recommended version 1.0.4)
warning: pear/PEAR requires package "pear/XML_Util" (recommended version 1.2.1)
[PEAR] PEAR           - installed: 1.9.4
Wrote PEAR system config file at: /usr/local/php/etc/pear.conf
You may want to add: /usr/local/php/lib/php to your php.ini include_path
[PEAR] Structures_Graph- installed: 1.0.4
[PEAR] XML_Util       - installed: 1.2.1
/usr/local/php-5.3.28/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin
ln -s -f /usr/local/php/bin/phar.phar /usr/local/php/bin/phar
Installing PDO headers:          /usr/local/php/include/php/ext/pdo/

安裝成功了

 

 

 

---------------------------------------------------

最後 php連結php還是不成功。原因解決方案:

cp 一個php.ini 到 /usr/local/php/lib 【cp /usr/local/php-5.3.28/php.ini-production /usr/local/php/lib/php.ini 或者直接操作複製過去那個檔案 】

extension=mysql.so

php。ini裡面 去掉分號,加上面這個連結。重啟Apache即可

 

./configure --with-php-config=/usr/local/bin/php-config

ln -s /usr/lib64/mysql/libmysqlclient.a /usr/lib/libmysqlclient.a 
ln -s /usr/lib64/mysql/libmysqlclient_r.a /usr/lib/libmysqlclient_r.a
 )參考網站:http://www.cnblogs.com/wangtao_20/archive/2011/03/07/1973621.html --------------------------------------------------------具體的說,如下:是解決php與mysql串連的問題,步驟大致是:a、進入php目錄下ext下mysql下
b、/usr/local/php/bin/phpize
c、./configure --with-php-config=/usr/local/bin/php-config

tip:若configure不成功,則進行下列操作:

ln -s /usr/lib64/mysql/libmysqlclient.a /usr/lib/libmysqlclient.a 
ln -s /usr/lib64/mysql/libmysqlclient_r.a /usr/lib/libmysqlclient_r.a
 )

d、make
e、make install
f、配置mysql.so
相關文章

聯繫我們

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