Jump to content

jvalarta

Members
  • Posts

    42
  • Joined

  • Last visited

    Never

Everything posted by jvalarta

  1. So I did a test with a cron running once every minute and the reason this didnt work in my situation is that the PHP execution time varies between .5 to up to 3-4 seconds...so if a cron runs once a minute, and the PHP is still processing past the 59th second, the cron starts another process (PID) and then I have 2 running at the same time, which will open up a data integrity issue. There has got to be a way to have PHP start running and then release the browser -- and if there is, then this problem is solved and I dont need the daemon. Here's my thinking in a super basic example: <? //script starts - accepts variables //script releases browser sleep(100); //script continues running ?> If this PHP was executed, the browser should immediately be done loading, even though the PHP is still running/peforming (in this example, a sleep).
  2. Believe me, I have a real need. This performance issue is really causing issues for our sales people. I must resolve this. So, we get data from our clients in a GET string (var1=foo&var2=bar, etc) and we pass it with an IMG tag (dont ask, its legacy and to switch to SOAP or something else would be a major change for our cusotmers) so when this IMG tag loads with the filename.php?getstring it holds up the browser page until the PHP is done running. The PHP has to run a complex set of tasks based on the variables passed,so it can, at times take upwards of 3-5 seconds. Deosnt seem like much, but it's a big issue for our customers. So, I need a way that the PHP can say "ok, I have the variables, let the browser go on without me". Just like the php filename.php & does at the CLI. Note: The PHP does not provide anything back to the browser. It's purely a script with no http output.
  3. Well, I thought that at first, so I used getmicrotime() on my script to time the true amount of time it's taking to process and it's defiantely the amount of work the PHP script has to do (sometimes several seconds) which is just way too long. I need a way for PHP to release the browser and continue on it's process, without the browser having to wait.  ???
  4. ??? That's it! sometimes the obvious is so hard to find. Thank you thorpe! So this leads me to another question, very related then...if you pass variables to a PHP script, how can you have that script release the browser and have the script continue to run and process? Like, if I wanted to kick off a script via the Web, and do this same thing?
  5. I just finished a project where we tied our company intranet into Outlook -- here's the HTML content type: Content-Type:text/html Works like a charm.  Here's a code snippet also: $Header = "From: Company Name <someone@domain.com>\n"; $Header .= "Content-Type:text/html"; $Subject = 'Email Subject Here'; $Message = 'HTML code here (remember to escape quotes)'; mail ("to@address.com", $Subject, $Message, $Header);
  6. I am passing variables from a customer's website that doesnt support PHP, to a server that does, like this: IMG SRC="http://myserver.com/script.php?var=foo&ubber=bar" This works perfectly, but the PHP script takes a few seconds to run (as it's doing a bunch of DB stuff) and I need to speed this up. (I believe Ive got the db stuff fully optimized, there is no option for speed increase there) My question is -- is there a better way to do this, or is there some way that the PHP can deliver an image name and keep running the process, without holding up the loading of the page (waiting on the image)?
  7. A cron won't work becuase I need this to be running all the time, processing data as it comes in. I did build an enless loop last night, put it on a sandbox server, and let it run all night. Seemed to run fine, but all it did was write numbers to a flatfile. The other issue I ran into is that I have to keep a terminal window open. The second I close the window, the script stops. Suggestions on how to get around that?!
  8. I need a script that runs 24/7/365 and constantly pulls data from one database and processses that information, then puts it into other databases. I can write the PHP no problem, my question is, can I do this with PHP?  --Start it from the command line and will it run without stopping? (I would build a loop of course) Will this eat up memory? Processor power? Anyone ever done anything like this, and if so, any tips/links/examples?
  9. Agreed. Alexa.com also seems to have something in place, though I've been unable to figure out the technology behind this. Anyone? Anyone?
  10. I am passing variables from a customer's website that doesnt support PHP, to a server that does, like this: <IMG SRC="http://www.domain.com/index.php?var=this"> This works perfectly, but the PHP script takes a few seconds to run (as it's doing a bunch of DB stuff) and I need to speed this up. (I believe Ive got the db stuff fully optimized, there is no option for speed increase there) My question is, is there a better way to do this, or is there some way that the PHP can deliver an image name and keep running to process, without holding up the loading of the page (waiting on the image)?
  11. Thanks redarrow, but this would only work if the file name was present...that's my challenge, to find the index file name only from giving PHP the domain name. Example: Example: [a href=\"http://www.domain.com\" target=\"_blank\"]http://www.domain.com[/a] I need to have PHP go to that domain, and tell me what the default page name is (i.e. index.php, index.htm, or whatever it may be) The purpose of this is to have our service tell people which page is their home/index page...our clients are very novice so we need to make this as simple as humanly possible for them.
  12. I'm still in search of the answer to this...anyone?
  13. BINGO! I posted this in two places, and got the answer at the other, so I'll put it here in case anyone else runs across this. The answer is, as of MySQL 4.1 there is a way to do an insert/update in one query. Here's how: [code]$sql = "INSERT INTO mytable (ID,Name,RecordCount) VALUES ($ID,'$Name',1) ON DUPLICATE KEY UPDATE RecordCount = RecordCount + 1"; $result = mysql_query($sql); [/code]
  14. I have hundreds of record updates coming in and the way Im doing it now is slowing down the users. Not good. This table has 1.7 million entries, and I have an index on the table. Im wondering if there is a more efficient way to perform this query and update? (MYSQL 4.1.x) [code]<? // CHECK TO SEE IF AN ENTRY EXISTS $query = "SELECT COUNT(*) AS RecordTotal FROM mytable WHERE ID = $ID && Name = '$Name'"; $result = mysql_query($query) or print (mysql_error());    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {      extract($row); } if (empty($RecordTotal)) { // IF NO ENTRY EXISTS, MAKE NEW ENTRY      $sql = "INSERT INTO mytable (ID,Name,RecordCount) Values ($ID,'$Name',1)"; } else { // IF ENTRY EXISTS, UPDATE RECORD COUNT      $RecordCount++;      $sql = "UPDATE mytable SET RecordCount=$RecordCount WHERE ID = $ID && Name = '$Name'";     } $result = mysql_query($sql); ?>[/code]
  15. Anyone? Or is this just not possible? Oh PHP Guru, art'thou in my time of need??
  16. No. the pages are potentially anywhere on the net (any domain name). These are client domains, and we are building a service to index their pages (site map on the fly). It works perfectly, except for the home page. So close, yet so far...
  17. Is there a way to give PHP a domain and have it return the "index" page name? Seems like this would be simple, but I'm not finding a solution. Example: [a href=\"http://www.domain.com\" target=\"_blank\"]http://www.domain.com[/a] What I need is to have it return the default page name, like index.htm, or index.php, etc. Help!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.