HOME       >>       Programming

Server-friendly Php Scripts


arp240

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


jipman

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


ChronicLoser

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


coder2000

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.


arp240

Ok, thanks:)


Hercco

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.



VIEW DESKTOP VERSION REGISTERGET FREE HOSTING

Xisto.com offers Free Web Hosting to its Members for their participation in this Community. We moderate all content posted here but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 2001-2019 by Xisto Corporation. All Rights Reserved.