centos6.3下搭建LAMP環境

系統:centos6.3_x64php

安裝包:html

httpd-2.2.19.tar.gzmysql

php-5.4.14.tar.bz2sql

libmcrypt-2.5.8.tar.gz數據庫

mcrypt-2.6.8.tar.gzapache

mhash-0.9.9.9.tar.gzvim


1.cd httpd-2.2.19centos

2../configure  --prefix=/usr/local/apache  --enable-vhost-alias  --enable-rewrite  --enable-info app

3.Makecurl

4.Make install

5.cp build/rpm/httpd.init /etc/init.d/httpd

6.chmod 755 /etc/init.d/httpd

7.chkconfig --add httpd

8.chkconfig --level 35 httpd on

9.cd /etc

10.ln -s /usr/local/apache/   httpd

11.cd /usr/sbin/

12.ln -fs/usr/local/apache/bin/httpd

13.ln -fs/usr/local/apache/bin/apachectl

14.cd /var/log

15.ln -s /usr/local/apache/logs   httpd

16./etc/init.d/httpd start

安裝php

yum install libxml2

yum install libxml2-devel –y

yum install libjpeg libpng freetype libjpeg-devel libpng-devel freetype-devel openssl-devel bzip2-devel libcurl-devel libxslt-devel

安裝Libmcrypt

#tar -zxvf libmcrypt-2.5.8.tar.gz

#cd libmcrypt-2.5.8

#./configure

#make

#make install 說明:libmcript默認安裝在/usr/local

安裝mhash

#tar -zxvf mhash-0.9.9.9.tar.gz

#cd mhash-0.9.9.9

#./configure

#make

#make install

安裝mcrypt

#tar -zxvf mcrypt-2.6.8.tar.gz

#cd mcrypt-2.6.8

#LD_LIBRARY_PATH=/usr/local/lib ./configure  //放在一塊兒執行

#make

#make install

1

./configure '--with-apxs2=/usr/local/apache/bin/apxs' '--prefix=/usr/local/php' '--with-iconv' '--with-mysql' '--with-mysqli' '--with-gd' '--with-zlib' '--with-jpeg-dir=/usr/lib64' '--with-png-dir' '--with-freetype-dir=/usr/lib64' '--with-curl=/usr/bin' '--with-openssl' '--with-openssl-dir=/usr'  '--with-xsl=/usr' '--with-xmlrpc' '--enable-exif' '--enable-cli' '--enable-calendar' '--with-mhash' '--enable-mbstring' '--enable-mbregex' '--enable-soap' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-zip' '--enable-ftp ''--with-pear' '--disable-debug' '--with-bz2' '--with-mcrypt' '--with-mhash'

說明:

--with-jpeg-dir 字段關聯libjpeg.so

--with-freetype-dir字段關聯libfreetype.so


2、make

3、make install

4、拷貝php配置文件

cp php-5.4.14/php.ini-production   /usr/local/php/lib/php.ini

修改php.ini時區

date.timezone = "Asia/Shanghai"

修改上傳文件大小

post_max_size = 10M
upload_max_filesize = 10M

啓用短標籤

short_open_tag = On

安裝Mysql

yum install mysql mysql-server php-mysql mysql-libs –y

建立用戶

 
 

grant all privileges on *.* to 'aixue'@'%' identified by '123456';

數據庫配置文件:

cp /usr/share/mysql/my-small.cnf/etc/my.conf

設置字符集

[client]

default-character-set=utf8

[mysqld]

default-character-set=UTF8

/etc/init.d/mysqld restart

而後導入數據 (要在設置字符集以後,負責要從新導入數據)

修改數據庫用戶名和密碼



配置Apache

cd /etc/httpd/conf

vim httpd.conf

添加內容

ServerName 127.0.0.1
NameVirtualHost *:80
include /etc/httpd/conf/vhost_*.conf
Addtype application/x-httpd-php  .php
Addtype application/x-httpd-php-source  .phps
AddType application/x-httpd-php .html
AddType application/x-httpd-php  .htm

建立配置文件

vim vhost_5aixue.com.conf

內容爲:

<VirtualHost *:80>
ServerName test1.5aixue.com
ServerAlias test1.5aixue.com
DocumentRoot /home/aixue/public_html
ErrorLog /var/log/test.5aixue.com_error_log
CustomLog /var/log/test.5aixue.com_access_log combined
DirectoryIndex index.php index.html index.htm index.php4 index.php5
<Directory /home/aixue/public_html>
Options -Indexes +IncludesNOEXEC +FollowSymLinks
allow from all
AllowOverride All
</Directory>
</VirtualHost>



將aixue包解壓到/home下,

cd /home/aixue/public_html/system/config

vim config.php

修改兩項內容:

WEBROOT','/home/aixue/public_html/
LOCAL_IP','192.168.10.103

vim db_config.php

相關文章
相關標籤/搜索