Mysql Running Slow
I'm a php guy and db system issues are not my thing. My server (linux) is running mysql 4.0.15, and running SLOW, very slow. I did a search for the slow query log file that the docs mention but could not find it. I have started changing the file types to myisam from innoDB. I'm wondering if the system is screwed up becuase the size of ibdata1 (where innodb data is stored) is 1344274432 bytes (about 1.1 GB), but as I convert tables from innodb to myisam (lots of them with lots of data), the file size of ibdata1 is not going down.
View Complete Forum Thread with Replies
Related Forum Messages:
PHP Running Way To Slow T_T
About an hour ago my pages were taking around 0.01 seconds to load. Now those same pages are taking like 5.00 seconds to load. CPU usage is 1% Why are they going so slow all of a sudden? Even pages that I have not edited at all whatsoever in any way are suddenly slow as poop when they used to be loading instantly an hour ago! Code:
View Replies !
Suddenly Started Running Slow!
So the other day, I was fiddling with the php.ini file on my web server trying to figure out why my 30mb file wasn't uploading, so I started changin some settings and then tried to upload my file again... Out of nowhere, the php script started taking forever to execute! you can see it here: ....
View Replies !
Site Running Slow Transferring To HTTPS
I have an intermittent issue with my site in that, at times, it runs really, really slow when it transfers from http to https. The server administrators says there's no problem their end so I'm kinda stumped, as it runs fine most of the time, then for a couple of hours on some evening or weekend, any request has about a 10% chance of getting onto the next (secure) page. The page takes forever and might eventually load after a few minutes. I'm not running any cron jobs at the time, I think I've ruled out network attacks. This happens with the public https pages. The password protected, back-end https pages seems slow, but still get there. So really what I'm asking is this: Are there any inherent pitfalls to look out for at that point of transferring from http to https?
View Replies !
Awfully Slow Mysql Script
Afternoon all. I wrote a simple script to grab some information from a database. It goes like this: - usual connection code - Order the database by the 'desc' column: $query="SELECT * FROM images ORDER BY `desc` DESC"; - get result, set num_rows etc. - $i=0; while ($i < $num_rows) { $desc=mysql_result($result,$i,"desc"); if( $desc == $lastdesc ) { } else { $albumid=mysql_result($result,$i,"albumid"); $filename=mysql_result($result,$i,"filename"); $title=mysql_result($result,$i,"title"); echo "<div class='imagethumb'> <a href='/fanart/artist.php?a=$desc' class='image'> <img src='/fanart/$albumtitle/image/thumb/$filename'> </a> <center><i>$desc</i></center> </div>"; $lastdesc = $desc; } $i++; } What this does is first simplyoutput the row's data into a nice image thumb. On that first run through, it sets $lastdesc to be the same as $desc. Then it moves on to the next row - and using $lastdesc, checks whether it has the same 'desc' as the last row, in which case it won't display as I only want one row to show for each desc. Then it moves on to the next row and checks again. If the desc is still the same, it'll skip through until it finds a new 'desc' and output that in the image thumb. After that it's off again to repeat. It works perfectly fine, but it's terribly slow - takes minutes just to get through 200 rows. Any ideas on optimisation? Have I gone about this in totally the wrong way?
View Replies !
MySQL Is Extremely Slow... Sometimes
I have some scripts that make 50+ queries to my SQL database. The speed is not very fast, as expected... but sometimes it takes forever, or cannot complete without a page timeout. It is strange, sometimes it goes fast... other times it cannot run at all for days. I have recently switched my webhost to iPower.com, and I seem to have more of these problems then before. My question is, can this be helped by switching to another provider or by getting a different class of webhost service? I have made the assumption that it is not my script that is the problem, because it has not changed. I figure it must be the webhost.
View Replies !
Slow Response Times (php + MySQL)
so my site is finally done but the main page takes about 4-5 seconds to load. It's about 50KB and I have a 1.5 MB DSL so it's not the loading time. Right now it searches through about 1500 records and returns about 50 of them with name, URL, image and a few other options. The site is not public yet and I notice that mysql take 60-90+% of the CPU but barely 3% of the memory when I call that page. Tried it plenty of times to make sure that's why it spiked. What's scaring is that the records will increase to at least 10,000. I have eAccelerator and I have no problems with a php-nuke site with way more records. It loads really fast, but I have removed a lot of the bells and whistles; here I need them. The server: Fedora II, a 2.4 P4, 1 GB Ram, MySQL 3.58, server load almost never goes above 0.50, even during the "delays" and when mysql taking 98%. After an OS /Apache 2.0 upgrade, I've noticed that I only have one mysql proccess running, before I had dozens. Is this better or worse? [root@********etc]# more my.cnf [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock [mysql.server] user=mysql basedir=/var/lib [safe_mysqld] err-log=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid I have no problems with individual pages at all in this site. What do you guys suggest? Is my .cnf the problem? Unfortunately the program is finished, too late for database changes, if that's the problem. Can I "cache" the index page with an additional program and update it manually or every hour or so? Eventually I will upgrade to MySQL 4.* but right now I am swamped with updating and testing the new site and can't risk downtime. Any help would be greatly appreciated. some more mysql data, in case it makes sense to someone ;): ------------------------ system locking is not in use Possible variables for option --set-variable (-O) are: back_log current value: 50 bdb_cache_size current value: 8388600 bdb_log_buffer_size current value: 0 bdb_max_lock current value: 10000 bdb_lock_max current value: 10000 binlog_cache_size current value: 32768 connect_timeout current value: 5 delayed_insert_timeout current value: 300 delayed_insert_limit current value: 100 delayed_queue_size current value: 1000 flush_time current value: 0 innodb_mirrored_log_groups current value: 1 innodb_log_files_in_group current value: 2 innodb_log_file_size current value: 5242880 innodb_log_buffer_size current value: 1048576 innodb_buffer_pool_size current value: 8388608 innodb_additional_mem_pool_size current value: 1048576 innodb_file_io_threads current value: 4 innodb_lock_wait_timeout current value: 50 innodb_thread_concurrency current value: 8 innodb_force_recovery current value: 0 interactive_timeout current value: 28800 join_buffer_size current value: 131072 key_buffer_size current value: 8388600 long_query_time current value: 10 lower_case_table_names current value: 0 max_allowed_packet current value: 1048576 max_binlog_cache_size current value: 4294967295 max_binlog_size current value: 1073741824 max_connections current value: 100 max_connect_errors current value: 10 max_delayed_threads current value: 20 max_heap_table_size current value: 16777216 max_join_size current value: 4294967295 max_sort_length current value: 1024 max_tmp_tables current value: 32 max_user_connections current value: 0 max_write_lock_count current value: 4294967295 myisam_max_extra_sort_file_size current value: 256 myisam_max_sort_file_size current value: 2047 myisam_sort_buffer_size current value: 8388608 net_buffer_length current value: 16384 net_retry_count current value: 10 net_read_timeout current value: 30 net_write_timeout current value: 60 open_files_limit current value: 0 query_buffer_size current value: 0 record_buffer current value: 131072 record_rnd_buffer current value: 0 slave_net_timeout current value: 3600 slow_launch_time current value: 2 sort_buffer current value: 2097144 table_cache current value: 64 thread_concurrency current value: 10 thread_cache_size current value: 0 tmp_table_size current value: 33554432 thread_stack current value: 65536 wait_timeout current value: 28800
View Replies !
SLOW MYSQL Remote Connections
I was having a major issue connecting to a MySql Database from other machines on my network. localhost connections were just fine. But I wanted to connect to the DB remotely through PHP and the response was terrible. Connecting to Mysql Remotely using GUI's like MySql Front was terrible as well. I am hosting the MySql DB on a Windows XP Service Pack 2 machine, loaded to the teeth with processing and memory. But the result were terrible. Code:
View Replies !
Very Slow MySQL SELECT Query After 11 Records
I have a very weird problem I moved my database to new IIS 6.0 + PHP 4.3 + MySQL 4.0 setup. I tried to check with myphpadmin if everything works fine, but I couldn't browse my table (125 records). I used SELECT option and found out that SELECT query up to 11 records is ok, but after that, even if I choose to limit query to 12 records, it just hangs. I tried selecting from the beginning of the table and from the middle - same thing, but when I run query localy on mysql console, everything works fine
View Replies !
No Mysql When Running Phpinfo.PHP?
I am a newbie and was just getting started working on a guestbook tutorial when I got an error message upon running my PHP code: Fatal error: Call to undefined function mysql_connect() in C:Program FilesApache GroupApache2htdocsadd.php on line 6 So I searched the web for hours trying stuff to no avail. I think something needs to be copied/pasted from a directory to another or something needs to be enabled in php.INI. But what? When I run localhost/phpinfo.PHP there is no mention of Mysql, I know it should be in there. I am running Windows XP pro/Apache server/PHP 5/Mysql. Mysql works fine at the prompt, I create, delete tables and databases at will. One more point I do have the libMySQL.dll in C:WINDOWSSYSTEM32.
View Replies !
How To Check If Mysql Is Running
I have just installed mySQL win32 version and i dont really know how to get the service to run or if it is actually running. is there any php code that will check to see if it is running. if it is running, can someone tell me how i am actually suppose to manage and add new databases etc?
View Replies !
Running Out Of Mysql-connections
I'm having a flash-file (swf) which is requesting info from a PHP-file every ten seconds. The PHP-file connects to a mysql-database, make a short query, and then close the connection, before it returns the info to the swf. Like this: $mysqli = mysqli_connect($dbhost, $dbusername, $dbuserpassword, $default_dbname, $port); //open connection $number = getNumber(); //the function makes a query, and return a number mysqli_close($mysqli); // closing connection echo "&number=$number"; // returns the number to yhe swf The problem is that it seems like the mysqli-connection will not close from time to time. I have a limitation of 1000 connections, which should be enough really. But if I run the flash-file for hours (say 8 hours), the limitation of 1000 OPEN connection is reached, even if I was hoping there should only be ONE open connection at a time.
View Replies !
Can't Get Mysql Monitor Running
I have installed xampp and it seems to be OK. i am now reading a book on php and it tells me to "open the MySQL monitor in a root shell window, or a Command Prompt window on windows systems, then type "show databases" at the mysql>prompt to see all databases".
View Replies !
Warning: Invalid Argument Supplied For Foreach() Running On A OS X Machine Running Apache 1.x And PHP 4.x.
The following script was running on a OS X machine running Apache 1.x and PHP 4.x. I just moved the script over to a Linux machine running Apache 2.0.51 and PHP 4.3.8, and now the foreach line does not work. It says Warning: Invalid argument supplied for foreach() in /var/www/localhost/htdocs/warehouse/whse_order_submit.php on line 39 Here is the script: <?php //get the variables from the other page $id=$_POST['id_no']; $sku=$_POST['sku']; $description=$_POST['description']; $order=($_POST['order_qty']); $store=$_POST['store']; $comment=$_POST['comment']; $ip=$REMOTE_ADDR; //check if store is empty if(empty($store)) { die("Store is required. Please press the back button and enter in your store."); } //connect to the database require('../inc/database_conn.php'); //$month=getdate(mon); //$day=getdate(mday); //$year=getdate(year); //$today=$year . "-" . $month . "-" . $day $today=date('Y-m-d'); // create the unique order number $headerqry = "INSERT INTO misc_order_header (order_date, store, comment, ip) VALUES ('$today', '$store', '$comment', '$ip')"; mysql_query($headerqry, $conn) or die(mysql_error()); $order_no=mysql_insert_id(); foreach($order_qty as $id_no => $val) { if($order_qty[$id_no] > 0) { $detailqry = "INSERT INTO misc_order_detail (order_no, id_no, sku, order_qty, order_date, store) VALUES ('$order_no', '$id_no', '$sku', '".$order_qty[$id_no]."', '$today', '$store')"; mysql_query($detailqry, $conn) or die(mysql_error() . "<BR>" . $detailqry); } }
View Replies !
Running Php Included From A Mysql Database
I'd like to include php-code out of a mysql (or odbc) database on a php-page and run that code. Is that possible? I know howto include normal text(&html) from a database to a php-page. But I'd like to work with templates, therefore in need just a little bit php-code in my database. (and included on my pages).
View Replies !
PHP/mySQL Running Tasks Automatically?
I have a MySQL DB with all my client details (name, email address etc). I want to use PHP to retrieve records from the DB and email each of these clients (easy enough) BUT I want the system to automatically do this at pre-defined times. I have thought about using the UNIX/Linux CRON utility to perhaps call a PHP script that would retrieve specific records (based on a timestamp perhaps?) and then have it email based upon those records. Does this sound feasible? Are there better ways to do this?
View Replies !
Running Mysql Stored Procedures?
Hi I've a stored procedure on a mysql 5 database and I'm trying to run it. Here's my code $rsDepartment = "CALL sp_Departments_List('fintan');"; $department = new Get_MYSQL_RS(); $department_rslts = $department->MYSQL_LOOP($rsDepartment); print_r($department_rslts); The class just connects to the mysql database & runs mysql_query($rsDepartment) then bangs it into different array types. Here's the error I'm getting Could not run CALL sp_Departments_List('fintan'); query PROCEDURE ucc.sp_Departments_List can't return a result set in the given context I can run the sp using any gui based tool with the same username/password combo. So it can't be a permissions problem.
View Replies !
Anyone Running ISAPI And Mysql Succesfully?
I have the following setup: Windows XP Prof, IIS, PHP5 PHP5 works no problem with either PHP-CGI.EXE and mySQL, PHP5 also works no problem with php5isapi.dll as long as I dont use mySQL. When I use mysql It just gives an error or nothing when I try to execute any mysql function (e.g. mysql_connect). I have put the PHP.INI in C:Windows but no luck. I have also setup the PHPRC variable but no luck. I even put the IniFilePath in the registry as per docs. Every time I reboot. Can anyone tell me the exact steps to get ISAPI to work with mysql in IIS?
View Replies !
Running Multiple MySQL Queries With One Call
I've been trying to figure out how to run multiple MySQL queries with one database call. In phpMyAdmin, I can seperate sever queires with a ";", but mysql_query() doesn't seem to support this. (I get an error when trying to do it). mysql_query("SELECT blah FROM tbl1; SELECT this FROM tbl2 WHERE x = ƈ' INSERT INTO tbl1 VALUES (NULL,something)");
View Replies !
Creat The Table In Mysql By Running The File
How do I make this creat the table in mysql by running the php file. PHP Code: <?php CREATE TABLE `wichita_frgn1`.`Registrations` ( `id` int( 10 ) unsigned NOT NULL auto_increment , `First_Name` text NOT NULL , `Last_Name` text NOT NULL , `Address` text NOT NULL , `City` text NOT NULL , `State` text NOT NULL , `Zip_Code` text NOT NULL , `Home_Phone` text NOT NULL , `Cell_Phone` text NOT NULL , `E_Mail` text NOT NULL , `Membership_No` text NOT NULL , `Roar_No` text NOT NULL , `First_Class` text NOT NULL , `Transmitter_Frequency` text NOT NULL , ........................
View Replies !
Running PHP/Apache On A User Mode Linux Machine, Where To Stick Mysql?
I hope no one minds me running this past them. I'm running a linux machine with with apache, php and mysql. This is not accessable from the internet. I want a server that is visable to the internet. For that purpose I am running a user mode linux machine and using apache on that as the external looking web server. This means that stuff I want to see on the outside is on a copy of apache that is doing little and does not get messed around with as much as my main copy of apache. I am not using mysql with it at the moment. If I do am I better running mysql on the user mode machine or running a second copy of mysql on a different port on the 'main' machine. I'm beginning to think the latter has advantages.
View Replies !
Slow Down
I have written this script, which connects to a mysql data base.. and receives results from it..but for some reason, it has become very slow when loading... any ideas on how to pin point why such things happen?
View Replies !
Slow PHP On IIS 6
I have PHP 4.3.1 running under IIS 6, when i access my website PHP is verly slow but when i access my website on my server using http://localhost/mysite/ php is very fast.
View Replies !
PHP 5 - XSL Slow?
I've just installed PHP 5 under Fedora Core 2 and I've been having speed problems with xsl and the dom functions. Previously I used the sablotron extension functions under PHP 4 with script execution times of under 5 seconds ( max of 0,2M xml files, with a fair number of xsl:key statements). Under PHP 5 execution times almost seem random and never seem to use the full system resources (memory-limit wasn't included as a compile option) -- script execution times are often ten times longer that under PHP 4. Has anybody else encountered problems with these functions and/or is there a way to tell PHP to stop pussy-footing around and use the system resources available to it (this isn't a shared environment)?
View Replies !
Cli Seems Very Slow
Anyone else have this issue? Even if I write a simple hello world! script with a shebang and run it, there seems to be a half a second or so delay before I get my response. Code:
View Replies !
Slow Code. Could I Do This Better?
I have a page that serves as a calendar for an object. On this page theres a section that automaticaly generats every day in the selected year, in a month by month fassion. What I'm trying to acomplish is to set bgcolor to green if the object is vacant, and red if not. I get this to work, but it's paintaking slow the way I do it. wich is: PHP Code:
View Replies !
Help..PHP/APACHE Slow
Have compiled PHP 4 with MySQL support into my Apache 1.23.32 server. It works great but I've noticed it drastically slows down the speed at which the pages load. I would expect a php script with a DB query to be slower, but this goes for almost 10 seconds or more on the same network. HTML zaps onto the screen real quick.Is there a way I can make the server respond faster?
View Replies !
Slow Loading
I recently moved to a new server. I've noticed that index.php (first page anyone sees) is extremely slow to load. On the old server it loaded fast. The servers have the same specs. What could the issue be?
View Replies !
File() Too Slow
I am trying to process a CSV file but am having trouble with my hosts maximum execution time of 30 seconds. This is how the script works at the moment. User uploads their CSV file The script goes through the file() and writes smaller chunk files. The script then goes through processing the smaller files, populating the database, deleting the processed file and refreshing itself, thus starting again. This system works for files up to 15000 rows, but I need to be able to process larger files. The bottleneck is with the initial splitting, since I use the file() function to read the entire uploaded file. Does anyone know a quicker way to split a file into smaller chunks.
View Replies !
PHP And Ajax - Very Very Slow
PHP and Ajax - very very slow How do you people use PHP with Ajax? I have been using this code, but there must be something wrong because it takes too long to get the answer from the server. I really need, somehow, to check if the IE version is 5. The main point is: where there more than 500 people connected to the DB it becomes really slow. Ajax code: var agt = navigator.userAgent.toLowerCase(); var isIe = (agt.indexOf('msie') != -1); var isIe5 = (agt.indexOf('msie 5') != -1); var uniqueCounter = (new Date).getTime(); function createXmlHttpReq(handler) { if (isIe) { var control = (isIe5) ? "Microsoft.XMLHTTP" : "Msxml2.XMLHTTP"; try { xmlhttp = new ActiveXObject(control); xmlhttp.onreadystatechange = handler; } catch (e) {} } else { xmlhttp = new XMLHttpRequest(); xmlhttp.onload = handler; xmlhttp.onerror = handler; } return xmlhttp; } function xmlHttpGET(xmlhttp, url) { xmlhttp.open('GET', url, true); xmlhttp.send(null); } function xmlHttpPOST(xmlhttp, url, arg) { xmlhttp.open('POST', url, true); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.setRequestHeader("Content-Length", arg.length); xmlhttp.setRequestHeader('Connection','close'); xmlhttp.send(arg); } function sendRequestGET(url) { xmlhttp = createXmlHttpReq(function() {}); xmlHttpGET(xmlhttp, url); } function sendRequestPOST(url, arg) { xmlhttp = createXmlHttpReq(function() {}); xmlHttpPOST(xmlhttp, url, arg); } ======================================================================== My JavaScript in .php file (example): ... function GetPerfilIndividual(id){ var arg = 'SOMETHING=1&SOME_ID=4343"; var xmlhttp = createXmlHttpReq(function() { if(xmlhttp.readyState == 4) { if(xmlhttp.status == 200) { document.getElementById("DIV_DEST").innerHTML = xmlhttp.responseText; } else { document.getElementById("DIV_DEST").innerHTML = "<font color='red'>"+xmlhttp.status+" - "+xmlhttp.statusText+"</font>"; } } }); xmlHttpPOST(xmlhttp, 'my_php_file.php', arg); } ... my_php_file.php - Access the database - make about 8 SELECTs - create some TABLEs - closes database - return
View Replies !
Php::xml_parse Really Really Slow
I have a website that is generated on the fly from XML templates. I've been having some performance issues (pages taking 6 seconds or more to be generated) and profiled the php code. (This is an embedded system with a slow CPU.) It turns out that php::xml_parse is very, very slow. My XML stuff isn't that complex, but only 4 calls to xml_parse account for 1/2 of the time it takes to generate the page. Anyone know of a way to improve XML performance? I don't need ereg/preg support, or anyting like that, but I have to get the xml_parser to run faster.... This is my configure script: ../configure --host=arm-linux --target=arm-linux --build=i686-pc-linux-gnu --with-zlib-dir=$ROOTDIR/$PLATFORM/lib --with-ming=$ROOTDIR/../src/ming-0.3.0 --disable-all --enable-session --enable-xml --enable-sockets --enable-fastcgi --enable-ming --enable-xdebug --enable-force-cgi-redirect --with-config-file-path=/etc --prefix=/ --exec-prefix=/bin
View Replies !
Why Is This Script So Slow?
This script runs fine, but I'd like to know why it's so slow.. Thanks for any help out there on how i can make it faster (it might take up to 5 min to write these 3 export files whith 15 records each!!!) ==================== <style> body, table, tr, td { font-family: 'verdana' font-size: 12px; } td.header { font-weight: bold; background-color: #cccccc; } </style> </head> <body> <br><br><br><br><center>Creating Export Files<br><br>Please be patient.</center><br><Center> <? flush(); $db = mysql_connect("localhost", "stickerguy", "PASWORDHERE!"); mysql_select_db("stickerguy",$db); // Create contact.tab which is a tab delimated list of customer numbers names, address, email // order write old file // Open contact.tab $file_name = "/home/biz/stickerguy/WWW/stickerguyadmin/contact.tab"; $logfile = fopen($file_name, "w+") or die("Couldn't create new file"); echo "<br>contact.tab "; flush(); // Get all customer numbers $results = mysql_query("SELECT DISTINCT custnumber.ID AS customer_number, orders.custid FROM orders, custnumber WHERE orders.custid = custnumber.scratch AND imported = 0 AND (STATUS = 'payment received' OR STATUS = 'paypal billing complete') ORDER BY custnumber.ID", $db); while ($custnumber = mysql_fetch_array($results)) { $results2 = mysql_query("SELECT * from customer where custid = ".$custnumber["custid"]); $customer = mysql_fetch_array($results2); fwrite($logfile, $custnumber["customer_number"]." ".$customer["name"]." ".$customer["company"]." ".$customer["address"]." ".$customer["state"]." ".$customer["zip"]." ".$customer["email"]." "); echo "."; flush(); } fclose($logfile); // Create phone.tab which is a tab delimated list of customer numbers and phone numbers // over write old file // Open phone.tab $file_name = "/home/biz/stickerguy/WWW/stickerguyadmin/phone.tab"; $logfile = fopen($file_name, "w+") or die("Couldn't create new file"); echo "<br>phone.tab ."; flush(); // Get all customer numbers $results = mysql_query("SELECT DISTINCT custnumber.ID AS customer_number, orders.custid FROM orders, custnumber WHERE orders.custid = custnumber.scratch AND imported = 0 AND (STATUS = 'payment received' OR STATUS = 'paypal billing complete') ORDER BY custnumber.ID", $db); while ($custnumber = mysql_fetch_array($results)) { $results2 = mysql_query("SELECT * from customer where custid = ".$custnumber["custid"]); $customer = mysql_fetch_array($results2); if ($customer["phone"] != "") { fwrite($logfile, $custnumber["customer_number"]." ".$customer["phone"]." HOME "); } if ($customer["fax"] != "") { fwrite($logfile, $custnumber["customer_number"]." ".$customer["fax"]." FAX "); } echo "."; flush(); } fclose($logfile); // Create order list HTML file // Open orderlist.html $file_name = "/home/biz/stickerguy/WWW/stickerguyadmin/orderlist.html"; $logfile = fopen($file_name, "w+") or die("Couldn't create new file"); echo "<br>orderlist.html ."; flush(); fwrite($logfile, "<html> <head> <title>Order List</title> "); fwrite($logfile, "<style> "); fwrite($logfile, "td {font-family: Verdana; font-size: 10px;} "); fwrite($logfile, "td.leftbox { font-family: Verdana; font-size: 10px; background-color: #E8E8E8; } "); fwrite($logfile, "td.box1 { font-family: Verdana; font-size: 10px; background-color: #CCCCCC } "); fwrite($logfile, "td.box2 { font-family: Verdana; font-size: 10px; background-color: #EEEEEE; } "); fwrite($logfile, "</style></head><body> "); // Get list of all needed customer numbers for order list $results = mysql_query("SELECT DISTINCT custnumber.ID AS customer_number, custnumber.grandtotal, orders.custid FROM orders, custnumber WHERE orders.custid = custnumber.scratch AND imported = 0 AND (STATUS = 'payment received' OR STATUS = 'paypal billing complete') ORDER BY custnumber.ID", $db); // Loop thru customer number building table each time while ($custnumber = mysql_fetch_array($results)) { $results2 = mysql_query("SELECT * from customer where custid = ".$custnumber["custid"]); $customer = mysql_fetch_array($results2); $results3 = mysql_query("select * from orders where custid = ".$custnumber["custid"]); $order = mysql_fetch_array($results3); fwrite($logfile, "<table cellspacing=2 cellpadding=2 width=750 height=185 border=0> "); fwrite($logfile, "<tr>"); fwrite($logfile, "<td rowspan=3 class=leftbox valign=top><b>Customer #".$custnumber["customer_number"]."</b><br><br>".$order["orderdate"]."<BR><BR>".$customer["name"]."<br>".$customer["address"]."<br>".$customer["city"].", ".$customer["state"]."<BR>".$customer["zip"]."<BR><BR>".$customer["email"]."<BR>ph: ".$customer["phone"]."<br>fx: ".$customer["fax"]."</td> "); fwrite($logfile, "<td class=box1> "); fwrite($logfile, "<table cellpadding=2 border=0 width=100%> "); fwrite($logfile, "<tr> "); fwrite($logfile, "<td><b>Payment Method:</b></td> "); if ($order["status"] == "paypal billing complete") { fwrite($logfile, "<td>Pay Pal</td> "); } if ($order["status"] == "payment received") { fwrite($logfile, "<td>Check/Mail</td> "); } fwrite($logfile, "<td><b>Payment Amount:</b></td> "); fwrite($logfile, "<td>$".$custnumber["grandtotal"]."</td> "); fwrite($logfile, "</tr> "); fwrite($logfile, "<tr> "); fwrite($logfile, "<td><b>Requested Deadline:</b></td> "); fwrite($logfile, "<td colspan=3>".$order["deadline"]."</td> "); fwrite($logfile, "</tr> "); fwrite($logfile, "</table> "); fwrite($logfile, "</td> "); fwrite($logfile, "<tr><td class=box2> "); fwrite($logfile, "<table cellpadding=2 border=0 width=100%> "); $results4 = mysql_query("select * from orders where custid = ".$custnumber["custid"]); while($orders = mysql_fetch_array($results4)) { fwrite($logfile, "<tr> "); fwrite($logfile, "<td><b>".$orders["project"]."</b></td> "); fwrite($logfile, "<td>".$orders["quantity"]." ".$orders["ordertype"]." ".$orders["size"]."</td> "); fwrite($logfile, "<td> "); if ($orders["vinyl"] != "") { fwrite($logfile, "Vinyl: ".$orders["vinyl"] . " "); } if ($orders["color1"] != "") { fwrite($logfile, "Color1: ".$orders["color1"] . " "); } if ($orders["color2"] != "") { fwrite($logfile, "Color2: ".$orders["color2"] . " "); } if ($orders["color3"] != "") { fwrite($logfile, "Color3: ".$orders["color3"] . " "); } if ($orders["color4"] != "") { fwrite($logfile, "Color4: ".$orders["color4"] . " "); } fwrite($logfile, "</td> "); fwrite($logfile, "<td>Artwork ".$orders["os"]." ".$orders["software"] . " " . $orders["filename"] . "</td> "); fwrite($logfile, "</tr> "); } mysql_query("update orders set imported = 1 where custid = ".$custnumber["custid"]); fwrite($logfile, "</table> "); fwrite($logfile, "</td></tr> "); fwrite($logfile, "<Tr><td class=box1>" . $customer["notes"] . "</td></tr> "); fwrite($logfile, "</table> "); fwrite($logfile, "<hr color=black width=750> "); echo "."; flush(); } fwrite($logfile, "</body></html>"); // Output links to each of the above 3 files. ?> </center> <Br><br> <center> <a target="new" href="contact.tab">contact.tab</a><br> <a target="new" href="phone.tab">phone.tab</a><br> <a target="new" href="orderlist.html">orderlist.html</a><br> <Br><br> Right click the above links and click "save as" or "save target as" to save the files. <Br><Br> Orders have been marked as processed. </center> </body> </html>
View Replies !
PHP Slow To Execute
I have some PHP pages at.. which is exhibiting some strange slowness. It is hosted by secureserver.net (bad?). When I time how long it takes to load the main web page from the server it averages 7 seconds, but often goes to 15. When I store the main page on my hard drive, the load time is 1 second. I've tried removing PHP code that might slow things down but that only brings the load time down to 5.5 seconds best case. I have other PHP pages on the same server that seem to execute faster. The key difference between the slow main page and the faster pages is the faster pages do not use "include" to execute code in other PHP files. However with out "include" and the modularity it affords, my PHP code would be harder to maintain. What to do?
View Replies !
MSSQL Slow On IIS 6
I built a PHP website on Windows 2000 (using IIS) that connects to a SQL Server 2000 database using the mssql functions. I migrated the website and the database onto a Windows 2003 machine, and now the mssql functions are significantly slower. On the Windows 2000 machine, the mssql_connect takes .03 seconds to run, and the odbc_connect takes the same amount of time. On Windows 2003, the mssql_connect takes a full second to run, but odbc_connect only takes .017 seconds. I have tried both ISAPI and CGI for the php configuration in IIS, and I have experimented with different values for the output_buffering parameter in php.ini, but neither of these seem to make a difference. Why would the mssql commands be so much slower on IIS 6? I would rather not have to change all the database calls to be odbc instead of mssql
View Replies !
Is_null Very Slow
I recently loaded a binary copy (5.0.3) onto my PC running win2k and Apache 2.0.52. It seems to work fine except that it is very slow running the function is_null e.g. the dummy program below - <?php for($i=0; $i<1000; $i++) { if(is_null($x)) $y=0; } echo 'done' ?>
View Replies !
Website Too Slow
I'm re-programming my Website (www.coaster.ch) in PHP and I find it too slow (although I have ADSL). That's more or less how it functions: Here my tables: 'COASTERS' (code of coaster, code of country, etc...) 'COUNTRIES' (code of country, names of countries in different languages, code of continent) 'CONTINENTS' (code of continent, names of continents in different languages) In my index.php (start site) I use a "while": I look for the first continent. I look for the first country I count all the coasters from 1st country echo country - number of coasters I look for the second country I count all the coasters from 2nd country .... .... I look for last continent.... The search and presentation in tables (I use 5 tables, 1 for each continent) is rapid. The problem is when I go the the sub-site of a country and want to come back to the index site: it takes too much time. Could it be that it is slow because it has to make the whole search again? Can I solve that by making the first search (at the begin of the session with something like requireOnce "search data) and charge all the information in an array and them when returning from a sub site only showing the array? I also thought that perhaps the reason could be that I use tables for continents and countries but otherwise I should have to include all these texts in .inc files...
View Replies !
Fread Is Slow, Is There A Better Way?
I have been trying to stream a 19mb quicktime file through PHP. While this script does work i find it to be really slow. Is there any way i can make it faster? I have tried using fpassthru and using a smaller buffer and neither seemed to have much effect. Code:
View Replies !
Slow Mail()
I have a script with a mail() command to send an email to myself to inform user's ip and referrer. I've been using it without any problems for the last three years. Big changes I had to make in many scripts when I turned register_globals off. After this, access to that page (script) is very slow (1-2 minutes) unless I comment mail() out. I cannot figure out what should I set to fix it ....
View Replies !
Apache2 W2K Slow
I do PHP programming on a Windows 98 computer, (why 98 - well I want to run VBDOS on this computer). I then transfer PHP files to a W2K computer. I recently moved to Apache2 and PHP 4.3.11 (from 4.1.3). One page in particular has some fairly intensive work to do, accessing MySQL a lot and creating two large tables. This page takes 2 1/2 times longer to load on the W2K server than the W98 server. I have done timings for various parts of the page using mictotime. All parts are slower on W2K. Both servers are using the same PHP.INI file. Globals has to be on as some of the programs still need it, not yet converted. Anyone has similar experience?
View Replies !
Fsockopen Slow
I'm having an issue with speed at the moment. Basically I have a database with a list of websites on it. I only want to display the sites that are actually 'live'. I've used fsockopen and it does work. Only problem is it takes quite a while. I seem to be waiting at least 10 seconds for it to tell me the site is not responding. It is very quick when the site does exist though. I've played with the optional timeout from fsockopen but I see no difference. Any suggestions? Is there another faster way to check a site is online using php?
View Replies !
Gethostbyname Slow
using the gethostbyname function seems to noticeably slow down pages. some of the comments in php.net's gethostbyname entry suggest using a version that caches the result, but those versions also only speedup subsequent calls to gethostbyname - the first call is still as slow as ever. so is there anything i can do to speed this up? perhapes i can just implement a function equivalent to gethostbyname using fsockopen, or something?
View Replies !
PHP Slow On Solaris
Does anybody knows why php runs so damm slow on solaris. PHP works fine, but if you use the array function it get really slow. everyone could try it on different platforms. fill a array with 100.000 elements in a loop and you will see what i mean. debugger output shows that php ist trying to get memory for each element. --> anybody know how to tune this in solaris or php? Code:
View Replies !
Database Slow
A reporting script is run from the command line that takes about 45 minutes to run against the production database. Towards the end of run of the script, the database becomes heavily loaded and starts to affect other applications using that databaes. How to approch debugging that script?
View Replies !
Slow Site
My site starts loading very slow. At first I thought that this is host problem, but now I have moved to another host, which should be much faster. Then I start thinking that I have problem in my code. So I start measuring time at the very first header and at the bottom of the page (footer). PHP Code: $today = date("H:i:s"); The difference between header and footer was only 5 secunds. So I figure it out that you have to wait over 20 secunds just to start loading PHP code. Please I could use any tip to improve speed.I'm using PHP and SQL.
View Replies !
Slow Query
i have this query that will only return members that user "1162828" hasnt already voted for. the reason behind this is so user "1162828" does vote on the same member more then once. my problem is that it is slow and gets recored to my slow logs. anyone know why this might be slow? Code:
View Replies !
Slow SQL Queries
I have been trying to clean up my SQL queries, and am stuck on something very simple. This query: select * from ds_products where catID = ôƒ' or cat2ID = ôƒ' I have both catID and cat2ID indexed, but this query does not use either. EXPLAIN shows that id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE ds_products ALL catID,cat2ID NULL NULL NULL 23378 Using where key = NULL.
View Replies !
Help My Slow Parsing Code!
Here's my situation...I've been learning to write PHP for awhile and have been trying to rewrite my web site from plain old static pages to PHP versions. I've been learning based on what I want to do, put my links and articles in databases and allow comments and ratings. I have a test page here: URL I've managed to write the PHP code to do just about everything I wanted, but it takes about 3+ seconds for the page to start to load (and it didn't when it was a static page). I know that this is because of my badly formed PHP no doubt. The routines do what I want, but there HAS to be a much more efficient way to get it done. I'm going to post the code (stipped of font tags and error catching statements). Please advise the easiest way to streamline this code (and or SQL statements) in the best interest of the server processing time (any help would be great!): <?php //Start of routine for animation links $usr = "user"; $pwd = "pw"; $db = "db"; $host = "host"; $cid = mysql_connect($host,$usr,$pwd); ?> <?php //We want the Animated Gif category $category = "1"; $SQL = " SELECT * FROM links_temp"; $SQL = $SQL . " WHERE category = '$category'"; $retid = mysql_db_query($db, $SQL, $cid); //Throw the links in an array - html table loop print ("<center><table cellpadding=2 cellspacing=0 width=100% border=1> "); while ($row = mysql_fetch_array($retid)) { $siteurl = $row["siteurl"]; $sitename = $row["sitename"]; $description = $row["description"]; //cocatenate together anigif_ with each item id for unique rating value $id = "anigif_"; $id = $id . $row["id"]; print ("<tr><td width=100% valign=top>"); //Lets start the form here for the voting to elimate a line break later print ("<form method="POST" action="/test/rating4.php" onsubmit="return genwin()" target="newwin"> "); print ("<A HREF='$siteurl' target=_blank>$sitename</A>"); //While in the while loop lets start another db connection to get item ratings $usr3 = "user"; $pwd3 = "pw"; $db3 = "db"; $host3 = "host"; $cid3 = mysql_connect($host3,$usr3,$pwd3); $SQL3 = " SELECT * FROM ratings_temp WHERE item = "$id""; $result3 = mysql_db_query($db3,"$SQL3",$cid3); $num_rows = mysql_num_rows( $result3 ); if ($num_rows==0) { echo ("No Votes yet"); } else { print " $num_rows Votes, "; $SQL4 = "SELECT AVG(value) AS avgRating FROM ratings_temp WHERE item = "$id""; $result4 = mysql_db_query($db3,"$SQL4",$cid3); print "Rating: " . mysql_result($result4,0) . "<br>"; } mysql_close($cid3); //end of the db connection for ratings print ("$description<br> "); print ("Vote for this Site! "); print (" <select name="rating" size="1"> "); print (" <option value="5" selected>5 - Superb "); print (" <option value="4">4 - Tasty "); print (" <option value="3">3 - Average "); print (" <option value="2">2 - Bland "); print (" <option value="1">1 - Rotten "); print (" </select> "); print (" <input type="hidden" name="item_id" value="$id"> "); print (" <input type="submit" value="Vote"> "); print ("</form> "); print ("</td></tr> "); } //end of the array subroutine making table rows print("</table></center>"); //end of the table after the array ends ?>
View Replies !
|