Welcome Guest ( Log In | Register )




                Web Hosting

 
Reply to this topicNew Topic
Server-friendly Php Scripts
arp240
post Mar 2 2005, 05:02 PM
Post #1


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 5
Joined: 2-March 05
Member No.: 2,862


Hi

I'm relativly new to php...
I'm interested in writing server-friendly php scripts and i was wandering in what cases php scripts are harmfull to server i runs on...
i was thinking about issues like:

* Which php functions are expensive from the point of view of server's performance and resources?

* What is considered to be a long array in php context if ,say, each record is 100 bytes long? (100+ element ? a few thousands?)

* Are there some assumptions that php programmer should avoid?
(comes to mind this example:http://il.php.net/register_globals )

* I working on my own little and simple database using b+ trees (index data structure). It is being written with php. The thing that warries me is disk access...
Will it be noticable for server or not dry.gif
For example, to serve forum page with 25 posts it will require ~30 disk access(each one preceded by appropriate seek operation) 25 of these are to read all 25 posts and the rest are for internal houskeeping.
I know that real databases will probably do even more work and take a lot more resources but the difference is that real db can handle the request asynchrounelsy(server can do other things in between) and real db executing much faster than parsing and iterpreting php script)

* I will be glad to hear anything else that i didn't think about...

thanks
Go to the top of the page
 
+Quote Post
jipman
post Mar 3 2005, 06:31 PM
Post #2


Pretty please?
Group Icon

Group: Members
Posts: 733
Joined: 28-November 04
From: Holland
Member No.: 1,552


It all depends on the server, if you have a good / fast strong server, it processes much faster. You can't give a hard limit of what is much, because that's different for each server.

I don't think you have to worry much, servers today are quite powerfull
Go to the top of the page
 
+Quote Post
ChronicLoser
post Mar 6 2005, 05:53 PM
Post #3


Premium Member
Group Icon

Group: Members
Posts: 240
Joined: 13-November 04
From: Arizona
Member No.: 1,356


hmm, i guess there are ways that php can be somewhat harmful to the server you run on, but like jipman said, I doubt that a code can mess with the server too much unless it is doing some infinite loop or something. They're pretty high-tech nowadays ^_^
Go to the top of the page
 
+Quote Post
coder2000
post Mar 8 2005, 01:39 AM
Post #4


Member [ Level 2 ]
Group Icon

Group: Members
Posts: 56
Joined: 24-December 04
Member No.: 1,874


The only real damage is from improperly permissioned or owned files. Register globals is only available from a server config so you can't turn it on from a script. Most databases cache the most used sql statements. Now I don't know how much that is done with MySQL but they aren't as taxing on a hdd as you might think.
Go to the top of the page
 
+Quote Post
arp240
post Mar 8 2005, 10:25 AM
Post #5


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 5
Joined: 2-March 05
Member No.: 2,862


Ok, thanks:)
Go to the top of the page
 
+Quote Post
Hercco
post Mar 9 2005, 08:46 PM
Post #6


Super Member
Group Icon

Group: Members
Posts: 595
Joined: 4-September 04
Member No.: 228


Well one thing that people often forgets when dealing with HTML (or whatever) outputting scripts is that which the scripts (program wise) are usually quite simple and with modern machines run very fast, but it's the I/O that is the slow thing.

So instead of doing like a million echo calls, it's faster to group your stuff together and do just few echos.
Go to the top of the page
 
+Quote Post

Reply to this topicNew Topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   7 Mitch666Holland 753 Yesterday, 08:28 AM
Last post by: jlhaslip
No New Posts   8 vujsa 1,763 27th December 2008 - 04:50 PM
Last post by: iG-nedd
No New Posts   11 sendto 6,982 26th December 2008 - 12:59 PM
Last post by: iG-nwaynge
No New Posts   1 veerumits 598 21st December 2008 - 06:26 AM
Last post by: TavoxPeru
No New Posts   10 Kardus 1,691 20th December 2008 - 02:31 PM
Last post by: wutske
No New Posts   1 ljj 362 6th December 2008 - 06:28 AM
Last post by: iG-mani
No new   30 FoRsAkEn 5,958 4th December 2008 - 05:09 AM
Last post by: iG-sandvirus/avisek
No New Posts   6 Jimmy89 1,321 26th November 2008 - 11:03 PM
Last post by: magiccode9
No New Posts   16 flippys 3,054 26th November 2008 - 02:53 PM
Last post by: ergoxsx
No New Posts   18 x2crazy4shadyx 2,508 16th November 2008 - 11:18 PM
Last post by: Guest
No New Posts   7 szupie 1,367 12th November 2008 - 05:47 PM
Last post by: Guest
No New Posts   4 lisha 306 10th November 2008 - 05:31 PM
Last post by: yordan
No New Posts 1 Atomic0 289 1st November 2008 - 10:16 AM
Last post by: BuffaloHELP
No New Posts   7 LegallyHigh 577 1st November 2008 - 06:57 AM
Last post by: Jezstarr
No New Posts 7 phdex 540 29th October 2008 - 07:05 AM
Last post by: Atomic0