Magento初探

magento是一款专业开源的电子网站系统.我在09年6月份初次接触,14年12月份再次用到,于是更新了一下之前的笔记,发到博客跟大家分享.


Intro

Magento官方网站

Magento维基介绍

 

参考资源

1Magento Designers Guide

2Magento Forum(Chinese)

3专注magento开发的技术博客inchoo

4、《Magento: Beginner's Guide

5、《Inchoo's Magento Posts

6Magento User Guide

7Magento中文项目组


GetStarted

Installing Magento

step1下载magento并解压

下载社区版FullRelease压缩包.例如当前我下的最新版本magento-1.9.1.0.zip.

 

step2安装环境

httpserver:apache http server

配置支持php

数据库:mysql

数据库管理工具:phpmysqlAdmin

具体安装步骤见安装配置

 

step3安装magento

mysql创建数据库magento

magento上传至web server并访问,进入magento的安装向导

 

Using Magento

假设192.168.1.66:2906是你假设的服务器所在地址.

Frontend

http://192.168.1.66:2906/magento/index.php/

 

Backend

http://192.168.1.66:2906/magento/index.php/admin/

 

注意:本地使用127.0.0.1取代localhost,否则登录不上去(安全设置)

 

Configuring Magento

汉化magento,详情见Magento汉化


安装配置

@@   作者:天涯

 

@@   时间:07-09-10

 

@@   目的:供女友参考学习用

 

@@   注意:安装的版本,和解压的路径

 

 

 

 

一. windows  使用配置总结(此教程的讲解一定要注意版本,不同的版本一下会告诉有不同的配置)路径也要十分注意

 

 

1)apache的安装详解:安装路径为(D:\tianya\www\Apache)      注意:安装路径中尽量不要有空格和中文。

 

    1.

下载http://apache.mirror.phpchina.com/httpd/binaries/win32/

       下载apache_2.2.4-win32-x86-openssl-0.9.8d.msi 进行安装

    2. 

注意默认端口是80

安装成功后启动apache访问http://localhost

    3.

apache的配置文件\conf\httpd.conf

        apache的默认的项目存放目录\htdocs\

 

2)apache的一些常用配置(http.conf)        

 

    1。

关键字“DocumentRoot”(也就是网站根目录).注意:“\”在Apache里要改成“/”

注:sld 2009-7-11新版没有这个问题,确认有没有这个问题,可以直接访问http://localhost 如果显示It works,则没有这个问题

 

    2。

DirectoryIndex(目录索引,也就是在仅指定目录的情况下,默认显示的文件名)可以添加很多,系统会根据从左至右的顺序来优先显示,

以单个半角空格隔开。例如:

    (

<IfModuledir_module>

   DirectoryIndex index.php index.html //index.htm. . . , 其它默认的文件名

</IfModule>

      )   

 

2)php的安装、以module方式,将php与apache结合使你的网站服务器支持php服务器脚本程序

 

     1.  下载php5.zip解压

    

     2. 

php5目录下的文件php.ini-recommended改名为php.ini并作如下改动:(php.ini这个文件可以放在C:\WINDOWS下面,也可以不用放在系统下面)

 

    (1)找到user_dir=。它是服务器的根目录,改为:

 user_dir = "C:\Program Files\ApacheSoftware Foundation\Apache2.2\htdocs"                        ##指定php项目所放路径

 doc_root = "C:\Program Files\ApacheSoftware Foundation\Apache2.2\htdocs" 

    (2)找到extension_dir=./改为:

extension_dir =C:\Program Files\PHP\ext                                                                                              ##指定一些其它的模块的dll存放路径

 

 

     3.

 

对httpd.conf进行配置添加如下内容:

#对 PHP 5 用这两行:

LoadModulephp5_module "D:/tianya/www/php/php5apache2_2.dll"     ##这点值得注意一点,(这是php5+apache2.2以上的版本的配制方法)

##LoadModulephp5_module "D:/tianya/www/php/php5apache2.dll"     ##这点值得注意一点,(这是php5+apache2.0以上的版本的配制方法)

##LoadModulephp5_module "D:/tianya/www/php/php5apache.dll"      ##这点值得注意一点,(这是php5+apache1.3以上的版本的配制方法)

AddType application/x-httpd-php .php                                          ##则.php文件也可以执行php程序了

AddTypeapplication/x-httpd-php .html                           ##则.htm文件也可以执行php程序了(自已多试一下就会明白这个扩展名的含义)

PHPIniDir"D:/tianya/www/php/"                                  ##是指明php的配置文件php.ini的位置

 

或者拷贝以下到httpd.conf

#BEGINPHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL

ScriptAlias/php/ "D:/PHP5/"

PHPIniDir"E:/php5/"

AddTypeapplication/x-httpd-php .php

AddTypeapplication/x-httpd-php .html

Actionapplication/x-httpd-php "D:/PHP5/php-cgi.exe"

LoadModulephp5_module D:/PHP5/php5apache2_2.dll

 

#ENDPHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL

   以上完成了php+apache的配置此时,apahce已经支持php解析了,可以重起apache服务器放一个简单的脚本试一下。

 

3)配置php可以用mysql作为连接数据库

 

    1。

更改php.ini文件

把“;extension=php_mysql.dll”前的“;”去掉,加载mysql模块

extension=php_mysqli.dll

 

    2。 

到此地步php现在就可以作为变成来用就配置完成了。此时就可以连接mysql数据库。

 

 

 

4) php+mysqlAdmin+apache的配置实现phpmysqlAdmin的功能        (注意和第3步的区别)此时只是作为使用mysql的一种工具

 

 

    1。

下载

http://sourceforge.net/project/downloading.php?group_id=23067&use_mirror=jaist&filename=phpMyAdmin-2.11.0-all-languages.zip&52587229

下载phpMyAdmin-2.11.0-all-languages.zip

 

     2.

 将其解压到如下目录

 D:\tianya\www\Apache\htdocs\phpMyAdmin

    

     3。

然后配置D:\tianya\www\Apache\htdocs\phpMyAdmin\config.sample.inc.php此文件

 

将其重命名为config.inc.php

然后找到$cfg['blowfish_secret']= '';填入数据库的密码将其变为$cfg['blowfish_secret'] = 'tianya';

然后保存,其他的都不用动。重起apache

 

访问http://127.0.0.1/phpMyAdmin/index.php然后选折简体中文,填入用户名密码就能登陆成功了

 

  

     4。值得注意的地方:

 

要确保

更改php.ini文件

把“;extension=php_mysql.dll”前的“;”去掉,加载mysql模块

 

 

 

 

 

总结:      

以上就能使apache支持php并且有phpMyadmin的功能。如果上面有不懂得专业术语,查或者看随带的一个doc文档,随带的那些只供参考,他们有很多说的都不对。

 

在安装和配置的时候要多多用心会发现不少东西的。例如:http://127.0.0.1能访问apache,但http://www.tianya.org.net也能访问apache,因为www.tianya.org.net是你在安装的时候选择的域名。(这是一种虚拟域名的配置方法)。

 

----------------以上是我根据国际网站http://www.php.net/manual/zh/index.php加上自己的实践总结得出的以上结论----------------------

--------------------技术支持:天涯---------------------------------------------------

--------------------要依上面我写的为标准要不将会走很多弯路的。-----------------------------------------

 

 

集成方案

XAMPP及WAMP

http://www.magentoo.com/node/29


常见问题一览

1、运行mysql测试文件testdb

错误提示Call  to undefined  function  'mysql_connect()'… 失败

 

问题原因:PHP+MYSQL环境没配置好, php5 的默认 mysql 是关闭的

解决方案:将php_mysql.dll和libmysql.dll文件拷贝至C:\Windows\System32中(我漏了libmysql.dll)

找到php.ini中的;extension=php_mysql,去掉前面的";" 重启服务器

源文档 <http://tech.ddvip.com/2007-08/118788865032825.html>

 

2、安装magento需要php扩展

window下安装php_curl支持

a.找到php.ini.修改extension=php_curl.dll把前面的分号去掉。

b.libeay32.dllssleay32.dll 复制到 %windir%/system32下。

重启php的服务

无法载入 mcrypt 扩展

a、在php.ini配置中,将php_mcrypt.dll前的;去掉。

b、从php5中复制libmcrypt.dll到dlls目录和system32目录下。[dlls目录不用也可]

重启php的服务

 

 

3Magento Install Problem+ Solution sales_flat_quote already exists

Tuesday, March 10th,2009

Trying to do a cleaninstall of Magento 1.2.1.2 I kept hitting this SQL error.

Base table or view already exists: 1050 Table'sales_flat_quote' already exists

In the end I opted tomanually edit the related install file and add DELETE IF EXISTS statementsbefore each CREATE TABLE statement.

The file in questionis located here:

/app/code/core/Mage/Sales/sql/sales_setup

and the problem fileis

mysql4-install-0.9.0.php

The solution is toedit the file and add DROP TABLE IF EXISTS statements before each CREATE TABLEstatement

eg

PLAIN TEXT

PHP:

  1. DROP TABLE IF EXISTS  `{$installer->getTable('sales_flat_quote')}`;
  1.  
  1. CREATE TABLE `{$installer->getTable('sales_flat_quote')}`(.....

I have created anissue on their bug trackerhere.

 

源文档 <http://www.edmondscommerce.co.uk/blog/category/magento/>

 

原因:在magento使用之前需要先安装数据库

 

4数据库不存在

原因:MySQLAdminimport数据库量过于巨大,timeout导致部分数据库没有载入。

解决方案:使用EMS sqlmanager for mysql的管理工具

or

php默认执行时间30s,timeout之后放弃数据库导入导致数据库导入失败,php配置文件中设置

max_execution_time =300

 

5 php模块配置不完全

需要curlgd扩展

php配置文件

extension=php_curl.dll

extension=php_gd2.dll

extension=php_pdo_mysql.dll


Magento汉化

1,汉化包下载

http://code.google.com/p/magento-cn/downloads/list @deprecated 最新版本1.2.1.2

http://www.magentocommerce.com/boards/viewthread/777/需要自己编辑

 

2,解压后copy得到 app文件夹,在汉化包app文件夹查找到zh_ch文件夹。有三个zh_ch文件夹,分别把它们copy到相应的目录下。

 

3.后台登录操作

A,System ->Manage Stores -> Create Store,创建店铺

B, Configuration > general

语言选择中文(中国)

Saveconfig 


Top 3mistakes by Magento beginners

First ofall, let me inform you that this article is for those of you who are juststarting with Magento. If you are a Magento expert, you will probably knowthis.  Consider it just a reminder for those who use Magento for firsttime. There are three common mistakes that most people do when they try to useMagento for first time, so read this article and you won’t be one of them.:)

  1. First mistake is downloading Magento’s full release and trying to upload it using ftp. Much easier solution is usingMagento downloader method and you won’t lose upgrade capability.
  1. More experienced PHP developers will first readMagento Designers Guide before they try to style Magento, but others won’t and that’s the mistake number two.Since Magento has great theme fallback system there is really no need to touch default theme. Although easiest way to make new theme for new Magento is top copy the whole theme to a new folder, don’t do that. Copy only the files you will need: from /design/frontend/default/default/ directory to /design/frontend/default/YOUR_NEW_THEME directory. Do the same thing with /skin/frontend/default/default/ Congratulations, you have your own theme just like that. All that left is to apply new theme (System->Configuration->Design) and you are ready to do with your theme files whatever you want.
  1. Third mistake is modifying Magento core files. What files are core ones? All what is in app/code/core folder. If you have a need to modify some of those ones, you just need to duplicate that file in the same directory path to app/code/local. For example, if you need to modify the file
    app/code/core/Mage/Checkout/Block/Success.php
    copy it to
    app/code/local/Mage/Checkout/Block/Success.php
    and leave the core file intact. This way your Magento will be more bullet-proof to future updates.

I hopethis article can help all new Magento developers.

 

源文档<http://inchoo.net/ecommerce/magento/top-3-mistakes-by-magento-beginners/




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章