To learn symfony, you must first learn how to install symfony. This article talks about how to install the symfony framework under Windows. The installation under Linux is similar.
1. First download symfony from this address: http://symfony.com/legacy, this series of tutorials uses version 1.2 of symfony.
2. Create a project directory under the root directory of your website, such as bolg, then create a lib directory in this directory, create a vendor directory under the lib directory, and unzip the downloaded symfony compressed package. Go to the vendor directory.
3. Open the command line tool, enter the blog directory, enter the following command to create a symfony project
php lib\vendor\symfony\data\bin\symfony generate-project blog
This command creates the following directory structure:
The description of each directory is as follows:
Directory | Description |
---|---|
apps/ | Store all applications of the project |
cache/ | The cache file of the framework |
config/ | Project configuration file |
lib/ | Classes and libraries used in the project |
log/ | Project log file |
plugins/ | Installed plug-ins |
test/ | Unit test and functional test files |
web/ | Website root directory (see below) |
php symfony init-app frontend这个命令在apps目录下生成了如下目录:
另外还在web目录下生成了如下文件:index.php和frontend_dev.php
其中index.php是生产环境的入口文件,frontend_dev.php是测试的入口文件,通过frontend_dev.php访问程序,会在页面上展示一个调试栏,方便我们调试程序。至于为什么index.php不叫frontend.php,那是因为symfony在创建第一个应用程序的时候默认使用index.php作为生产环境入口文件。
5、设置虚拟主机
如果你使用的是apache作为服务器,将如下代码加入到apache的配置文件,再重启apache即可。
Listen 127.0.0.1:8080 <VirtualHost 127.0.0.1:8080> DocumentRoot "H:/wamp/www/blog/web" DirectoryIndex index.php <Directory "H:/wamp/www/blog/web"> AllowOverride All Allow from All </Directory> Alias /sf H:/wamp/www/symfony/data/web/sf <Directory "H:/wamp/www/symfony/data/web/sf"> AllowOverride All Allow from All </Directory> </VirtualHost>
现在打开浏览器,访问http://localhost:8080,可以看到如下页面:
访问http://localhost:8080/frontend_dev.php:
有一些报错信息,是由于php版本原因的报错,暂时不作处理。可以看到测试控制器的右上角多了个调试框。
今天就讲到这里,下一篇将结束symfony的页面创建知识。
The above is the detailed content of Detailed tutorial on symfony installation. For more information, please follow other related articles on the PHP Chinese website!

Symfony是一种基于PHP语言的高性能、可重复使用的web应用程序框架。它用于构建高质量的web应用程序和服务,并提供多种功能和工具来简化开发过程。Symfony的目标是使Web开发变得更加可用、可重复使用和高效,并且是一个开源框架,它遵循最佳的软件工程实践。对于PHP开发者来说,Symfony框架是一个非常好的选择,因为它提供了丰富而强大的灵活性,可以

Symfony框架是一款流行的PHP框架,它的优势很多,本文将对于Symfony框架的优势进行探讨。高度的灵活性Symfony框架非常灵活,可以满足各种各样的需求。通过使用它的不同组件,你可以使用你自己的代码来构建自己的块,而无需使用强制性的体系结构。这使得Symfony框架成为开发出高度复杂的应用程序的理想选择。强大的安全性Symfony框架是一个非常安全

随着信息技术的快速发展,企业管理系统越来越普及。其中,客户关系管理系统(CRM)是一种非常流行的企业管理系统。当今企业面临的最大挑战之一是如何有效地管理客户关系。开发一个高效的CRM系统就成了一个发展企业的核心任务。本文将介绍如何使用PHP框架Symfony,结合其丰富的功能和文档资料,来开发一款高效的CRM系统。一、了解Symfony框架Symfony是一

使用Symfony框架实现用户权限管理的步骤Symfony框架是一个功能强大的PHP开发框架,使用它可以快速开发出高质量的Web应用程序。在开发Web应用程序时,用户权限管理是一个不可忽视的重要部分。本文将介绍使用Symfony框架实现用户权限管理的步骤,并附带代码示例。第一步:安装Symfony框架首先,我们需要在本地环境中安装Symfony框架。可以通过

随着社交媒体应用的不断增长,越来越多的开发人员开始关注哪个框架最适合用来构建这样的应用。Symfony和Phalcon是两个非常受欢迎的PHP框架,它们都有着成熟的社区和强大的开发工具。但是如果你需要开发大规模的社交媒体应用程序,那么哪个框架更适合呢?Symfony是一个成熟的PHP框架,它提供了丰富的功能和工具,可以帮助你快速构建大型应用程序。Symfon

Symfony框架中间件:提供错误处理和异常管理功能当我们在开发应用程序时,经常会遇到错误和异常的情况。为了优化用户体验和提供更好的开发者工具,Symfony框架提供了强大的错误处理和异常管理功能。在本文中,我们将介绍Symfony框架中间件的使用和示例代码。Symfony框架中的错误处理和异常管理功能主要通过中间件来实现。中间件是一个特殊的功能组件,用于在

使用Symfony框架实现文件上传和下载的步骤在现代的Web应用程序中,文件上传和下载是一项常见的功能需求。Symfony框架为我们提供了一种简单而强大的方式来实现文件上传和下载功能。本文将介绍如何使用Symfony框架来实现文件上传和下载功能,并提供相应的代码示例。步骤一:安装Symfony框架首先,我们需要在本地环境中安装Symfony框架。可以通过Co

Symfony框架中的表单组件是一种非常有用的工具,可以帮助我们轻松地创建和验证表单,并与数据库进行交互。在本文中,我们将介绍如何在Symfony框架中使用表单组件。一、安装Symfony框架在开始之前,我们需要确保Symfony框架已经安装好并配置好依赖项。如果您尚未安装Symfony,可以通过以下命令在终端中安装:$curl-sShttps://g


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download
The most popular open source editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Dreamweaver CS6
Visual web development tools
