Linux-Apache+Mysql+PHP+PHPWind(重點Apache+PHPIntegration Environment),apachemysqlphp整合

來源:互聯網
上載者:User

Linux-Apache+Mysql+PHP+PHPWind(重點Apache+PHPIntegration Environment),apachemysqlphp整合

整理Apache+Mysql+PHP+PHPWind(Apache+PHPIntegration Environment)

一、情況簡述:

1、虛擬機器VM上面CentOS

2、全部yum安裝(yum安裝與源碼安裝的安裝路徑不同)

二、操作步驟簡述

安裝Apache(httpd)

安裝Mysql(mysqld)

安裝PHP(phpd-fdm)

整合Apache+PHP

安裝PHPWind

三、操作步驟詳解

1、安裝Apache(httpd)

yum install httpd httpd-devel httpd-manual httpd-tool

其實就是httpd*

然後安裝apache擴充

[root@localhost Packages]# yum install mod_ssl*

如果有,就不用再安裝了

[root@localhost Packages]# ll mod_ssl*

-r--r--r--. 2 root root 92248 Feb 23  2013 mod_ssl-2.2.15-26.el6.centos.x86_64.rpm

使Apache可以自動啟動

[root@localhost Packages]# chkconfig --levels 235 httpd on

啟動Apache

[root@localhost Packages]# service httpd status

httpd is stopped

[root@localhost Packages]# service httpd start

Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName

                                                           [  OK  ]

[root@localhost Packages]#

訪問成功Apache:http://192.168.137.158/

Apache連接埠80

[root@localhost Packages]# netstat -anp | grep httpd

tcp        0      0 :::80                       :::*                        LISTEN      2957/httpd     

Apache安裝路徑:

如果採用RPM包安裝,安裝路徑應在 /etc/httpd目錄下

apache設定檔:/etc/httpd/conf/httpd.conf

其他配置儲存在 /etc/httpd/conf.d/ 目錄

Apache模組路徑:/usr/sbin/apachectl

web目錄:/var/www/html

如果採用原始碼安裝,一般預設安裝在/usr/local/apache2目錄下

2、安裝Mysql

yum install mysql安裝用戶端

yum install mysql-server安裝服務端

使mysql自動啟動

[root@localhost Packages]# chkconfig --levels 235 mysqld on

啟動服務

[root@localhost Packages]# service mysqld status

mysqld is stopped

[root@localhost Packages]# service mysqld start

Starting mysqld:                                           [  OK  ]

mysql連接埠3306

[root@localhost Packages]# netstat -anp | grep mysqld

tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      3424/mysqld        

unix  2      [ ACC ]     STREAM     LISTENING     28729  3424/mysqld         /var/lib/mysql/mysql.sock

設定MySQLroot密碼

[root@localhost bin]# /usr/bin/mysqladmin -u root password '123456'

訪問mysql

[root@localhost bin]# mysql -uroot -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 4

Server version: 5.1.73 Source distribution

 

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

 

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 

mysql>

 表示mysql成功,並可對資料庫進行增刪改查

mysql安裝路徑:

如果採用RPM包安裝,安裝路徑應在/usr/share/mysql目錄下

mysqldump檔案位置:/usr/bin/mysqldump

mysqli設定檔:

/etc/my.cnf或/usr/share/mysql/my.cnf

mysql資料目錄在/var/lib/mysql目錄下

如果採用原始碼安裝,一般預設安裝在/usr/local/mysql目錄下

 

3、安裝php

yum install *php*

[root@localhost Packages]# rpm -qa | grep autoconf

autoconf-2.63-5.1.el6.noarch

啟動服務

[root@localhost bin]# service php status

php: unrecognized service

[root@localhost bin]# cd /etc/init.d

[root@localhost init.d]# ll *php*

-rwxr-xr-x. 1 root root 2060 Aug 11 13:36 php-fpm

[root@localhost init.d]# service php-fpm status

php-fpm is stopped

[root@localhost init.d]# service php-fpm start

Starting php-fpm:                                          [  OK  ]

[root@localhost init.d]#

php服務連接埠9000

[root@localhost init.d]# netstat -anp | grep php-fpm

tcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      3554/php-fpm       

unix  3      [ ]         STREAM     CONNECTED     30963  3554/php-fpm       

unix  3      [ ]         STREAM     CONNECTED     30962  3554/php-fpm        

訪問php

測試php:

在/var/www/html下

[root@localhost html]# vim info.php

內容:

<?php

 phpinfo();

 ?>

訪問頁面:

http://192.168.137.158/info.php

4、整合apachephp

apache(httpd)設定檔

[root@localhost conf.d]# find / -name httpd.conf

/etc/httpd/conf/httpd.conf

修改上面設定檔:

修改1:在LoadModule處添加

LoadModule php5_module modules/libphp5.so

修改2:在

#

# First, we configure the "default" to be a very restrictive set of

# features. 

 

 

###############################################

#<Directory />

#   Options FollowSymLinks

#    AllowOverride None

#</Directory>

#############################################

 

下面添加:

<Directory />

    Options FollowSymLinks

    AllowOverride None

    Order deny,allow

    Deny from all

    Allow from all

</Directory>

修改3:在AddType處添加

AddType application/x-httpd-php .php .php5

AddType application/x-httpd-php-source .phps

修改4:在AddHandler處,添加

AddHandler php5-script php

修改5:在IfModule dir_module,添加#中內容。

# DirectoryIndex: sets the file that Apache will serve if a directory

# is requested.

###################################################

 

<IfModule dir_module>

    DirectoryIndex  index.php  index.html

</IfModule>

#####################################################

# The index.html.var file (a type-map) is used to deliver content-

# negotiated documents.  The MultiViews Option can be used for the

# same purpose, but it is much slower.

#

DirectoryIndex index.html index.html.var

修改完成後,重啟apache服務

              

php安裝路徑:

如果採用RPM包安裝,安裝路徑應在 /etc/目錄下

php的設定檔:/etc/php.ini

如果採用原始碼安裝,一般預設安裝在/usr/local/lib目錄下

php設定檔: /usr/local/lib/php.ini

或/usr/local/php/etc/php.ini

5、安裝phpwind

phpwind官網下載Linux版本

解壓unzip

把解壓後的upload複製到/var/www/html/下,並

[root@localhost html]#  chmod -R 777 upload/

然後訪問頁面:

http://192.168.137.158:80/upload/install.php或

http://192.168.137.158/upload/install.php

預設密碼admin/admin

出現您已經安裝過,需要重新安裝請先刪除data/install.lock檔案

[root@localhost data]# pwd

/var/www/html/upload/data

 

聯繫我們

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