symfony xampp 安装(一)

php集成工具xampp;

一、pear安装symfony

pear添加环境变量;

  1. Set right include path and to make sure that all pear packages will be installed in the right locations.
    1. Goto System Properties into the Advanced tab.
    2. Click on Environment Variables
    3. Extend the path variable by adding your path to php, mysql and pear:
      In my case, as I installed XAMPP to e:\xampp, it was like adding 
      ;e:\xampp\php\PEAR\symfony;e:\xampp\mysql\bin;e:\xampp\php;e:\xampp\php\PEAR
  2. Open a command line (Start menu, Start Application, Run "cmd"
  3. Enter your XAMPP directory:
    e:
    cd xampp
    (This can be different for you!)
  4. Upgrade pear:
    pear upgrade pear
  5. Install phing:
    pear install -a http://phing.info/pear/phing-current.tgz --alldeps
  6. Install symfony:
    1. pear channel-discover pear.symfony-project.com
    2. pear install symfony/symfony

    查看版本:

  7. symfony  -V


在创建项目之前,首先需要搭建symfony发开环境。

二、创建应用

win7 64;xampp安装路径是e:\xampp\htdocs

1. 创建工作目录,生成项目文件

>md cms

>cd cms

>symfony generate:project cms

>symfony generate:app frontend

>symfony generate:app backend

2. Apache下配置项目(新建虚拟主机)

<VirtualHost *:1300>

DocumentRoot "e:\xampp\htdocs\cms\web"

DirectoryIndex index.php

<Directory "e:\xampp\htdocs\cms\web">

AllowOverride All

Allow from All

</Directory>



Alias /sf e:\xampp\htdocs\data\symfony\web\sf

<Directory "e:\xampp\htdocs\data\symfony\web\sf">

AllowOverride All

Allow from All

</Directory>

</VirtualHost>

注意:


以上配置需要添加在httpd-vhosts.conf文件中,并在httpd.conf中打开对相应端口的监听。

直接使用localhost ;或使用新域名C:\Windows\System32\drivers\etc过修改hosts文件添加相应的域名解析 :127.0.0.1 cms


重启Apache后,通过访问http://cms:1300/ 可以看到symfony工程欢迎页面。

从这里开始,我们可以选择一个顺手的IDE打开工程,以便更好的发开项目。

3. 配置并创建数据库

打开工程下config中的databases.yml文件,修改数据库连接的参数。

# You can find more information about this file on the symfony website:
# http://www.symfony-project.org/reference/1_4/en/07-Databases

all:
  doctrine:
    class: sfDoctrineDatabase
    param:
      dsn:      mysql:host=localhost;dbname=cms
      username: admin
      password: admin

定义schema ( cms/config/doctrine/schema.yml )


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值