dongyisa6254 2013-02-16 17:03
浏览 54
已采纳

使用php / silex“未找到类”

I set up a Silex-project local using a XAMPP on Mac. Everything works fine. Now I uploaded the files to my Amazon ec2 server and tried to run it. I always get the php errormessage:

"Fatal error: Class 'Silex\Application' not found in /opt/bitnami/apps/..."

I'm using Composer to handle the dependencies. The first lines of my file look like this:

<?php
require_once __DIR__.'/../vendor/autoload.php';

$app = new Silex\Application();
$app['debug'] = true;

Anyone has a clue how to solve that? Where could there be a problem?

Thanks a lot! Cheers

  • 写回答

1条回答 默认 最新

  • duanchun6148 2013-02-17 14:06
    关注

    As suspected, you are using some sort of git-based deployment process.

    Currently there is no tagged stable release of silex (EDIT: as of now, there is). As a result, composer will install it from source, resulting in the silex github repository being cloned into vendor/silex/silex. Since that folder is a git repo itself, those files cannot be added to your main repo. Which means that on your server the vendor/silex/silex directory simply will not exist.

    If you really want to, you can apply the fix of running composer install with the --prefer-dist flag, which will force to install silex from a zip archive, allowing the directory to be added to your git repo.

    But I would say that you should not be committing your vendors into version control. This is also covered by this entry in the composer FAQ:

    I suggest adding vendor to your .gitignore and running composer install as part of your CI and deployment process.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程
  • ¥20 模型在y分布之外的数据上预测能力不好如何解决