Current location: Hot Scripts Forums » Programming Languages » PHP » PHP Downside--Solutions?

PHP Downside--Solutions?

Reply
  #1 (permalink)  
Old 03-21-05, 02:36 AM
Amulet Amulet is offline
Newbie Coder
 
Join Date: Jun 2003
Location: Southern NJ
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Question PHP Downside--Solutions?

I posted a few days ago. You may remember I've had web host problems due to PHP using too much CPU on my previous host. I'm looking into a new host, and have found one who tells me that with the PHP usage I mentioned (includes, PHPNews, and a couple of small PHP scripts), I'd need to use their dedicated servers, which I can't afford. Another host is willing to work with me, although they cost a little more. I want to ask some questions before I make a final decision. I didn't know PHP uses so many resources, but I switched to PHP instead of Perl, just because it seemed the better thing to do, and to be more organized. I don't actually know PHP, except for includes and echos, basically; I've just been able to get certain types of scripts working. I have no real problem going back to Perl if I can use PHP and Perl without causing CPU problems. Let's see if I can ask what I want to ask without sounding confusing...

Each page on my site calls three files, using PHP include(): doctype.php, header.php, and footer.php.
Each page of links also calls a linkstext.php file.
The header.php file also calls an additional file: global.php, which means each page calls that file, since each page uses the header file.
global.php contains a list of words and phrases that are repeated throughout my site many times, so I can simply put
Code:
<?php echo _WORD; ?>
and whatever text I've set for "_WORD" in global.php will show up in place of it when a visitor reads the file. There are many of these types of echos.
footer.php also uses the following "Last modified" script to post when the page was last modified:

Code:
<?php include("/path/to/scripts/modified.php"); ?>
Will all of this alone cause high CPU usage? At minimum, I'd like to use the above files and PHP calls, although I'm willing to do without the global.php and PHP echo() calls, if it would make a difference. Everything following this sentence is optional:

Next, I would like to use PHPNews, a program located at http://newsphp.sourceforge.net. Do you know if this uses a lot of CPU resources? It does use a MySQL database. Again, I can forego using this program, or any news program, if necessary, but I'd like to use it if it shouldn't be a problem. If it will be a problem, do you think finding a similar Perl program would be ok?

Finally, I also use a program called CJ Random Quote (http://www.hotscripts.com/Detailed/21571.html), simply to rotate text and show a random quote. This is a minor program to me.

As much as I love using PHP, is there another coding language I can use to do the same thing as PHP includes and echos, without overusing CPU resources? Thank you.
__________________
Jennifer (aka Amulet)
http://www.SassyDevil.com/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 03-21-05, 04:25 AM
DA Master DA Master is offline
Wannabe Coder
 
Join Date: Jun 2003
Location: Yorkshire
Posts: 116
Thanks: 0
Thanked 0 Times in 0 Posts
Your host must be pants, I have never known anyone have any problems with PHP and CPU resources. Especially on a dedicated server.
__________________
PHP Code:
<?php if(PHP_OS == 'Windows') { echo "Doh"; } ?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 03-21-05, 07:25 AM
Acecool's Avatar
Acecool Acecool is offline
Aspiring Coder
 
Join Date: Nov 2003
Posts: 506
Thanks: 0
Thanked 0 Times in 0 Posts
What you are doing shouldnt be causing high cpu load...

Its most likely somone else on the server..
__________________
Check Acecoolco.com for PHP Tutorials, and other tuts
If you plan on contacting me, please read this: Legal Terms & Conditions
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 03-21-05, 08:29 AM
bizzar528's Avatar
bizzar528 bizzar528 is offline
Community VIP
 
Join Date: Sep 2004
Location: Pennsylvania, US
Posts: 1,405
Thanks: 1
Thanked 0 Times in 0 Posts
They are taking advantage of you.

Do you have a lot of users? Tons of queries for your database??
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 03-21-05, 08:45 AM
bizzar528's Avatar
bizzar528 bizzar528 is offline
Community VIP
 
Join Date: Sep 2004
Location: Pennsylvania, US
Posts: 1,405
Thanks: 1
Thanked 0 Times in 0 Posts
OH... just surfing the rest of the forum, found this:

http://www.programmingtalk.com/showthread.php?t=17494

Nice linux hosting on a nice beefy box. Best part = FREE.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 03-21-05, 09:55 AM
moronovich moronovich is offline
Junior Code Guru
 
Join Date: Oct 2004
Posts: 460
Thanks: 0
Thanked 0 Times in 0 Posts
php is built on "shared nothing" architecture. what does this imply?
if php is assigned a task which invokes system calls and some external programs, php will let the external programs manage their memory need. php won't take part in the process. it only asks the program to do the query and then send back the result. some programs which consume considerable amount of memory are database server, archiving programs, image processor, etc.

there is also another type of high resource usage which is likely to occure. it's called inappropriate system design. it could cause ineffective (or even false) algorithm, infinite loop, poor coding, etc. anyway, the last shouldn't contribute much to your program. even if the program you write is poor, it will still execute fast. this is related to the "shared nothing" architecture and optimization behind zvm.

in your case, it's not about your php code. simple include and echo won't take much resource except there is something wrong in the included file. if you're not advanced enough to analyze which code/program was it, you can view your site stat by visiting your cpanel. get the most popular page in your site, check how much bandwith is spent by opening/visiting the page and then you should be able to decide whether or not your host is cheating on you.

regards,
__________________
just an ignorant noob with moronic solution...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 03-22-05, 01:45 AM
Amulet Amulet is offline
Newbie Coder
 
Join Date: Jun 2003
Location: Southern NJ
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP Downside--Solutions?

Besides the host who kicked me off their shared servers, another host (Web750.com) tells me I'd have to go on one of their managed dedicated hosts. But Hyve.com and BlueGravity.com are willing to work with me to solve any problems, so I'm likely to go with one of them, and keep the other one in mind if problems arise.

bizzar528, I'd only gotten my site back up a few months ago, and I hadn't figured out exactly what I was going to do with it yet. It's a personal site, so I didn't have users, and there was only one database, which was for PHPNews, and I had two short articles in there. Barely anything.

Acecool, I'm not saying you're wrong, but the host said it was my site. However, I never saw the log.

DA Master, it wasn't a dedicated server, it was a shared server. They said I'd have to sign up for their dedicated server if I continued using their service.

Moronovich, thank you for your advice and info. I'll check when I have a new host. I don't think anything was wrong in the included files; they were very simple files, consisting mostly of HTML.
__________________
Jennifer (aka Amulet)
http://www.SassyDevil.com/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #8 (permalink)  
Old 03-22-05, 03:29 AM
DA Master DA Master is offline
Wannabe Coder
 
Join Date: Jun 2003
Location: Yorkshire
Posts: 116
Thanks: 0
Thanked 0 Times in 0 Posts
I agree with moronovich, PHP is like MySQL just an application installed on the server. Plus shared servers should cope with a PHP include unless not enough memory is getting to the PHP parser. If this is the case then this is out of your hands.

I also agree with bizzar528, they are taking advantage of you, I have the feeling they haven't a clue whats happening.
__________________
PHP Code:
<?php if(PHP_OS == 'Windows') { echo "Doh"; } ?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #9 (permalink)  
Old 05-04-05, 05:41 AM
humet humet is offline
New Member
 
Join Date: May 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Hi,

I am having the same problem with my host (www.maxiehost.com). They banned a PHP Script I am using because it was using too much CPU on a shared server.

The script I am using is part of a gallery (http://smartor.is-root.com/viewtopic.php?t=3021), the script banned is to generate thumbnails by using GD. I posted on their forum and got responses saying that their scripts work fine with minimum CPU usage.

So I am just wondering what could be happening?

humet
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #10 (permalink)  
Old 05-06-05, 09:52 AM
jhughes71 jhughes71 is offline
Wannabe Coder
 
Join Date: Mar 2005
Posts: 103
Thanks: 0
Thanked 0 Times in 0 Posts
It's not the language that is a problem. It's what you do with it.
Visit the forums of the application and try to find out which module is causing the problems. It is possible you do not need that set of php scripts (module)

Be aware that in the Open Source model there are 'some' newbies submitting their contributions and fixes OR your using an alpha or beta version of code. Theses are not tested in a high load environment. Much of this code will be written for better operations. Fall back to an older version of newsphp and see if it helps.

Last edited by jhughes71; 05-06-05 at 09:52 AM. Reason: clarified sentence
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
2 profitable script sites for sale cms-master.com General Advertisements 3 07-03-07 11:17 AM
Mouseover with Single PHP page rjwebgraphix PHP 7 09-16-04 06:15 PM
HostNetway - Great Solutions that WILL fit everyone's needs, GUARANTEED TheNetway General Advertisements 0 06-11-04 12:55 AM
Triangle Solutions Ltd presents PHP Multiple Newsletters usmwf PHP 0 03-26-04 10:29 AM
100 Web Templates & 10 PHP Scripts for sale! HostersUK.co.uk General Advertisements 0 01-10-04 01:31 AM


All times are GMT -5. The time now is 10:58 AM.
vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.