Symfony2 フレームワークに基づくアプリケーションがあります。私は実稼働環境に移行しましたが、ウェブサイトは正常に動作していました (キャッシングを調整しようとしていました - 私のホスティングでは xcache です)。しかし、突然私はこのエラーが発生しました:
致命的なエラー: 「opcache.save_comments=1 または zend_optimizerplus.save_comments=1 を有効にする必要があります」というメッセージを含む例外「Doctrine\Common\Annotations\AnnotationException」がキャッチされませんでした。/nfsmnt/hosting2_1/6/9/699be0da-dfbd-4651-90de-448d295bb741/playsport.sk/web/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php:183 スタック トレース: #0 /nfsmnt/hosting2_1/6/9/699be0da-dfbd-4651-90de-448d295bb741/playsport.sk/web/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php(162): Doctrine\Common\注釈\注釈例外::optimizerPlusSaveComments()
1 /nfsmnt/hosting2_1/6/9/699be0da-dfbd-4651-90de-448d295bb741/playsport.sk/web/app/cache/prod/appProdProjectContainer.php(237):
Doctrine\Common\Annotations\AnnotationReader->__construct() #2 /nfsmnt/hosting2_1/6/9/699be0da-dfbd-4651-90de-448d295bb741/playsport.sk/web/app/bootstrap.php.cache(2103): appProdProjectContainer->getAnnotationReaderService() #3 /nfsmnt/hosting2_1/6/9/699be0da-dfbd-4651-90de-448d295bb741/playsport.sk/web in /nfsmnt/hosting2_1/6/9/699be0da-dfbd-4651-90de- 448d295bb741/playsport.sk/web/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php 行 183
ホスティングで opcache.save_comments を有効にできません (私には権限がありません。これはカジュアルな有料ホスティング サービスです)。そのため、本番環境ですべてのキャッシュを無効にして、Web サイトを再実行しようとしました。私の現在の構成:
web/app.php:
$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
// Enable APC for autoloading to improve performance.
// You should change the ApcClassLoader first argument to a unique prefix
// in order to prevent cache key conflicts with other applications
// also using APC.
//$apcLoader = new ApcClassLoader(sha1(__FILE__), $loader);
//$xcacheLoader = new \Symfony\Component\ClassLoader\XcacheClassLoader(sha1(__FILE__) . "PlaySport", $loader);
//$loader->unregister();
//$xcacheLoader->register(true);
require_once __DIR__.'/../app/AppKernel.php';
// require_once __DIR__.'/../app/AppCache.php';
$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
//$kernel = new AppCache($kernel);
// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter
//Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
config_prod.yml:
imports:
- { resource: config.yml }
#framework:
# validation:
# cache: xcache
#doctrine:
# orm:
# metadata_cache_driver: xcache
# result_cache_driver: xcache
# query_cache_driver: xcache
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
nested:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
console:
type: console
私は本当に何をすべきかわかりません。以前と同じようにまだエラーが発生しています。Doctrine で注釈キャッシュを無効にする方法、またはその問題のその他の解決策。ありがとう!