Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL][PHP] Fatal error: Allowed memory size of... Na localhoscie, korzystając ze Smarty
Darekxp
post
Post #1





Grupa: Zarejestrowani
Postów: 117
Pomógł: 0
Dołączył: 13.05.2007

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


Witam!

Mam problem, ponieważ poniższy błąd pojawia się tylko gdy korzystam (a w zasadzie chciałem dopiero) skorzystać ze Smarty. W moich projektach, gdzie nie używałem Smarty ten błąd nie występuje. Dodam, że błąd pojawia się na localhoscie (WebServ), gdy próbuje wyświetlić dane z bazy MySQL.

Zmieniałem już w php.ini wielkość pamięci na różne wielkości i nic nie pomogło. Zmienia się natomiast komunikat w zależności od wielkości przydzielonej pamięci. Powyżej ok 26M pojawią się błąd serwera.


Fatal error: Allowed memory size of 17825792 bytes exhausted (tried to allocate 40961 bytes) in C:\Program Files\WebServ\httpd\libs\sysplugins\smarty_internal_templatebase.php on line 172

Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 1128 bytes) in C:\Program Files\WebServ\httpd\libs\sysplugins\smarty_internal_debug.php on line 56

Jak to rozwiązać?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Darekxp
post
Post #2





Grupa: Zarejestrowani
Postów: 117
Pomógł: 0
Dołączył: 13.05.2007

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


  1. <?php
  2.  
  3. include('configs/mysql.php');
  4. require('libs/Smarty.class.php');
  5.  
  6. $smarty = new Smarty;
  7.  
  8.  
  9.  
  10. //$smarty->force_compile = true;
  11. $smarty->debugging = true;
  12. $smarty->caching = true;
  13. $smarty->cache_lifetime = 120;
  14.  
  15. $smarty->assign('title','Wyswietlanie danych z bazy MySQL');
  16.  
  17. $smarty->display('wpisy.tpl');
  18.  
  19. //wpisy
  20. $zapytanie_o_wpisy=mysql_query("SELECT userLogin, userEmail FROM uzytkownicy WHERE userAktywowany='yes' LIMIT 5");
  21. while($a = mysql_fetch_array($zapytanie_o_wpisy))
  22. {
  23. $wpisy[] = $a;
  24. }
  25.  
  26. $smarty -> assign('wpisy', $wpisy);
  27.  
  28. ?>


  1. <title>{$title}</title>
  2. <meta http-equiv="content-type" content="text/html; charset=utf-8">
  3. </head>
  4. <body>
  5. {include file='wpisy.tpl' assign="wpisy"}
  6. Lista userów:<br />
  7. <br />
  8. {$wpisy}
  9. </body>
  10. </html>


I jeszcze index.php bo zauważyłem, że problem pojawia się tu i tu, niezależnie czy pobieram coś z bazy czy nie.

  1. <?php
  2.  
  3. require('libs/Smarty.class.php');
  4. //require('configs/mysql.php');
  5.  
  6.  
  7. $smarty = new Smarty;
  8.  
  9. $smarty->caching = true;
  10. $smarty->cache_lifetime = 120;
  11.  
  12. $smarty->template_dir = 'templates/';
  13. $smarty->compile_dir = 'templates_c/';
  14. $smarty->cache_dir = 'cache/';
  15. $smarty->config_dir = 'configs/';
  16.  
  17.  
  18. if (isset($_GET['page'])){
  19. $module = basename($_GET['page']);
  20. if (file_exists("$module.php")) include("$module.php");
  21. if (file_exists($smarty->template_dir.$module.".tpl")) $body_template = "$module.tpl";
  22. else $body_template = 'index.tpl';
  23. }
  24. else $body_template = 'index.tpl';
  25.  
  26.  
  27.  
  28. $smarty->assign('tytul',''.$domena.'');
  29. $smarty->assign('tytul_tresc','Strona główna');
  30. $smarty->assign('box_1','Aktualności');
  31. $smarty->assign('body',$body_template);
  32.  
  33.  
  34. $smarty->display('index.tpl');
  35.  
  36. ?>


  1. <TITLE>{$tytul} - {$tytul_tresc}</TITLE>
  2. </HEAD>
  3. <BODY bgcolor="#fccfff">
  4.  
  5. {include file=$body}
  6. </BODY>
  7. </HTML>
Go to the top of the page
+Quote Post

Posty w temacie


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 - 19:06