php - 安装 Symfony2

标签 php symfony

我决定学习 symfony,所以我尝试安装它。像网站上说的那样获取composer后,我执行了以下命令来创建一个项目并获取symfony2

composer create-project symfony/framework-standard-edition Website/test

不幸的是我收到了一条消息:

>    Installing symfony/framework-standard-edition (v2.7.1)
      - Installing symfony/framework-standard-edition (v2.7.1)
        Downloading: 100%    

---


>    Created project in Website/test
    Loading composer repositories with package information
    Installing dependencies (including require-dev) from lock file
    Your requirements could not be resolved to an installable set of packages.

**Problem 1**


- Installation request for sensiolabs/security-checker v2.0.5 -> satisfiable by sensiolabs/security-checker[v2.0.5].

- sensiolabs/security-checker v2.0.5 requires ext-curl * -> the requested PHP extension curl is missing from your system.

**Problem 2**

- sensiolabs/security-checker v2.0.5 requires ext-curl * -> the requested PHP extension curl is missing from your system.

- sensio/distribution-bundle v4.0.0 requires sensiolabs/security-checker ~2.0 -> satisfiable by sensiolabs/security-checker[v2.0.5].

- Installation request for sensio/distribution-bundle v4.0.0 -> satisfiable by sensio/distribution-bundle[v4.0.0].

The composer.json file :

{
    "name": "symfony/framework-standard-edition",
    "license": "MIT",
    "type": "project",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-4": { "": "src/", "SymfonyStandard\\": "app/SymfonyStandard/" }
    },
    "require": {
        "php": ">=5.3.9",
        "symfony/symfony": "2.7.*",
        "doctrine/orm": "~2.2,>=2.2.3,<2.5",
        "doctrine/dbal": "<2.5",
        "doctrine/doctrine-bundle": "~1.4",
        "symfony/assetic-bundle": "~2.3",
        "symfony/swiftmailer-bundle": "~2.3",
        "symfony/monolog-bundle": "~2.4",
        "sensio/distribution-bundle": "~4.0",
        "sensio/framework-extra-bundle": "~3.0,>=3.0.2",
        "incenteev/composer-parameter-handler": "~2.0"
    },
    "require-dev": {
        "sensio/generator-bundle": "~2.3"
    },
    "scripts": {
        "post-root-package-install": [
            "SymfonyStandard\\Composer::hookRootPackageInstall"
        ],
        "post-install-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
        ],
        "post-update-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "symfony-assets-install": "relative",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": {
            "dev-master": "2.7-dev"
        }
    }
}

我得到了 PHP 5.5.9 版本和 ubuntu 14.04 作为操作系统。

有人可以向我解释为什么会出现这些错误以及如何解决这些错误吗?

最佳答案

根据您的错误,问题是您没有安装 PHP cURL 扩展。

在 Ubuntu 中,尝试以下安装包

sudo apt-get install curl php5-curl

现在再试一次。

关于php - 安装 Symfony2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30821103/

相关文章:

PHP HTML MYSQL 在用户输入注册详细信息后尝试更新数据库的特定行

php - 附加到 CreateQueryBuilder 中的 setParameters

php - 如何使用 doctrine/symfony4 从数据库中获取(加入)两条记录

php - Doctrine 2 多个选择元素、别名、日期格式

php - 如何获取用户在表单中选择的多张图片并显示在下一页?

javascript - 如何将多个 HTML 表单中的值添加到一个数组中进行发送

PHP:递归地将目录中的所有文件重命名为小写

PHP - 将 12 小时格式的 GMT 时间转换为带有延迟时间的新时区

php - 登录和注销后丢失当前本地语言

php - Symfony 3 PhpUnit 提交表单