Click to See Complete Forum and Search --> : Accessing php causes CPU to jump to 100%
Hi. I'm running Windows 2000 with IIS5. PHP v4.1.1 and mysql 3.23.
Every time a php page is accessed (even if it's just one user - me), it causes the CPU to jump to 100% usage. This is something that has suddenly started happening - last week the same scripts with the same database on the same box were running fine, now this has suddenly started happening.
I've tried installing PHP both as CGI and ISAPI, but with the same effect.
If anyone could shed any light on this it would be GREATLY appreciated.
Thanks.
Dave.
vincente
02-20-2002, 11:54 AM
I assume you mean that when you access a PHP page the CPU jumps to 100% and stays there and does not want to go back to 1%?
Once the page has been served the cpu usage goes back down. The thing is the server is having to do WAY to much work just to serve one page. Trying to view pages on the web server, most of them come back with fatal error messages because php times out after 30 seconds, and the pages aren't served in that time.
Are you sure, this is caused by PHP?
Something similar happend to me with Netscape 4.7 and a html form submitted via POST. Netscape used 100% CPU.
Changing the form to use GET or running the browser on a different machine than the server help (or using a different browser)
Yeah, it's definetely php that's using all the cpu.
You can see in task manager.
I think you misunderstood. It's not the local machine that gets cpu at 100%, it's the server. The local machine is fine.
vincente
02-20-2002, 02:50 PM
Does it only happen with PHP pages? and if so, does it happen with every PHP page of just the ones with mysql functions?
It's very hard to tell, but I think it's jus the pages that have database access in them. I wrote a simple php script with just a print call in it and that did return a lot faster than the other pages, but it was still slow, but that could have been caused by the cpu trying to process other pages.
Sorry I couldn't be more definite.
vincente
02-21-2002, 07:33 AM
Check your database's configuration, it may be running out of memory or something. That will make it slow.
Do you have many record in your table? (many = 100k-1M)
There's always lots of spare RAM avaliable on the machine, when the CPU is at 100%, the RAM is generally at 20% used.
Also plenty of deiskspace on the drive where the mysql database is (over a Gb)
One table in the database has over 150,000 entries, the problem has not come on slowly as the tables grew though, it just suddenly happened - one day everything was fine with exactly the same database, the next day the CPU was having to do massive amounts of work to serve each page.
gardner1
02-23-2002, 11:15 PM
what mode are you using for mysql?
there are several modes that you can specify w/ -- switches to run "faster" or with more features, ie slower.
gardner1
02-23-2002, 11:21 PM
http://www.mysql.com/documentation/mysql/full/manual_toc.html#Windows_prepare_environment
Thanks guys. I have solved the problem by having the webserver completely rebuilt from scratch.
Thanks for all your suggestions, the site is now running fine with exactly the same files, database and setup.
PHP Builder
Copyright WebMediaBrands Inc. All Rights Reserved.