khalilov
Jul 31 2008, 10:07 AM
I was in my village for the last two days so i did alot of PHP scripts and came up with some questions: 1-When a PHP script is run, the server is doing something. So am I using bandwidth in the process? If so how much, lets assume the script gets a row from a database and display it. Does the script use bandwidth equal to the size of the data desplayed or the data the script went through whiel searching the database. 2-I want a script to run every X minutes, how do i do that? 3-In a script, i call some data from the database having a same trait and put them in a table through a while loop. Now after the loop ends i want to use them again, can i put them in an aray or somethign while in the loop? 4-I want to make a countdown timer for my entier site, meaning it has to be in the database or something, also when it is viewed i want it to keep counting down , meaning the viewer doesn't need to refresh the page to see how much time is left. Also when the time hits 0 i want it to reset back to a value i set and i want a php script to be automatically run. I forgot the other questions , i'll add them later O-o
Reply
yordan
Jul 31 2008, 10:34 AM
QUOTE(khalilov @ Jul 31 2008, 12:07 PM)  1-When a PHP script is run, the server is doing something. So am I using bandwidth in the process? If so how much, lets assume the script gets a row from a database and display it. Does the script use bandwidth equal to the size of the data displayed or the data the script went through while searching the database. In fact, there are several types of bandwidth : memory, disk, network. Usually, for a web server, people are sensitive to network bandwidth. When your script is running, it uses cpu power, disk power and Ethernet power. The script uses cpu power and memory power simply in order to run. Your computer account probably has some limitations concerning the cpu power and the memory usage allowed to each user. The script uses network power when receiving data from you, and sending data to you. The data the script sends to you and receiving from you are the network bandwidth. While your script is reading data from the disks attached to the computer, it uses the disk bandwidth. You could imagine that a poorly designed php program reads several hundreds of gigabytes on the computer disks in order to retrieve a single byte data (for instance the question "is somebody else as poor as myself" can make read the whole salary data, and return a single value : "NO"). This uses several hundreds gigabytes from the disk bandwidth, and only one byte from the network bandwidth.
Reply
khalilov
Jul 31 2008, 02:13 PM
QUOTE(yordan @ Jul 31 2008, 01:34 PM)  In fact, there are several types of bandwidth : memory, disk, network. Usually, for a web server, people are sensitive to network bandwidth. When your script is running, it uses cpu power, disk power and Ethernet power. The script uses cpu power and memory power simply in order to run. Your computer account probably has some limitations concerning the cpu power and the memory usage allowed to each user. The script uses network power when receiving data from you, and sending data to you. The data the script sends to you and receiving from you are the network bandwidth. While your script is reading data from the disks attached to the computer, it uses the disk bandwidth. You could imagine that a poorly designed php program reads several hundreds of gigabytes on the computer disks in order to retrieve a single byte data (for instance the question "is somebody else as poor as myself" can make read the whole salary data, and return a single value : "NO"). This uses several hundreds gigabytes from the disk bandwidth, and only one byte from the network bandwidth. So are you saying the only effect is my site running slower O.o
Reply
wutske
Jul 31 2008, 02:53 PM
of course it will run slower. It's as in real life: Someone (a user) asks you (the server) to get a purple shirt (data) out of your closet (database). The words he sais when asking you and the purple shirt is what is being sent over the internet, nothing big actualy. Between the asking and returning the shirt, you go to your closet, open it, search between all your shirts, eventualy find the purple shirt and take the purple shirt, that is actualy what a database does, these are very basic tasks and usualy don't require a lot of time, you'll hardly notice that the site is slower (except if the database is realy huge, a lot of users are using the database and the script is poorly designed). Don't be afraid to loose a few miliseconds, you won't notice it. For your second question you might consider using cron jobs if your server is running linux.
Reply
khalilov
Jul 31 2008, 03:25 PM
QUOTE(wutske @ Jul 31 2008, 05:53 PM)  of course it will run slower. It's as in real life: Someone (a user) asks you (the server) to get a purple shirt (data) out of your closet (database). The words he sais when asking you and the purple shirt is what is being sent over the internet, nothing big actualy. Between the asking and returning the shirt, you go to your closet, open it, search between all your shirts, eventualy find the purple shirt and take the purple shirt, that is actualy what a database does, these are very basic tasks and usualy don't require a lot of time, you'll hardly notice that the site is slower (except if the database is realy huge, a lot of users are using the database and the script is poorly designed). Don't be afraid to loose a few miliseconds, you won't notice it.
For your second question you might consider using cron jobs if your server is running linux. I still haven't got a server, iam goan get hosted at astahost soon, is this possible in astahost?
Reply
toby
Jul 31 2008, 09:06 PM
Yes. 1. The only sort you have to care about is how much data is sent out from you, and generally html files are negliable. 2. Crontab, doable here. 3. Yes, learn loops and arrays of php. 4. I would suggest contrab for the server, and javascript for the users.
Reply
yordan
Jul 31 2008, 10:30 PM
QUOTE(toby @ Jul 31 2008, 11:06 PM)  2. Crontab, doable here. 4. I would suggest contrab for the server, and javascript for the users. Not so sure. Astahost sites are hosted on Linux systems. However, I'm pretty sure that currently, ssh is not allowed on the free hosting plans. And also, probably, cron.allow is only for admins. Regards Yordan
Reply
TavoxPeru
Aug 1 2008, 03:51 AM
QUOTE(khalilov @ Jul 31 2008, 05:07 AM)  2-I want a script to run every X minutes, how do i do that? You can do that with a crontab job, view the following topics for some information: QUOTE(khalilov @ Jul 31 2008, 05:07 AM)  3-In a script, i call some data from the database having a same trait and put them in a table through a while loop. Now after the loop ends i want to use them again, can i put them in an aray or somethign while in the loop? Yes, you can. QUOTE(khalilov @ Jul 31 2008, 05:07 AM)  4-I want to make a countdown timer for my entier site, meaning it has to be in the database or something, also when it is viewed i want it to keep counting down , meaning the viewer doesn't need to refresh the page to see how much time is left. Also when the time hits 0 i want it to reset back to a value i set and i want a php script to be automatically run. You can do that with PHP and plain Javascript, aditionally you can also use Ajax. View the following topic How To Create An Online Timed Test With PHP? for some ideas about it, and if you decide to use it please let me know if you want the code. Best regards,
Reply
toby
Aug 1 2008, 09:00 AM
Oh ok, I've seen cpanel with a crontab jobs section.
Reply
Similar Topics
Keywords : php, questions
- Xampp And Wampp Questions
(7)
Standard Time Questions
(0) Okay I noticed this wierd bug in my game, and I don't know why its doing this. CODE $stime
= date("d - m - Y G:m"); // if echo this it shows as HOUR:06 and only changed hte hour once every
hour, never changing minutes. $logtime = date("D M d G:m Y"); //It does it to that as well. Why
is it doing this? Is it a code error? A PHP Configuration error? Any hints? Thanks. EDIT: LOL. I
can' believe it. I used m instead of i. Well its fixed now /wink.gif"
style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />....
Looking for php, questions
|
*SIMILAR VIDEOS*
Searching Video's for php, questions
|
advertisement
|
|