Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

3 Stron V   1 2 3 >  
Reply to this topicStart new topic
> Maximum execution time of 30 seconds exceeded - o co chodzi
assasin
post 7.05.2009, 08:22:24
Post #1





Grupa: Zarejestrowani
Postów: 196
Pomógł: 0
Dołączył: 13.11.2008

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


http://94.23.43.166/bans.php
Kod
[b]Fatal error[/b]:  Maximum execution time of 30 seconds exceeded in [b]/var/www/modules/bans.php[/b] on line [b]48[/b]

Wszystko dobrze chodziło, gdy przeniosłem ten skrypt na serwer dedykowany przestało, wywala mi powyższy błąd.. stronka się bardzo długo ładuje, i nie wyświetla całej zawartości bazy.

Kod /modules/bans.php
Kod
<table align="center" width = 600  height = 300 border = 0>
<td>

<center>
<body>
<table border=1>
<tr>
<td><b>Konto\IP</b></td>
<td><b>Data wystawienia</b></td>
<td><b>Data odblokowania</b></td>
<td><b>Powód</b></td>
</tr>
<?  

require_once "conf/config.php";  

$data = mysql_connect("$host", "$user", "$password") or die ("Íĺň ńîĺäčíĺíč˙ ń őîńňîě");  
    mysql_select_db("$dbr");  



$data = mysql_query("SELECT bandate, unbandate, banreason, username FROM account_banned, account WHERE  
account_banned.id = account.id AND active = 1 ORDER BY bandate DESC LIMIT 100");  
$ban_data = mysql_fetch_array($data);
do
{
echo '<tr>';
echo '<td>'.$ban_data['username'].'</td>';
echo '<td>'.date("Y-m-d H:i:s", $ban_data['bandate']).'</td>';
echo '<td>'.($ban_data['bandate'] == $ban_data['unbandate'] ? 'Íŕâńĺăäŕ' : date("Y-m-d H:i:s", $ban_data['unbandate'])).'</td>';
echo '<td>'.$ban_data['banreason'].'</td>';
echo "</tr>\n";
}  
while ($ban_data = mysql_fetch_array($data));  
?>  



<?  
require_once "conf/config.php";  
$ip = mysql_query("SELECT ip, bandate, unbandate, banreason FROM ip_banned");  
$ip_data = mysql_fetch_array($ip);
do
{
echo '<tr>';
echo '<td>'.$ip_data['ip'].'</td>';
echo '<td>'.date("Y-m-d H:i:s", $ip_data['bandate']).'</td>';
echo '<td>'.date("Y-m-d H:i:s", $ip_data['unbandate']).'</td>';  
echo '<td>'.$ip_data['banreason'].'</td>';
echo "</tr>\n";  
}  
while ($ip_data = mysql_fetch_array($ip));
?>
</table>
</body>
</center>


</td>

</table>

Ten post edytował assasin 7.05.2009, 08:27:37
Go to the top of the page
+Quote Post
Lejto
post 7.05.2009, 08:24:27
Post #2





Grupa: Zarejestrowani
Postów: 1 385
Pomógł: 48
Dołączył: 23.05.2007

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


ustawienia php
maksymalny czas ładowania skryptu to 30 sekund
zrób coś z tym skryptem bo nie może się tak długo ładować


--------------------
Go to the top of the page
+Quote Post
assasin
post 7.05.2009, 08:28:28
Post #3





Grupa: Zarejestrowani
Postów: 196
Pomógł: 0
Dołączył: 13.11.2008

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


No tak ale co?
Go to the top of the page
+Quote Post
Lejto
post 7.05.2009, 08:30:30
Post #4





Grupa: Zarejestrowani
Postów: 1 385
Pomógł: 48
Dołączył: 23.05.2007

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


nie wyświetlaj od razu 100 rekordów na raz
masz indeksy porobione?
jaki masz typ tabeli?


--------------------
Go to the top of the page
+Quote Post
assasin
post 7.05.2009, 08:39:48
Post #5





Grupa: Zarejestrowani
Postów: 196
Pomógł: 0
Dołączył: 13.11.2008

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


Główny index
Kod
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="pl" xml:lang="pl">


<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Guild List - Legend</title>
<link rel="stylesheet" media="screen" type="text/css" href="styles/styles.css" />
<script type="text/javascript" src="scripts/scripts.js">
</script>
</head>
<body bgcolor="white">
</table>
<tr>
<td><?php include("modules/guild.php") ?> </td>
</tr>
</table>

</tr>
</table>
</html>

Jest jeszcze plik konfiguracyjny nic ciekawego w nim nie ma;/
Go to the top of the page
+Quote Post
Lejto
post 7.05.2009, 08:41:40
Post #6





Grupa: Zarejestrowani
Postów: 1 385
Pomógł: 48
Dołączył: 23.05.2007

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


chodziło mi o indeksy w tabeli winksmiley.jpg
ogranicz limit w zapytaniu i w phpmyadmine użyj opcji optymalizacji tabel


--------------------
Go to the top of the page
+Quote Post
assasin
post 7.05.2009, 08:45:15
Post #7





Grupa: Zarejestrowani
Postów: 196
Pomógł: 0
Dołączył: 13.11.2008

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


Hah ty nie piszesz do super pro programisty php tylko do super pro amatora php.
Tak wygląda baza:
Kod
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for account_banned
-- ----------------------------
CREATE TABLE `account_banned` (
  `id` int(11) NOT NULL default '0' COMMENT 'Account id',
  `bandate` bigint(40) NOT NULL default '0',
  `unbandate` bigint(40) NOT NULL default '0',
  `bannedby` varchar(50) NOT NULL,
  `banreason` varchar(255) NOT NULL,
  `active` tinyint(4) NOT NULL default '1',
  PRIMARY KEY  (`id`,`bandate`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Ban List';

-- ----------------------------
-- Records
-- ----------------------------
INSERT INTO `account_banned` VALUES ('3961', '1238835095', '123892149', 'Agrael', 'Reklama', '0');
INSERT INTO `account_banned` VALUES ('3961', '1238835275', '127037127', 'Agrael', 'Reklama Ixiona', '0');
INSERT INTO `account_banned` VALUES ('4934', '1239131500', '1270667500', 'Agrael', 'Reklama Combat', '1');
INSERT INTO `account_banned` VALUES ('4934', '1239131515', '12391315158888', 'Faldir', 'Reklama Ixion', '1');
INSERT INTO `account_banned` VALUES ('4242', '1239191195', '1239191195', 'Griwen', 'Wyludzanie Golda od gm-a', '1');
INSERT INTO `account_banned` VALUES ('4242', '1239191223', '1239191223', 'Griwen', 'Wyludzanie Golda od gm-a', '1');
INSERT INTO `account_banned` VALUES ('4388', '1239218058', '1239218058', 'Lukas', 'Reklama Combat', '1');
INSERT INTO `account_banned` VALUES ('1167', '1239538124', '2944570768', 'Griwen', 'Reklama exclamation.gif!', '1');
INSERT INTO `account_banned` VALUES ('5141', '1239634050', '1240238850', 'Ofiell', 'FH i SH ', '0');
INSERT INTO `account_banned` VALUES ('1438', '1239635122', '1239635422', 'Griwen', 'Zebra od GMa exclamation.gif!', '0');
INSERT INTO `account_banned` VALUES ('21', '1239640405', '1239726805', 'Holte', 'Wulgaryzmy', '0');
INSERT INTO `account_banned` VALUES ('5416', '1239708908', '1951196012', 'Griwen', 'Zal mi cie', '1');
INSERT INTO `account_banned` VALUES ('5416', '1239709068', '2236904784', 'Griwen', 'Zal mi cie idz grac w Tibie || Griwen', '1');
INSERT INTO `account_banned` VALUES ('4502', '1239710067', '1239710127', 'Griwen', 'Test Griwenek :P', '0');
INSERT INTO `account_banned` VALUES ('4502', '1239710111', '1239710171', 'Griwen', 'Testus Griwenek :P', '0');
INSERT INTO `account_banned` VALUES ('4502', '1239710304', '1239710364', 'Agrael', 'test',
'0');


Kod
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for ip_banned
-- ----------------------------
CREATE TABLE `ip_banned` (
  `ip` varchar(32) NOT NULL default '127.0.0.1',
  `bandate` bigint(40) NOT NULL,
  `unbandate` bigint(40) NOT NULL,
  `bannedby` varchar(50) NOT NULL default '[Console]',
  `banreason` varchar(255) NOT NULL default 'no reason',
  PRIMARY KEY  (`ip`,`bandate`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Banned IPs';

-- ----------------------------
-- Records
-- ----------------------------
INSERT INTO `ip_banned` VALUES ('79.184.96.152', '1238703994', '9223372036854775807', 'Faldir', 'Reklama ShadowGate');


Ten post edytował assasin 7.05.2009, 08:50:19
Go to the top of the page
+Quote Post
okitoki
post 7.05.2009, 08:52:42
Post #8





Grupa: Zarejestrowani
Postów: 214
Pomógł: 18
Dołączył: 25.04.2009

Ostrzeżenie: (20%)
X----


jak ci admin nie zabronił to to zmodyfikuj na początku skryptu daj np. set_time_limit(120); masz wtedy 1,5 min smile.gif


--------------------
Go to the top of the page
+Quote Post
assasin
post 7.05.2009, 12:37:16
Post #9





Grupa: Zarejestrowani
Postów: 196
Pomógł: 0
Dołączył: 13.11.2008

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


W którym miejscu?
Go to the top of the page
+Quote Post
okitoki
post 7.05.2009, 13:48:31
Post #10





Grupa: Zarejestrowani
Postów: 214
Pomógł: 18
Dołączył: 25.04.2009

Ostrzeżenie: (20%)
X----


gdzie ci pasuje


--------------------
Go to the top of the page
+Quote Post
assasin
post 7.05.2009, 15:22:27
Post #11





Grupa: Zarejestrowani
Postów: 196
Pomógł: 0
Dołączył: 13.11.2008

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


Hmm mi się wczytuje stronka teraz 1,5 minuty..
Wyskakuje:
Kod
[b]Fatal error[/b]:  Maximum execution time of 120 seconds exceeded in [b]/var/www/modules/bans.php[/b] on line [b]48[/b]

do tego się jeszcze nie wczytało się wszystko z bazy.
Jest jakiś inny sposób??

Ten post edytował assasin 7.05.2009, 15:23:19
Go to the top of the page
+Quote Post
Lejto
post 7.05.2009, 16:28:13
Post #12





Grupa: Zarejestrowani
Postów: 1 385
Pomógł: 48
Dołączył: 23.05.2007

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


nie możesz mieć tak żeby strona ładowała ci się tyle
zrób to co napisałem wcześniej


--------------------
Go to the top of the page
+Quote Post
assasin
post 7.05.2009, 17:42:34
Post #13





Grupa: Zarejestrowani
Postów: 196
Pomógł: 0
Dołączył: 13.11.2008

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


Kod
ogranicz limit w zapytaniu i w phpmyadmine użyj opcji optymalizacji tabel

Możesz mnie naprowadzić? nie wiem gdzie mam szukać.
Go to the top of the page
+Quote Post
okitoki
post 7.05.2009, 18:02:03
Post #14





Grupa: Zarejestrowani
Postów: 214
Pomógł: 18
Dołączył: 25.04.2009

Ostrzeżenie: (20%)
X----


dodaj miszczu do swojego skryptu php funkcje
  1. <?php
  2. ?>


--------------------
Go to the top of the page
+Quote Post
assasin
post 7.05.2009, 18:42:22
Post #15





Grupa: Zarejestrowani
Postów: 196
Pomógł: 0
Dołączył: 13.11.2008

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


To co wcześniej stronka wczytuje się bardzoooo długo, i jest znów ten błąd:
Kod
Fatal error:  Maximum execution time of 120 seconds exceeded in /var/www/modules/bans.php[/b] on line [b]48

http://94.23.43.166/bans.php
Dodam jeszcze żę skrypt łączy się z bazą na localhoscie.
Go to the top of the page
+Quote Post
michalg
post 7.05.2009, 19:02:47
Post #16





Grupa: Zarejestrowani
Postów: 122
Pomógł: 8
Dołączył: 20.10.2008

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


Co dokładnie jest w 48 linii pliku bans.php?

Pozatym, nie powinien to być problem powolnego wykonywania zapytania, bo w time_limit nie wliczają się zapytania do bazy (i inne operacje, chyba że na windowsie).

Ten post edytował michalg 7.05.2009, 19:05:28
Go to the top of the page
+Quote Post
okitoki
post 7.05.2009, 19:19:14
Post #17





Grupa: Zarejestrowani
Postów: 214
Pomógł: 18
Dołączył: 25.04.2009

Ostrzeżenie: (20%)
X----


daj ten skrypt na forum, przeanalizujemy go


--------------------
Go to the top of the page
+Quote Post
assasin
post 7.05.2009, 21:51:15
Post #18





Grupa: Zarejestrowani
Postów: 196
Pomógł: 0
Dołączył: 13.11.2008

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


Główny index (wyświetla skrypt)
Kod
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="pl" xml:lang="pl">


<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ban list - Legend</title>
<link rel="stylesheet" media="screen" type="text/css" href="styles/styles.css" />
<script type="text/javascript" src="scripts/scripts.js">
</script>
</head>
<body body background="images/tlo.jpg" bgproperties="fixed" bgposition="center"
>
<td><?php include("modules/bans.php") ?> </td>
</tr>
</table>

</tr>

</html>

Skrypt:
Kod
<?php
set_time_limit(120);
?>

<table align="center" width = 600  height = 300 border = 0>
<td>

<center>
<body>
<table border=1>
<tr>
<td><b>Konto\IP</b></td>
<td><b>Data wystawienia</b></td>
<td><b>Data odblokowania</b></td>
<td><b>Powód</b></td>
</tr>
<?  

require_once "conf/config.php";  

$data = mysql_connect("$host", "$user", "$password") or die ("Íĺň ńîĺäčíĺíč˙ ń őîńňîě");  
    mysql_select_db("$dbr");  



$data = mysql_query("SELECT bandate, unbandate, banreason, username FROM account_banned, account WHERE  
account_banned.id = account.id AND active = 1 ORDER BY bandate DESC LIMIT 100");  
$ban_data = mysql_fetch_array($data);
do
{
echo '<tr>';
echo '<td>'.$ban_data['username'].'</td>';
echo '<td>'.date("Y-m-d H:i:s", $ban_data['bandate']).'</td>';
echo '<td>'.($ban_data['bandate'] == $ban_data['unbandate'] ? 'Perm' : date("Y-m-d H:i:s", $ban_data['unbandate'])).'</td>';
echo '<td>'.$ban_data['banreason'].'</td>';
echo "</tr>\n";
}  
while ($ban_data = mysql_fetch_array($data));  
?>  



<?  
require_once "conf/config.php";  
$ip = mysql_query("SELECT ip, bandate, unbandate, banreason FROM ip_banned");  
$ip_data = mysql_fetch_array($ip);
do
{
echo '<tr>';
echo '<td>'.$ip_data['ip'].'</td>';
echo '<td>'.date("Y-m-d H:i:s", $ip_data['bandate']).'</td>';
echo '<td>'.date("Y-m-d H:i:s", $ip_data['unbandate']).'</td>';  
echo '<td>'.$ip_data['banreason'].'</td>';
echo "</tr>\n";  
}  
while ($ip_data = mysql_fetch_array($ip));
?>
</table>
</body>
</center>


</td>
</table>
Go to the top of the page
+Quote Post
okitoki
post 7.05.2009, 22:08:00
Post #19





Grupa: Zarejestrowani
Postów: 214
Pomógł: 18
Dołączył: 25.04.2009

Ostrzeżenie: (20%)
X----


skąd ciągniesz te dane mysql i ile jest rekordów
chodzi o to pytanie
SELECT ip, bandate, unbandate, banreason FROM ip_banned
SELECT bandate, unbandate, banreason, username FROM account_banned, account WHERE
account_banned.id = account.id AND active = 1 ORDER BY bandat

ten mysql cie tak obciąża, albo to są potężne bazy, albo serwer mysql lub łącze jest mocno obciążony


--------------------
Go to the top of the page
+Quote Post
megawebmaster
post 8.05.2009, 09:25:50
Post #20





Grupa: Zarejestrowani
Postów: 143
Pomógł: 17
Dołączył: 8.11.2008
Skąd: Libiąż

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


A ja bym powiedział, że w skrypcie musi być gdzieś nieskończona pętla tongue.gif Czyli coś jest źle skonstruowane. Przecież potężne skrypty oparte na frameworkach nie wykonują się tyle czasu (najwyżej do sekundy widziałem)!
Go to the top of the page
+Quote Post

3 Stron V   1 2 3 >
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 Wersja Lo-Fi Aktualny czas: 23.04.2024 - 16:32