分類  >  Web前端 >

lamp架構停的iwebmall(電子商城的搭建)

tags:    時間:2013-12-09 23:46:15
lamp架構下的iwebmall(電子商城的搭建)

apache

[root@localhost yum.repos.d]# yum install -y pcre-devel openssl*  gcc  gcc-c++      // 安裝apache所需要的包

[root@localhost httpd-2.2.23]# ./configure --enable-modules=all --enable-mods-shared=all --enable-authz-owner --enable-echo --enable-example --enable-logio --enable-expires --enable-headers --enable-unique-id --enable-ssl --enable-static-ab --enable-http --enable-vhost-alias --enable-so --enable-rewrite --with-pcre=/usr --with-ssl=/usr  --with-mpm=worker

[root@localhost conf]# vi httpd.conf

     o other locations.
    158 #
    159 DocumentRoot "/www"
    160 
    161 #

   185 #
    186 <Directory "/www">
    187     #

Include conf/extra/httpd-languages.conf

Include conf/extra/httpd-vhosts.conf


[root@localhost extra]# vi httpd-languages.conf

LanguagePriority zh-CN en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv tr zh-TW


[root@localhost extra]# vi httpd-vhosts.conf

<VirtualHost *:80>
    ServerAdmin test.test.com
    DocumentRoot "/www"
    ErrorLog "/var/log/httpd/apache_error.log"
    CustomLog "/var/log/httpd/apache_access.log" combined
</VirtualHost>

[root@localhost conf]# mkdir /www  /var/log/httpd

[root@localhost conf]# cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/apache

[root@localhost conf]# service apache start

[root@localhost htdocs]# mv /usr/local/apache2/htdocs/index.html /www

瀏覽器訪問127.0.0.1

如果看到  

It works!

表示apache成功了!

下面是mysql


[root@localhost mysql-5.6.10]# yum install ncurses-devel

如果你沒有安裝cmake

[root@localhost cmake-2.8.11.2]# tar xf cmake-2.8.11.2.tar.gz -C /usr/src/

[root@localhost cmake-2.8.11.2]# ./bootstrap

[root@localhost cmake-2.8.11.2]# make  && make install 

[root@localhost softs]# tar xf mysql-5.6.10.tar.gz -C /usr/src/

[root@localhost mysql-5.6.10]# cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/mysql -DMYSQL_DATADIR:PATH=/database -DWITH_DEBUG:BOOL=ON -DWITH_EXTRA_CHARSETS:STRING=ALL -DWITH_INNOBASE_STORAGE_ENGINE:BOOL=ON -DWITH_PARTITION_STORAGE_ENGINE:BOOL=ON

[root@localhost mysql-5.6.10]# make   -------這裡當時報了個錯,忘記是什麼錯誤了,反正我把/usr/src/mysql-5.6.10/strings/ ctype-ucs2.c中第49行和50行刪了就好了



[root@localhost mysql-5.6.10]# make install 


[root@localhost mysql-5.6.10]# cd /usr/local/mysql/

[root@localhost mysql]# groupadd mysql
[root@localhost mysql]# useradd -g mysql -s /sbin/nologin mysql

[root@localhost mysql]# mkdir /var/run/mysqld /var/log/mysqld /database

[root@localhost mysql]# chown mysql.mysql -R /database /var/log/mysqld /var/run/mysqld  /usr/local/mysql


[root@localhost mysql]# ./scripts/mysql_install_db --datadir=/database --user=mysql
Installing MySQL system tables...2013-10-11 16:55:47 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2013-10-11 16:55:47 b7f0cad0 InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!
2013-10-11 16:55:47 b7f0cad0 InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!
2013-10-11 16:55:47 13508 [Note] InnoDB: The InnoDB memory heap is disabled
………………………………………………………………
2013-10-11 16:55:49 13508 [Note] Binlog end
2013-10-11 16:55:49 13508 [Note] InnoDB: FTS optimize thread exiting.
2013-10-11 16:55:49 13508 [Note] InnoDB: Starting shutdown...
2013-10-11 16:55:50 13508 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK

Filling help tables...2013-10-11 16:55:50 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2013-10-11 16:55:50 b7f0cad0 InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!
…………………………
2013-10-11 16:55:52 13531 [Note] InnoDB: Starting shutdown...
2013-10-11 16:55:53 13531 [Note] InnoDB: Shutdown completed; log sequence number 1625987
OK

兩個OK表示初始化成功

[root@localhost mysql]# cp support-files/mysql.server  /etc/rc.d/init.d/mysql5

[root@localhost mysql]# vi /etc/init.d/mysql5

214 conf=/usr/local/mysql/etc/my.cnf

46 basedir=/usr/local/mysql
47 datadir=/database

[root@localhost mysql]# mkdir etc

[root@localhost etc]# pwd
/usr/local/mysql

[root@localhost mysql]# mv my.cnf etc/

[root@localhost mysql]# cd etc/

[root@localhost etc]# cat my.cnf | grep -v ^# | grep -v ^$
[mysqld]
 basedir = /usr/local/mysql
 datadir = /database
 port = 3306
 socket = /var/run/mysqld/mysql5.socket
 pid-file=/var/run/mysqld/mysql5.pid
 general-log
 general-log-file=/var/log/mysqld/mysql5-access.log
 log-error=/var/log/mysqld/mysql5-error.log
 user=mysql

[root@localhost etc]# service mysql5 start
Starting MySQL..                                           [確定]

[root@localhost etc]# yum install mysql 想要登錄mysql,客戶端還是要安裝的

[root@localhost etc]# cat /etc/my.cnf 

[client]
socket=/var/run/mysqld/mysql5.socket

[root@localhost etc]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.10-debug-log Source distribution


Type 'help;' or '\h' for help. Type '\c' to clear the buffer.


mysql> update mysql.user set password=password('123') where user='root';
Query OK, 4 rows affected (0.14 sec)
Rows matched: 4  Changed: 4  Warnings: 0


mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

安裝php

安裝php需要安裝幾個包,

[root@localhost php-5.3.27]# yum install -y zlib-devel curl-devel *snmp-devel*  iconv-devel 

[root@localhost php-5.3.27]# yum install libxml2-devel bzip2-devel


[root@localhost etc]# cd /softs/
[root@localhost softs]# ls
cmake-2.8.11.2.tar.gz  mysql-5.6.10.tar.gz
httpd--2.2.23.tar.gz   php-5.3.27.tar.bz2
[root@localhost softs]# tar xf php-5.3.27.tar.bz2 -C /usr/src/

[root@localhost softs]# cd /usr/src/php-5.3.27/

[root@localhost php-5.3.27]# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-libxml-dir=/usr --with-openssl-dir=/usr --with-zlib-dir=/usr --disable-ipv6 --with-zlib=/usr --with-bz2=/usr --with-curl=/usr --enable-ftp --with-mysql=/usr/local/mysql --with-mysql-sock=/var/run/mysqld/mysql5.socket 

--with-mysqli=/usr/local/mysql/bin/mysql_config

[root@localhost php-5.3.27]# make

[root@localhost php-5.3.27]# make install

[root@localhost modules]# ls /usr/local/apache2/modules/libphp5.so 
/usr/local/apache2/modules/libphp5.so

如果能找到這個模塊,說明安裝成功了,接下來就到了修改apache的配置文件了

  [root@localhost conf]# pwd
/usr/local/apache2/conf
[root@localhost conf]# vi httpd.conf  ---------------在第365 366行加上下面兩行

365     AddType application/x-httpd-php .php .phtml

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

重啟apache服務

[root@localhost ~]# service apache restart

[root@localhost www]# vi index.php

[root@localhost www]# cat index.php 
<?php
  phpinfo();
?>

[root@localhost www]# cp /usr/src/php-5.3.27/php.ini-production /usr/local/lib/php.ini
[root@localhost www]# vi /usr/local/lib/php.ini 

1229 mysql.default_socket =/var/run/mysqld/mysql5.socket

 1288 mysqli.default_socket =/var/run/mysqld/mysql5.socket

[root@localhost www]# service apache start

瀏覽器訪問http://127.0.0.1/index.php


截止目前,應該說整個lamp搭建差不多了,接下來我們可以安裝一個電子商務網站來測試一下

下載iwebmall v1.2.rar解壓到/www

[root@localhost www]# mv iwebmall\ v1.2/ iwebmall

瀏覽器訪問http://192.168.254.153/iwebmall/install/index.php開始安裝


在安裝的時候就發現問題了,gd模塊沒有安裝,難道我要重新編譯??呵呵,不需要的,php可以實現動態擴展,至於下面的allow_call_time_pass_reference 建議開啟,那我也可以不開啟了,但是防止出錯,我還是開啟了呵呵。

[root@localhost lib]# vi php.ini

allow_call_time_pass_reference = On

擴展gd模塊可以參考我的另一篇文章http://blog.csdn.net/avilifans/article/details/12576813LAMP中PHP功能 的動態擴展,就是介紹gd擴展的。

gd安裝好了之後,重啟apache,然後再次刷新頁面


然後就可以執行下一步了


問題很明顯,許可權不夠[root@localhost www]# chown -R daemon.daemon /www

再次刷新


接受授權協議,開始安裝


繼續




訪問頁面看一下








推薦閱讀文章

Bookmark the permalink ,來源:互聯網