Avoiding Load Time?
I have a script that takes quite a long time to load since the PHP is processing quite a lot of info. Is there any way I can initiate the script, then have it move on to another page right away so I don't have to wait for the PHP to finish processing? (having ignore_user_abort(); on so it will continue to process in the "background" - if my thinking is correct...)
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Load Time
I have a fairly simple php Load Time script that makes use of microtime(), but I was wondering how to make it more acurate. The load time is thousandths of a second, when the actual page isn't visible for 5 or 10 more seconds. Are there any other php options for doing this? I was thinking perhaps buffers, but I don't even know if that would work.
Set Time To Load A Page
I want to make a page which take time almost 60 seconds to load the contents....means a script in php which sleep for a 60 seconds and then execute the next part....
Page Load Time
I have a php/html page that is taking longer to load then i think it should is there a way to see what part of the page is hanging it up?
Load Time Displayed Question
I was looking at a couple of pages yesterday that were coded in PHP, and at the bottom was a "Page loaded in ______" blurb at the bottom. Good example is at www.digitaljedi.com. How could I go about creating a script that would initialize that function. Could it be as simple as doing something like this PHP Code:
Page Load Time + Iframe
There is any way to get the total load time of a page when you get an "IFRAME" on it? In all the tests, I got only the base page time without the "IFRAME" time.... <?php $bench = new phpCounter(); $bench->StartCouter(); $page = "<iframe class=......"; echo $page; $bench->EndCounter(); echo $bench->GetCounter(); ?> Where: // StartCounter() & EndCounter() call this function function SetCounter ( ) // {{{ { list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec); } // }}} // Function to return the counter function GetCounter ( ) // {{{ { $output = ($this->end - $this->start); return substr($output, 0, 5); } // }}}
Maximum Load Time Exeeded..
I know exactly the problem... Basically I changed my method from displaying tutorials per 1000 characters, to adding a function in my bbcode to manually make a "new page". Code:
Page Load Time Show Really High
im running PHP 5.2 on IIS 6 (Windows 2003 Server) and im getting a weird load time result when trying to display page load times on each page. e.g. Page generated in 1193387528.5501 seconds. this is my current code: <?php $time = microtime(); $time = explode(' ', $time); $time = $time[1] + $time[0]; $finish = $time; $total_time = round(($finish - $start), 4); echo '<p>Page generated in '.$total_time.' seconds.</p>'." "; ?> but i've tried 4 others which are all simular. Any idea as to why it's showing a false result as it's loading in unde 1 second (Dual Xeon 2.8 HT server and connecting over 100mb pipe (college campus)).
PEAR::Cache - Save Visitors Time And Balance The Load
Caching is a major process of speeding up your application. By caching the output of a potentially large scale operation and displaying that output later from that cache saves a lot of time. First if you have cached output of a large scale operation, just check whether the cache is out-of-date or not. If it succeeds all the parameters, display the cache which saves that time consuming procedures. These large scale operation may include fetching content from an remote source using CURL or any stream wrapper, or a database operation, or even a time consuming graph/chart generation. There are several types of caching, like opcode caching, output caching etc. Compiler level caching are out of scope in this article. We are simply talking about the output caching. In this step PEAR::Cache or PEAR::Cache_Lite may save really a great amount of time. Lets take a look how. In the following example we are using PEAR::Cache. You can also use Cache_Lite which functions great by sacrificing a bit performance. <? include("Cache/Output.php"); $cache = new Cache_Output("file"); if (!$cache->start($cacheid, "samplegroup")) { //perform large scale operation echo "Hello"; $cache->end(); } else { echo "Printing from Cache"; } //display the cached content echo $cache->get($cacheid); ?> First time, the output is generated as usually. But from next time the output is displayed from cached bypassing the large scale operation. You can flush content of any cached group by accessing it's flush() method which looks like below $cache->flush( "samplegroup");
Avoiding Duplicate Results??
Does anyone know if this is possible: I'm running a query against a db and am pulling name and ticket # (for a helpdesk)... What I'd like to do is take the results from the "Name" field, but only show EACH NAME ONCE in a table. For example, I might get 200 results back, but only want to show the name of the person once, with how many tickets they have assigned to them. So it would look like this: ___Name___|___Number of tickets___ ___Bob____|__________3__________ ___John____|_________23__________ ___Mark____|_________4___________ ...etc, etc... does anyone know how to go about starting this? I'm assuming an array of sorts.
Avoiding Sent Mail To Spam?
Earlier this day i fixed my mail problem for account activation when someone registrates. I thougt that the mail() function didnt worked but instead it did worked by sending all the mails to my email spam. I've seen some code that avoids emails getting into spam.
Writing A Review App But Avoiding Spamming
I want to write a revie module for some listings I have but I can imagine people posting 100s of times to say how great they are and 100s of times to slate their competitors. I figure only allowing one review per listing from a particular IP address is a good start any other suggestions?
Avoiding Duplicate Array Elements
Im having a problem with this code. Im trying to remove duplicate elements from an array created via $_GET. I want users to be able to click on a link which sends an email address to an array. I just want to remove duplicate email addresses from the array. Ive tried array_unique() on my test server but it doesnt work. So i tried to remove duplicates myself before storing them into the array. The script works great without the checking, session_start(); $email = $HTTP_GET_VARS['email']; if (isset($_SESSION['Array'])) { $Array = $_SESSION['Array']; $numElements = count($Array); for($counter=0; $counter < $numElements; $counter++) { /* Problem is here */if ($Array[$counter] == $email) { exit(); } else { array_push($_SESSION['Array'],$email); $EmailArray = $_SESSION['Array']; $_SESSION['Array'] = $EmailArray; } } } else { $EmailArray = array(); array_push($EmailArray,$email); $_SESSION['Array'] = $EmailArray; }
Using Mail() And Avoiding Spam Boxes !
Im using the mail() command to send an email to people who register on my site, but many are ending up in people's spam boxes on hotmail. This problem isn't true of all users - probably around 60%. Im being as open as possible using a number of headers, but can anyone suggest a way of getting through with less problems ? $sender = "From: Name <email@domain.com>" . ""; $sender .= "Return-Path: email@domain.com" . ""; $sender .= "MIME-Version: 1.0" . ""; $sender .= "Content-Type: text/plain; charset=iso-8859-1" . ""; $sender .= "Content-Transfer-Encoding: 8bit" . ""; $sender .= "X-Mailer: PHP/" . phpversion();
Avoiding Endless Conditional Statements
Here is my problem. I want to make a webapp that will basically take the work out of finding what tool works for what situation. There are 5 factors that go into tool selection. 1)Material Group, 2)Insert Radius, 3)Insert Type and Size, and 2 others that I can't remember off-hand. There are probably about 1000 different scenarios that I have to code for..(there are several blank table cells and it's not setup as you might imagine, there is a lot of overlapping), and I desperately want to avoid making a gigantic conditional statement. I'm afraid that I really have to provide a picture of what I'm doing here, so I will do that. Here is the link. You only see 3 of the 5 factors on this page, and the other 2 have to do with whether this table or one of many other tables (not pictured) will be used. So, now that I've confused everyone. That's my table. What's a good way to go about programming that sucker in so that people don't have to do all the "work" involved to figure out what tools they need. They should just be able to choose selections from 5 dropdown boxes and get one tool back. A tool is something like "10.655.600".
Avoiding Php Mail() To Spam Boxes
I'm sending soliticited emails for a nonprofit and i'm finding when i use PHP's mail function, and the mail goes through my ISP's SMTP, a decent percentage of the mails go to people's spam boxes. are there known headers or something i could add to my code to make them less spam box prone?
PHP File Writing And Avoiding A Race Condition
So, PHP has this issue where you cannot lock a file until you open it, which leaves the door open for a race condition when writing files. I wrote the following code a while back and think it should work (and in fact use it and it works), I just thought I'd post it here for an audit and in case it might be useful for someone to use or I missed something! /** * Write a file to the server. * * First open a temp file for writing and acquire a lock. * Proceed to write, unlock and copy the file from a temp file. If the * file size is the same, the write worked, clean up and go home. if * not, clean up and hope it works the next time. */ function cms_writeFile($filename, $tempfile, $data) { $ft = fopen($tempfile, 'w'); if(flock($ft, LOCK_EX)) { fwrite($ft, $data); flock($ft, LOCK_UN); fclose($ft); if(copy($tempfile, $filename) && filesize($tempfile) == filesize($filename)) { unlink($tempfile); return true; } else { // The whole process failed. unlink($tempfile); unlink($filename); return false; } } else return false; } I pass it a random tempfile name, so at that point I think we avoid any race condition issues, but to be paranoid I check the file size after the copy. If the files are of a different size, I drop them both and hope this works the next time. An example to use the function: if(cms_writeFile('test.php', 'randomg-temp.php', 'some data')) { echo 'written' } else { echo 'notwritten' } Seems right, and it works, am I missing anything?
How Can I Load Load Additional Extensions ?
My OS is Winxp . My web server is apache 2 which is installed as a NT service . My php version is 4.32 , and I extracted it into "c:php" . I run php as a apache module . I want to load Additional extensions .They are php_mbstring.dll, php_xslt.dll and php_domxml.dll . I have made changes to php.ini as follow. extension_dir = "c:phpextensions" extension=php_mbstring.dll extension=php_xslt.dll extension=php_domxml.dll then I restarted apache2 . but it told me that the modules could not be located .
Problems With Php Date/time - Real Time Clock
On my website i would like to have a real time clock....i mean to show seconds running one after another...how can i do this? Another problem is how to get time into a variable (which then i will insert into a database table)?
Adjusting Time Displays For User's Local Time
I have a news/comment site where stories and comments are accompanied by the date they were posted. Currently I'm doing that in the GMT format, simply because it's easiest. What I'd like to do, however, is have the page display posts and comments with "your time," i.e., the local time of the user (example of what I'm talking about here). I know how to get local time variables from a user with javascript, but I'm not sure how to pass that information to PHP, especially since I'd like to do this on the front page, which means no passing javascript information via query strings.
Determining If Time Falls Into Time Frame
I am having problems determining whether the current time falls into a certain time frame. I want to be able to allow my users to set a start and end time of when they do not want to be disturbed. for example: between 11pm and 3am every day. I would then store this as 23:00:00 and 03:00:00 in a table. If the times were on the same day then this code would work: PHP Code:
Convertint Time String To Time Stamp
I want to convert the time string from the if-modified-since header into a unix time stamp, so I looked at the strtotime() function. The PHP manual on that function makes reference to a GNU manual page, which indicates that only UTC and Z are unambiguous. However, a last-modified-header is followed by "GMT". They are synonymous, but can I safely use it with strtotime()?
Displaying Time In Different Time Zones
I'm trying to get to grips with times, and as an exercise am trying to create a function to display the time in various places. The way I'm currently doing this is as follows: // ------------------------------- putenv("TZ=GMT"); //set to GMT $time_to_convert = mktime(15,0,0); //gives me 3pm GMT echo(strftime('%d/%m/%y %H:%M',$time_to_convert)); //3pm putenv("TZ=CET"); echo(strftime('%d/%m/%y %H:%M',$time_to_convert)); //7pm // ------------------------------- That seems to work fine, and gives me the dates in the various places. The question I have, is how can I determine if a given country is in daylight-savings? Essentially, what I want to achieve is a list that will tell me what time it is in a given country right now. (A bit like the World Clock
Time Difference Change Over Time
Is there a way to print the time different depending on how long the time has been. So like if the user has not been logged in for 24 hours or more... it will say 1 day rather than 24 hours. And if its less than 1 hour it will say it in minutes... and if its greater than 1 hour but less than 1 day it will say minutes and hours? This is my query which i have done so far but don't know how to do the above checking! //get register date and now date $GetLoginDate = mysql_query("SELECT DATEDIFF(NOW(), LoginDate) AS LastLogin FROM userregistration WHERE UserID='{$_SESSION['Current_User']}'") or die(mysql_error()); $lastlogin = mysql_fetch_assoc($GetLoginDate);
Show Time In Local Time
I tried searching for the answer, but didn't really get anything back. Maybe it's the terminology I was using. Can anyone help me in a direction for how to change what time zone a time is displayed for? My timestamps default to California and would like to show them as EST. Or even show the time in whatever time zone the person viewing the time is in. Does that sentence make sense?
PHP To Select Chance - 50% Of Time X - 50% Of Time Y
I'm sure this is very simple, and I believe has something to do with generating random numbers (although I could be wrong). What I need is simple, code that will show picture X 50% of the time, and picture Y 50% of the time. So that the views on each picture will be exactly the same.
Load Dll
Is it possible to store some functions into a dll file and load that dll as a php extension? Id yes, how?
Page Load For IP
Is there any way only a certian IP address on our network can see a particular Table on the page? or if a certian ip Adress goes to our intranet page load a certain page depending on that IP address.
Does PHP Load All The Extensions In The PHP.INI..
I am using Windows IIS with PHP5 CGI. When I want to use an extension in PHP5 under Windows I enable the extension line in PHP.INI. (e.g. extension=php_sqlite.dll). Does PHP load all the extensions in the PHP.INI on every invocation of a request? If I have 20 different extensions not all of them are used on every page request. Is this inefficient? Would using dl() be more efficient? And why is it being depracated under 5?
Getting PHP To Load Up Images
I'm storing images on a separate drive than that that has PHP running on it. PHP (the group www) has permission on that drive to read files and so on, how can I get PHP to load that image into a web browser? Even better, how can I get PHPThumb to interact and use that image?
Cannot Load Excel
I want to load excel. However, this simple code doesn't work. When I open this page, there's nothign happen, not even 'unable to initiate excel" or othere error message. I have excel in server. Do you know why it doesn't work? Should I make some special setting? <?php $ex = new COM("excel.application") or die("Unable to instantiate excel"); echo "Loaded Word, version {$ex->Version} "; ?>
Form Should Load First..
I am running a script which sends an email first then shows an html form. But here what happens, it is taking so long to load the html form because of the mail function. Once mail function executes, the form loads. I want to run the mail function behind the scene and show the form first. I have tried with the php flush() also. Can anyone please help me regarding this. I want to show the form first instead of waiting for the mail function to finish execute.
100% CPU Load : How To Investigate?
Someone I know is running some Web 2.0-type web site that lives on a shared host, and is experiencing 100% CPU load after a few hours. At this point, his provider couldn't tell if it's due to a DoS attack, or a bug in his application. 1. For the DoS thing, I assume looking at the log files should be enough to tell if it's the problem is due to a suspicious rise in the number of connections at some point. 2. As for bugs, are there tools available for PHP that can monitor an application and reveal bugs that could explain this CPU load?
Load Xml From A Php Script
i have an swf file that load xml data from a php script. when i run directly this swf this works well and load de xml data. but when i tray to load this swf as a clip in other swf then it does not load the data, it read the header of the xml file and nothing more if i change the php script for static xml file (same output that produces the php script) work in both cases any idea?
How To Minimize DB Load?
A friend is running a community application in PHP on a shared server, and his provider is complaining that it's using the DB too much. Apart from making changes to how data are organized in the DBMS, are there ways in PHP to minimize DB load, eg. caching data instead of reading/writing them from/to the DBMS every time, etc.?
Can Not Load Php_ming.so
I try to install php_ming.so in my php . I am using Redhat 8.0 php 4.2.2 apache 2.0.4. I am doing as the howto install file want me to do. as follow. http://ming.sourceforge.net/install.html ------------------ download php_ming.so.gz uncompress it and copy it to your php modules directory (you can find your php module directory by running php-config --extension-dir) Now either just add 'extension=php_ming.so' to your php.ini file, or put 'dl('php_ming.so');' at the head of all of your Ming scripts. ----------------------- but apache or php can not load php_ming.so. How can I fix the problem?
Auto Load
I am tring to figure out how to do something. I am starting to build a collection of coomon used php class, kind of a framework but not really, that i will be using for all my site. For instance i have a database class that handle all mysql database stuff. I have a site class that handles html stuff(generating header/footer, form elements, etc.., i just have all these classes included in 1 folder but it is starting get big and i would like to be able to start searating them with folders. the problem is how can i tell the auto load where the class is without changing the name of the class?
MySQL Load With PHP
Would a medium sized (~500 pages) database driven website, search engine and mailing list be too much for one MySQL database? Instead of making using different databases I would use different tables. I would use PHP for all of this.
Load Url Into A Frame
I have a database with url's in it, and I want to load one at random into a frame, when a link is clicked I want to load a new random url into the frame I can do everything except load the new url into the frame, how would I do that?
Load Text
I want the user to fill out a textbox and have that text upload to a webpage. Like a news announcement , the user can enter in what they want to say and then send and it appears underneath other text entries (using php/mysql). Now the problem is mysql seems to have a limit on what you can store , especially on the server that hosts my mysql (250 chars limit). I want 500-1000 words max so what can i do?
Load Averages Script
Is their any possible way or script that will show the load averages on a windows machine??
Cannot Load MySQL Extension.
This is prolly the third windows box I've set up PHP/MySQL on, but for some reason this one is giving me greif. Anywho, PHP is successfully installed and running, apache works fine, and MySQL is running as a service. All sql/php modules are loaded up fine in apache's conf file, but when I try running phpmyadmin, I get this error: 'cannot load MySQL extension' phpmyadmin documentation says: "Usually, the problem is solved by installing a software package called "PHP-MySQL" or something similar. " Now, I haven't been able to find this software package. Anyone know what could be causing this? I've never had this problem before.
Server Load; Script Vs DB
I'm currently using a very basic script that takes the requested URI and determines where to redirect the user based on it's content, it simply uses a case statement with approx 20 options. My only concern with this particular application is server load (high traffic) and I'm wondering if using the plain script or using a MySQL DB to find the target URL's would be better.
Reducing Server Load
I've got a script that I've released as open source. A user recently reported to me that their host has complained that it's using too much of the server resources. He says that it occasionally jumps up to 15% memory usage, and the CPU usage up around 1.5-2.5. This is on a Celeron 2.2gHz with 512 of RAM. He reports getting around 900 unique visitors a day. I'd like to do what I can to improve the script to make it not so heavy on server load, but am not quite sure what to do to improve it. All of the appropriate fields are indexed, and when doing queries, I always call the specific columns and don't use SELECT *. Anyone got any other suggestions?
Cannot Load A Mysql Extension
this simple matter but ý need a urgent need. ý tried set phpMyAdmin on RedHat9 mysql3.23.54 php4.2.2 and apache 2.0.40 but when try to reach index page of PhpMyAdmin it gives me an error as "cannot load a mysql extension check php config" even if mysql.so is under lib/php4/. What thing must change php config file?
|