Hi
I'm having an issue with curl on windows with php. If i have curl enabled in php and i run php through command line i get an instant cpu spike... php.exe cpu jumps to about 20% then back down. when i disable curl it only jumps to about 2%
does anybody know why or how to fix it?
i need to run cron jobs every minute or so and cant have the cpu jumping like that...
the weird thing is it does this on non curl scripts. even if i run a blank php file or php -i it jumps to 20... however httpd.exe seems to be fine (~2%)

os: server 2008
php 3.5.1
apache 2.2

suggestions?

Recommended Answers

All 4 Replies

php 3.5.1

Please tell me this is a typo?! xD

As to your problem... It jumps to ~20% on every PHP execution when you have cUrl enabled, even scripts that don't use it?

Sounds like a problem with the Curl extension to me. Have you tried disabling the extension and executing Curl through the command line? (I assume this is possible under Windows, like with Unix?)

If you execute PHP via the command line the httpd.exe shouldn't be involved in any way. Apache is only involved if there is a HTTP request, it being a HTTP server and all ;P

well i dont get the high cpu from httpd i get it from php.exe cli
php.net said its because curl loads a lot of stuff when it starts up. so i need to figure out another way do to cron

Maybe you could try, rather than use Cron to execute the Curl PHP code, to have Cron do a HTTP request to the PHP script via Apache on localhost.

Apache can run PHP as a module, rather than CGI (like the command line does), so there is a chance the Curl startup loading peak only happens once, the first time it is executed, but then remains in memory while Apache is running.

It's worth a shot.

thanks, i ended up ironically using curl.exe to run the cron job. there is no spikes with the exe whereas in php it spikes loading the module

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.