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 虚拟机打包apk出现错误
  • ¥30 最小化遗憾贪心算法上界
  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 逻辑谓词和消解原理的运用
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝