整理Apache+Mysql+PHP+PHPWind(Apache+PHP集成環境)
一、情況簡述:
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
設置MySQL的root密碼
[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、集成apache和php
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
http://xxxxxx/Linuxjc/1154414.html TechArticle