I'm using curl to invoke a php script on the same site/server. It works
great, but if I call it again while it's still running, nothing happens.
Why? Can that be fixed?
Why use curl? To make it run in the background. My host can't use exec
nor flush the output to the browser. But, I can use curl and timeout. 4 5562
Terry wrote:
>
I'm using curl to invoke a php script on the same site/server. It works
great, but if I call it again while it's still running, nothing happens.
Why? Can that be fixed?
Why use curl? To make it run in the background. My host can't use exec
nor flush the output to the browser. But, I can use curl and timeout.
Hi,
Maybe SESSIONs are involved?
PHP serves only 1 page to a single user untill that one ends (if you use
sessions).
The reason is this:
1) First request uses session, and gets a lock on the sessionstoragef ile
2) first scripts keeps running....
3) Second call to some script wants to use the same session.
4) Second call hangs and waits for the first to finish, so it can get a lock
on the sessionfile.
Could this be your scenario? Does you app use sessions?
Regards,
Erwin Moller
In article <45************ *********@news. xs4all.nl>,
Erwin Moller
<si************ *************** *************** @spamyourself.c omwrote:
Maybe SESSIONs are involved?
PHP serves only 1 page to a single user untill that one ends (if you use
sessions).
The reason is this:
1) First request uses session, and gets a lock on the sessionstoragef ile
2) first scripts keeps running....
3) Second call to some script wants to use the same session.
4) Second call hangs and waits for the first to finish, so it can get a lock
on the sessionfile.
Could this be your scenario? Does you app use sessions?
Well, I don't think so. I'm not calling session_start() , and according
to phpinfo():
Session support is enabled
session.auto_st art is Off
Do I have to disable session support? Is there something else I should
check?
Terry
"Terry" <no****@aol.com wrote in message
news:no******** *************** ***@newsclstr02 .news.prodigy.c om...
>
I'm using curl to invoke a php script on the same site/server. It works
great, but if I call it again while it's still running, nothing happens.
Why? Can that be fixed?
Why use curl? To make it run in the background. My host can't use exec
nor flush the output to the browser. But, I can use curl and timeout.
Sorry to hijack the thread, but I'm curious about your use of curl.
Recently, I've been vaguely trying to find a nice, portable way of running
background scripts on the web server (hopefully without any special server
set-ups or privileges). My efforts were predominantly centred around trying
to execute something along the lines of 'php bg.php' using back-ticks,
exec() and so on using various Unix redirection tricks, or 'start /b' under
Windows.
I've never used curl (I assume we're both talking about http://curl.haxx.se/), and have only the slightest knowledge of what it's
for and how it works, but (to quote you) 'using curl to invoke a php script
[and] make it run in the background' caught my attention.
I don't suppose you could expand on your use of curl for running PHP scripts
in the background could you (or perhaps tell me that I've misunderstood)?
Thanks in advance for any info.
A.
In article <96************ ******@newsfe7-gui.ntli.net>,
"Andrew C" <no******@total ly.made.upwrote :
"Terry" <no****@aol.com wrote in message
news:no******** *************** ***@newsclstr02 .news.prodigy.c om...
I'm using curl to invoke a php script on the same site/server. It works
great, but if I call it again while it's still running, nothing happens.
Why? Can that be fixed?
Why use curl? To make it run in the background. My host can't use exec
nor flush the output to the browser. But, I can use curl and timeout.
Sorry to hijack the thread, but I'm curious about your use of curl.
Recently, I've been vaguely trying to find a nice, portable way of running
background scripts on the web server (hopefully without any special server
set-ups or privileges). My efforts were predominantly centred around trying
to execute something along the lines of 'php bg.php' using back-ticks,
exec() and so on using various Unix redirection tricks, or 'start /b' under
Windows.
I've never used curl (I assume we're both talking about http://curl.haxx.se/), and have only the slightest knowledge of what it's
for and how it works, but (to quote you) 'using curl to invoke a php script
[and] make it run in the background' caught my attention.
I don't suppose you could expand on your use of curl for running PHP scripts
in the background could you (or perhaps tell me that I've misunderstood)?
Thanks in advance for any info.
See: http://php.net/curl http://php.net/curl_init http://php.net/curl_exec
There are a few comments on background scripts in: http://php.net/exec http://php.net/set_time_limit
Normally I use curl as a replacement for file_get_conten ts, since my
host disables that too, like this:
function my_file_get_con tents($url, $timeout = 10)
{
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNT RANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECT TIMEOUT, $timeout);
curl_setopt ($ch, CURLOPT_TIMEOUT , $timeout);
$file_contents = curl_exec($ch);
curl_close($ch) ;
return $file_contents;
}
This invokes the script. If you set the timeout to 1, then your main
script gets control back in 1 second. Then in the called script use:
ignore_user_abo rt(true);
set_time_limit( 0);
Then your script can do whatever processing...
If your host lets you flush (my host compresses the pages and I can't
turn it off, so the page never gets sent to the browser until exit, so I
can't really flush), you can, all-in-one-page, flush the page to the
browser, then call ignore_user_abo rt() set_time_limit( ) and then do
whatever processing you want. But there may still be other time limits.
Using cron is another option. But, for me, using cron to call my script
every few minutes for something that I need once a week seems pretty
wasteful.
But, I can't get curl to invoke the same page more than once while it's
running. Why? That's what I want to know.
Is it an Apache issue? Does Apache only let one IP access a page once
(curl is coming from my server, not the user, so it's always the same
IP)??
Terry This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Haluk Durmus |
last post by:
Hello
I checked out openssl,mm,apr,apr-util,apache 2,curl,libxml and php
from cvs.
php couse an ERROR
I did the following steps:
|
by: mrbog |
last post by:
1. In order to make an http (or https) request with PHP, I need to
recompile php with cURL.
2. In order to install CURL I have to upgrade my openssl rpm, even
though I'm runing a version of linux that's only like 3 months old
(fedora c2 stable), because curl needs libcrypto.so.4.
3. In order to install libcrypto.so.4 I have to upgrade my openssl
(took me forever to figure that out).
|
by: Chris Fortune |
last post by:
# uname -a
Linux stargate.mxc-online.net 2.4.20-021stab022.2.777-smp #1 SMP Wed Jul 28
17:12:37
MSD 2004 i686 i686 i386 GNU/Linux
I recompiled PHP with mcrypt, openssl, and curl
phpinfo(): http://www.canadiandropshipping.com/hello.php3
Does anyone know why this ssl curl test fails?
http://www.canadiandropshipping.com...t/diag_curl.php
|
by: Hans |
last post by:
Hi everybody,
I am desperately trying to log into my account at godaddy.com with PHP
and Curl and just cannot make it happen. Has anybody written a script
for this purpose?
Here is what I tried but the result is always the login page.
$curl=curl_init();
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
|
by: nfhm2k |
last post by:
I've been trying to find a solution to this for quite some time now...
I even took a look at existing scripts...
Including this one...
http://groups.google.co.uk/group/comp.lang.php/browse_thread/thread/2e052386da903425/b03ec83ac55273a2?lnk=st&q=&rnum=1#b03ec83ac55273a2
Everyone on that post seems to say its to do with the cookie's, yet if
infact they had tried this script they would have found that even with
the cookies enabled this...
| |
by: TheSailor |
last post by:
Forgive me - I am a bit new to cURL and passing form elements from one site to the next...
If you can help with a HOW TO or by holding my hand a bit with examples - so I can learn - I would be in debt to you and very appreciative -...
1) I have several external sites with simple forms (see http://www.wichitahomecenter.com/enter/register.html
) where I collect data on servers I own or have access to...
2) I have, by certain trade...
|
by: zorro |
last post by:
Hello there,
I can't figure out why is it that when i use an array for my postfields
it doesn't work :
this works
curl_setopt($curl, CURLOPT_POSTFIELDS, "clown=bozo" );
this doesn't
curl_setopt($curl, CURLOPT_POSTFIELDS, array('clown'=>'bozo') );
|
by: xerc |
last post by:
I am trying to create a generic function I can call to download all files from a single remote FTP directory -- using CURL. I want to multi-thread it, but need to get the single thread functionality working first before I tackle that. Anyway, in my function I can list all the files, but the function I have, no matter how I try, will only return one file -- the last file. My for() loop seems pretty straightforward, so not sure why only the...
|
by: rottmanj |
last post by:
I am re-writing my rets application in perl, and I have found a few modules that will help me on my way. One of them being WWW::Curl:easy.
During my testing, I have tested both system curl and perl curl. At this point I can get the system curl to correctly connect to my server. However, I am having the hardest time trying to figure out why I cant get perl curl to connect to the server.
Every time I try to connect, I get a 401 error. I am...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |