Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][SF2][Symfony2] Umieszczenie projektu na hostingu
kosmos
post
Post #1





Grupa: Zarejestrowani
Postów: 367
Pomógł: 17
Dołączył: 4.03.2008

Ostrzeżenie: (0%)
-----


Witam,
dodaję temat w tym dziale, ponieważ w dziale z frameworkami, komunikat o tagach nie pozwolił mi na zamieszczenie tematu pomimo iż je dodałem.
Jestem początkujący w temacie frameworków i chciałbym spytać jak należy umieścić projekt na serwerze np. hekko
Obecnie stronę główną odpalam z adresu na lokalnym serwerze http://localhost/symfony/web/app_dev.php/homepage/ i wszystko działa.
Znalazłem kilka podobnych tematów ale niestety wiele nie zrozumiałem ... chodzi mi o to jakie katalogi projektu powinienem wrzucić na serwer, jakich konfiguracji dokonać, oraz jaką ścieżkę podpiąć do domeny.

Pozdrawiam
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
kosmos
post
Post #2





Grupa: Zarejestrowani
Postów: 367
Pomógł: 17
Dołączył: 4.03.2008

Ostrzeżenie: (0%)
-----


@Forti
Napisałeś wczesniej że powinienem odpalić projekt poprzez app.php
Odpal projekt lokalnie na produkcjyjnym środowisku (przez app.php, lub ustaw odpowiednio .htaccess).

Nie mogę sobie z tym poradzić

Póki co odpalam poprzez http://localhost/symfony/web/app_dev.php/homepage/

Robię to po raz pierwszy stąd moje jak mniemam ułomne pytania (IMG:style_emoticons/default/smile.gif)

w app.php mam

  1. <?php
  2.  
  3. use Symfony\Component\ClassLoader\ApcClassLoader;
  4. use Symfony\Component\HttpFoundation\Request;
  5.  
  6. $loader = require_once __DIR__.'/../app/bootstrap.php.cache';
  7.  
  8. // Use APC for autoloading to improve performance.
  9. // Change 'sf2' to a unique prefix in order to prevent cache key conflicts
  10. // with other applications also using APC.
  11. /*
  12. $apcLoader = new ApcClassLoader('sf2', $loader);
  13. $loader->unregister();
  14. $apcLoader->register(true);
  15. */
  16.  
  17. require_once __DIR__.'/../app/AppKernel.php';
  18. //require_once __DIR__.'/../app/AppCache.php';
  19.  
  20. $kernel = new AppKernel('prod', false);
  21. $kernel->loadClassCache();
  22. //$kernel = new AppCache($kernel);
  23.  
  24. // When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter
  25. //Request::enableHttpMethodParameterOverride();
  26. $request = Request::createFromGlobals();
  27. $response = $kernel->handle($request);
  28. $response->send();
  29. $kernel->terminate($request, $response);
  30.  


w htaccess

  1. # Use the front controller as index file. It serves as a fallback solution when
  2. # every other rewrite/redirect fails (e.g. in an aliased environment without
  3. # mod_rewrite). Additionally, this reduces the matching process for the
  4. # start page (path "/") because otherwise Apache will apply the rewriting rules
  5. # to each configured DirectoryIndex file (e.g. index.php, index.html, index.pl).
  6. DirectoryIndex app.php
  7.  
  8. <IfModule mod_rewrite.c>
  9. RewriteEngine On
  10.  
  11. # Determine the RewriteBase automatically and set it as environment variable.
  12. # If you are using Apache aliases to do mass virtual hosting or installed the
  13. # project in a subdirectory, the base path will be prepended to allow proper
  14. # resolution of the app.php file and to redirect to the correct URI. It will
  15. # work in environments without path prefix as well, providing a safe, one-size
  16. # fits all solution. But as you do not need it in this case, you can comment
  17. # the following 2 lines to eliminate the overhead.
  18. RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
  19. RewriteRule ^(.*) - [E=BASE:%1]
  20.  
  21. # Redirect to URI without front controller to prevent duplicate content
  22. # (with and without `/app.php`). Only do this redirect on the initial
  23. # rewrite by Apache and not on subsequent cycles. Otherwise we would get an
  24. # endless redirect loop (request -> rewrite to front controller ->
  25. # redirect -> request -> ...).
  26. # So in case you get a "too many redirects" error or you always get redirected
  27. # to the start page because your Apache does not expose the REDIRECT_STATUS
  28. # environment variable, you have 2 choices:
  29. # - disable this feature by commenting the following 2 lines or
  30. # - use Apache >= 2.3.9 and replace all L flags by END flags and remove the
  31. # following RewriteCond (best solution)
  32. RewriteCond %{ENV:REDIRECT_STATUS} ^$
  33. RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]
  34.  
  35. # If the requested filename exists, simply serve it.
  36. # We only want to let Apache serve files and not directories.
  37. RewriteCond %{REQUEST_FILENAME} -f
  38. RewriteRule .? - [L]
  39.  
  40. # Rewrite all other queries to the front controller.
  41. RewriteRule .? %{ENV:BASE}/app.php [L]
  42. </IfModule>
  43.  
  44. <IfModule !mod_rewrite.c>
  45. <IfModule mod_alias.c>
  46. # When mod_rewrite is not available, we instruct a temporary redirect of
  47. # the start page to the front controller explicitly so that the website
  48. # and the generated links can still be used.
  49. RedirectMatch 302 ^/$ /app.php/
  50. # RedirectTemp cannot be used instead
  51. </IfModule>
  52. </IfModule>
  53.  
Go to the top of the page
+Quote Post

Posty w temacie
- kosmos   [PHP][SF2][Symfony2] Umieszczenie projektu na hostingu   14.03.2015, 01:48:30
- - Mariner   Nie wiem jak jest na hekko. Zamiast ręcznie przen...   14.03.2015, 02:49:20
- - TajnyCzek   Ja jako początkujący zrobiłem tak, zę postawiłem v...   14.03.2015, 04:14:30
- - kosmos   Mariner Czyli odnosząc się do poniższego adresu kt...   14.03.2015, 16:09:34
|- - Mariner   Cytat(kosmos @ 14.03.2015, 16:09:34 )...   16.03.2015, 16:34:49
- - Forti   Powiem Ci co zrób. Odpal projekt lokalnie na prod...   14.03.2015, 16:14:00
- - kosmos   Pod windą 7 na serwerze xampp.   16.03.2015, 17:51:27
- - Mariner   Odplamy notepad ( jeżeli edytowanych plików nie mo...   16.03.2015, 19:28:42
- - kosmos   Dziękuję bardzo - wyprubuję Witam, skończyłem p...   21.04.2015, 08:04:15
- - Forti   http://symfony.com/legacy/doc/book/1_0/en/...or_ft...   21.04.2015, 08:14:44
- - kosmos   @Forti Napisałeś wczesniej że powinienem odpalić p...   21.04.2015, 09:06:00
- - ikssde   Odpalasz w konsoli te komendy które podał Forti. P...   21.04.2015, 10:59:11
- - kosmos   Coś jest nie tak: 1. Uruchamiam stronę z adresu h...   21.04.2015, 18:06:01
- - kpt_lucek   composer update?   21.04.2015, 18:12:02
- - kosmos   dało radępoprzez całkowite wyczyszczenie katalogu ...   22.04.2015, 08:24:43
- - Turson   Jak masz dostęp do ssh i apache to zmień DocumentR...   22.04.2015, 08:28:13
- - Forti   Jak masz strukturę: twojastrona.pl/public_http t...   22.04.2015, 08:33:04
- - kosmos   kpt_lucek wspomniał mi że nie mogę zmienić katalog...   22.04.2015, 08:35:52
- - Forti   Możesz zmienić. W niczym to nie przeszkadza.   22.04.2015, 09:06:31
- - kosmos   Nie dziala mi to polecenie symfony freeze otrzy...   22.04.2015, 10:17:47
- - Forti   teraz sprawdziłem, że to było w wersji 1.x kom...   22.04.2015, 12:45:42
- - kosmos   Zrobiłem tak jak mi napisałeś: Otrzymuję komunikat...   22.04.2015, 17:16:55
- - Turson   Syntax error podejrzewam spowodowany tym, że masz ...   22.04.2015, 18:00:37
- - kosmos   Już jest ok stronka odpaliła się z lokalizacji www...   22.04.2015, 18:30:51


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 16.10.2025 - 10:12