2

私は Symfony の初心者で、動作させるのに苦労しています。私のマシン(ubuntu)でApache 2を実行しています。URL で構成にアクセスできるようです: localhost/Symfony/web/config.php

また、次の URL でメイン ページにアクセスできます: localhost/Symfony/web/app_dev.php (最初に表示されるのは、次のメッセージです: Web デバッグ ツールバーの読み込み中にエラーが発生しました (404: 見つかりません)。プロファイラーを開きますか?)。私にできる唯一の対応はキャンセルです (受け入れようとすると、404 not found が返されます)。

その後、何も機能しません。でも。常に 404 が見つかりません。

私が見つけたように、キャッシュに問題があるか、Apache の設定に問題がある可能性があります。しかし、私が何を試しても問題は解決しません(他の人はここでスタックオーバーフローで同様の質問をしますが、私には何も解決しません)。

誰か知ってる?前もって感謝します。

4

2 に答える 2

4

私もこの問題を抱えていました。私の構成を見て、試してみてください

私の.htaccess内:

こんにちは、私もこの問題を抱えています。そして、「ストック」.htaccessが問題のようです。私は自分の環境でこれを解決しました。ここにメモ付きの.htaccessがあります:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
    RewriteRule ^(.*) - [E=BASE:%1]
    RewriteCond %{ENV:REDIRECT_STATUS} ^$
    RewriteRule ^app_dev.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]    ##### this is the part that you should tweak, have the .htaccess point the request to app_dev.php, since the routing.yml is empty initially
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule .? - [L]
    RewriteRule .? %{ENV:BASE}/app_dev.php [L]        ##### this is the part that you should tweak, have the .htaccess point the request to app_dev.php, since the routing.yml is empty initially
</IfModule>

<IfModule !mod_rewrite.c>
    <IfModule mod_alias.c>
        # When mod_rewrite is not available, we instruct a temporary redirect of
        # the startpage to the front controller explicitly so that the website
        # and the generated links can still be used.
        RedirectMatch 302 ^/$ /app.php/
        # RedirectTemp cannot be used instead
    </IfModule>

/etc/apache2/sites-available の「symfony」エントリ内:

<VirtualHost 127.0.1.15>
    ServerAdmin webmaster@localhost
    ServerName symfony
    DocumentRoot /var/www/Symfony/web
DirectoryIndex app.php
    <Directory /var/www/Symfony/web>
        Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
于 2013-06-04T10:17:42.177 に答える
0

.htaccessお使いのアパッチ設定を確認してください( mod_rewrite)

見てください:Symfony 404エラー

于 2013-03-25T09:45:38.283 に答える