如何从examplep上的现有代码运行symfony2项目


How to run a symfony2 project from existing code on xampp

我有一个symfony2项目。我需要使用xampp在本地环境中运行它。我把现有的代码放在了examplep中,但当我转到localhost/myproject时,它只列出了那里的目录和文件。我还在目录中安装了composer

编辑当我移动到web目录时,它会给我以下错误

Warning: require_once(G:'xampp'htdocs'm'developer'web/../app/bootstrap.php.cache): failed to open stream: No such file or directory in G:'xampp'htdocs'm'developer'web'app_dev.php on line 23
Fatal error: require_once(): Failed opening required 'G:'xampp'htdocs'm'developer'web/../app/bootstrap.php.cache' (include_path='.;'xampp'php'PEAR') in G:'xampp'htdocs'm'developer'web'app_dev.php on line 23

这似乎是在linux环境中创建的项目与在windows环境中运行的项目之间的问题。你可以在你的项目目录中制作一个php composer.phar install,它应该可以解决你的问题。

如果出现问题,您可能需要使用干净的composer.json重新开始,删除composer.lockvendor文件夹,然后在其中添加所需的捆绑包。

最快的方法是转到localhost/myproject/web/app_dev.php

正确的方法是配置虚拟主机。这个问题可能会帮助你解决虚拟主机上的Symfony 2

编辑到您的编辑

故障排除";require_one(../bootstrap.php.cache):无法打开流:没有这样的文件或目录"