Home Backend Development PHP Tutorial Detailed tutorial on symfony installation

Detailed tutorial on symfony installation

Aug 09, 2017 pm 02:20 PM
symfony Install Tutorial

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.coDetailed tutorial on symfony installationm/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

1

php lib\vendor\symfony\data\bin\symfony generate-project blog

Copy after login

This command creates the following directory structure:


The description of each directory is as follows:

DirectoryDescription
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)
4、目前这个项目还没法使用,因为我们至少需要创建一个应用程序,在当前目录在创建一个前台(frontend)应用程序

1

php symfony init-app frontend

Copy after login
这个命令在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即可。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

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>

Copy after login


注:如上写法只针对windows。注意将以上目录转换成你的开发环境的对应目录。

现在打开浏览器,访问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!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1655
14
PHP Tutorial
1252
29
C# Tutorial
1226
24
Tutorial on how to use Dewu Tutorial on how to use Dewu Mar 21, 2024 pm 01:40 PM

Dewu APP is currently a very popular brand shopping software, but most users do not know how to use the functions in Dewu APP. The most detailed usage tutorial guide is compiled below. Next is the Dewuduo that the editor brings to users. A summary of function usage tutorials. Interested users can come and take a look! Tutorial on how to use Dewu [2024-03-20] How to use Dewu installment purchase [2024-03-20] How to obtain Dewu coupons [2024-03-20] How to find Dewu manual customer service [2024-03-20] How to check the pickup code of Dewu [2024-03-20] Where to find Dewu purchase [2024-03-20] How to open Dewu VIP [2024-03-20] How to apply for return or exchange of Dewu

How to install Android apps on Linux? How to install Android apps on Linux? Mar 19, 2024 am 11:15 AM

Installing Android applications on Linux has always been a concern for many users. Especially for Linux users who like to use Android applications, it is very important to master how to install Android applications on Linux systems. Although running Android applications directly on Linux is not as simple as on the Android platform, by using emulators or third-party tools, we can still happily enjoy Android applications on Linux. The following will introduce how to install Android applications on Linux systems.

In summer, you must try shooting a rainbow In summer, you must try shooting a rainbow Jul 21, 2024 pm 05:16 PM

After rain in summer, you can often see a beautiful and magical special weather scene - rainbow. This is also a rare scene that can be encountered in photography, and it is very photogenic. There are several conditions for a rainbow to appear: first, there are enough water droplets in the air, and second, the sun shines at a low angle. Therefore, it is easiest to see a rainbow in the afternoon after the rain has cleared up. However, the formation of a rainbow is greatly affected by weather, light and other conditions, so it generally only lasts for a short period of time, and the best viewing and shooting time is even shorter. So when you encounter a rainbow, how can you properly record it and photograph it with quality? 1. Look for rainbows. In addition to the conditions mentioned above, rainbows usually appear in the direction of sunlight, that is, if the sun shines from west to east, rainbows are more likely to appear in the east.

How to install Podman on Ubuntu 24.04 How to install Podman on Ubuntu 24.04 Mar 22, 2024 am 11:26 AM

If you have used Docker, you must understand daemons, containers, and their functions. A daemon is a service that runs in the background when a container is already in use in any system. Podman is a free management tool for managing and creating containers without relying on any daemon such as Docker. Therefore, it has advantages in managing containers without the need for long-term backend services. Additionally, Podman does not require root-level permissions to be used. This guide discusses in detail how to install Podman on Ubuntu24. To update the system, we first need to update the system and open the Terminal shell of Ubuntu24. During both installation and upgrade processes, we need to use the command line. a simple

What software is photoshopcs5? -photoshopcs5 usage tutorial What software is photoshopcs5? -photoshopcs5 usage tutorial Mar 19, 2024 am 09:04 AM

PhotoshopCS is the abbreviation of Photoshop Creative Suite. It is a software produced by Adobe and is widely used in graphic design and image processing. As a novice learning PS, let me explain to you today what software photoshopcs5 is and how to use photoshopcs5. 1. What software is photoshop cs5? Adobe Photoshop CS5 Extended is ideal for professionals in film, video and multimedia fields, graphic and web designers who use 3D and animation, and professionals in engineering and scientific fields. Render a 3D image and merge it into a 2D composite image. Edit videos easily

Detailed steps to install Go language on Win7 computer Detailed steps to install Go language on Win7 computer Mar 27, 2024 pm 02:00 PM

Detailed steps to install Go language on Win7 computer Go (also known as Golang) is an open source programming language developed by Google. It is simple, efficient and has excellent concurrency performance. It is suitable for the development of cloud services, network applications and back-end systems. . Installing the Go language on a Win7 computer allows you to quickly get started with the language and start writing Go programs. The following will introduce in detail the steps to install the Go language on a Win7 computer, and attach specific code examples. Step 1: Download the Go language installation package and visit the Go official website

How to Install and Run the Ubuntu Notes App on Ubuntu 24.04 How to Install and Run the Ubuntu Notes App on Ubuntu 24.04 Mar 22, 2024 pm 04:40 PM

While studying in high school, some students take very clear and accurate notes, taking more notes than others in the same class. For some, note-taking is a hobby, while for others, it is a necessity when they easily forget small information about anything important. Microsoft's NTFS application is particularly useful for students who wish to save important notes beyond regular lectures. In this article, we will describe the installation of Ubuntu applications on Ubuntu24. Updating the Ubuntu System Before installing the Ubuntu installer, on Ubuntu24 we need to ensure that the newly configured system has been updated. We can use the most famous &quot;a&quot; in Ubuntu system

How to install Go language under Win7 system? How to install Go language under Win7 system? Mar 27, 2024 pm 01:42 PM

Installing Go language under Win7 system is a relatively simple operation. Just follow the following steps to successfully install it. The following will introduce in detail how to install Go language under Win7 system. Step 1: Download the Go language installation package. First, open the Go language official website (https://golang.org/) and enter the download page. On the download page, select the installation package version compatible with Win7 system to download. Click the Download button and wait for the installation package to download. Step 2: Install Go language

See all articles