Closed Thread Icon

Topic awaiting preservation: Can you tell a php file to run on the server, from another php file? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=22624" title="Pages that link to Topic awaiting preservation: Can you tell a php file to run on the server, from another php file? (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Can you tell a php file to run on the server, from another php file? <span class="small">(Page 1 of 1)</span>\

 
H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

posted posted 07-20-2004 02:16

Is this at all possible? I want to have one php file where i do something and press a button, then it tells another php file to run on the server - but separate from this file. So if it was doing something that took a long time it would just do it on the server by itself once called and i could close the page i called it from/turn off my pc etc.

Thanks

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 07-20-2004 05:39

http://us2.php.net/manual/en/ref.exec.php

Maybe you can fingure something out based on this. What it sounds like you want to do is run a program in the background. You might find it easier to do this with Perl or simply call a shell script to do whatever processing you need. But it is your call.

Dan @ Code Town

H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

posted posted 07-20-2004 07:48

Thanks War, youve been a big help today! Yeh it is just running a program in the background i guess... i guess it depends how the server is set up at my hosting too.

I wonder just in general with php i can probably upload a .bat file or .exe to my server and run it from within the php.mmm.. That shell execute could work too..

Im guessing tho ( i dont have an apache server at home) that when you run a php file on the server, its just like opening it in a browser?

DmS
Paranoid (IV) Inmate

From: Sthlm, Sweden
Insane since: Oct 2000

posted posted 07-20-2004 09:25

The php file is parsed & executed by the php engine at runtime, meaning as it's called through the webserver of your choice. It does not have to output anything to the browser though so it can run silently as well. Often the case when you call a php function periodically through cron jobs. Then you can simply tell cron to fire up lynx and go to the correct url and the script runs.

you can use the execute functions to start backgound things if you want, but only if the webhost allows it. should a bad guy get access to that functionality the host would be in a world of hurt.
/Dan

{cell 260}
-{ a vibration is a movement that doesn't know which way to go }-

H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

posted posted 07-20-2004 09:46

Yeh that makes sense... i guess i was thinking of running the php file rather than an executable since you can already run php files so it shouldnt be restricted... i guess it depends if that shell is enabled.


The reason i am doing this is actually for a hit counter.. As far as i can tell there are 2/3 ways to do a hit counter...

1-Count a hit everytime anyone views a page, even if its repetitive
2-Count unique hits (i guess log the ip in a database?)
3-I guess you could use cookies telling the script wether or not to count the page.

Now obviously 2 is the most accurate way to do it, however for what it is, 3 is probably sufficient. You would get count errors when someone cleared there cookies or for people that have cookies disabled of course.

Im not sure how other counters work but these are the ways i am considering. For option 2 rather than waste the users time accessing the database etc, i was going to just write their ip and page id to a temp file, and call another php file to run.. Then the user goes about loading the page instead of wating for the database etc...

I know its probably not a big wait, but its a nice exersise i would like to try.


So anyhow thats why im asking just for some insight

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 07-20-2004 18:14

Is there a reason not to just use the server logs? I mean the IP and page hits are being recorded there anyway.



.:[ Never resist a perfect moment ]:.

H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

posted posted 07-21-2004 01:29

Hmm i don't know about them, is that the same for all servers? Im on a windows hosting server, how do you access these logs?

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 07-21-2004 01:34

For access to the logs you would need to talk to your provider. They should be able to tell you where they are and how you can access them.

Dan @ Code Town

H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

posted posted 07-21-2004 02:13

Ahh k, i have sent them an email... I noticed a directory below the root of my site called logs, it has a bunch of subdirectories with names like 'W3SVC8855' but my access is denied to them

H][RO
Bipolar (III) Inmate

From: Australia
Insane since: Oct 2002

posted posted 07-21-2004 13:45

Well i got a response....

quote:
Hi,

Windows II6 won't let you download log files. We can create a permission to do so, but IIS6 will reset the permission the next time a log file is made. Unfortunatley, Microsoft seem to think log files should not be available.

Hope that helps.

Support.



=(

« BackwardsOnwards »

Show Forum Drop Down Menu