arp240 0 Report post Posted March 2, 2005 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://forums.xisto.com/no_longer_exists/) * 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 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 Share this post Link to post Share on other sites
jipman 0 Report post Posted March 3, 2005 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 Share this post Link to post Share on other sites
ChronicLoser 0 Report post Posted March 6, 2005 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 Share this post Link to post Share on other sites
coder2000 0 Report post Posted March 8, 2005 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. Share this post Link to post Share on other sites
arp240 0 Report post Posted March 8, 2005 Ok, thanks:) Share this post Link to post Share on other sites
Hercco 0 Report post Posted March 9, 2005 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. Share this post Link to post Share on other sites