Jump to content


Photo

Active PHP script identification


  • Please log in to reply
4 replies to this topic

#1 sneskid

sneskid
  • Members
  • PipPipPip
  • Advanced Member
  • 38 posts

Posted 14 April 2006 - 04:42 AM

Do scripts that are already running have some sort of an internal ID that I can read?

Can scripts that are running talk to eachother?
In general, how hard is it to create a super global variable that all my scripts have access to and can manipulate?

I know you can define super globals in the ini file... but in my case I have no access to it.

#2 michaellunsford

michaellunsford
  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 14 April 2006 - 05:11 AM

PHP is more or less runtime -- i don't believe it is designed to stay in memory and run forever. More info is needed to properly answer your question, but here are a few ideas:

1. you could use sessions or cookies that each file can check -- this might be client global, but not really "global"

2. you could use a mysql database or comma separated file to store variables that all of your separate files could read. I would think this could be considered "global"



#3 sneskid

sneskid
  • Members
  • PipPipPip
  • Advanced Member
  • 38 posts

Posted 14 April 2006 - 05:37 AM

I will be using a DB like that, haul variables from script to script. But I wanted to know my options... checking a global variable would cost alot less than a query.

I've read articles where people run the PHP script as a "process". This was something they needed permission from their server host to do. If I run a PHP script in a loop that maybe indefinate... is it considered a process? Does a PHP script spawn a process?
Do PHP scripts have a run-time limitation, maybe defined in the ini file?

And a few quick questions:
Can a script invoke another PHP script to run on it's own?
Can the invoked script run without having a client to send data to? Basically be used to... say... manage database errors automatically or something.

#4 michaellunsford

michaellunsford
  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 14 April 2006 - 05:58 AM

PHP scripts are usually limited in your ini file to 30 or 60 seconds max execution time. You can have cron run a PHP script every minute if you want to. Check with your ISP (or in your control panel) to see if you can setup cron jobs.

#5 sneskid

sneskid
  • Members
  • PipPipPip
  • Advanced Member
  • 38 posts

Posted 14 April 2006 - 06:10 AM

What happens at the end of that time? Does execution just stop? The script could be doing something really critical...

Can you explain what is meant by running a PHP script as a process? Cause a process can be indefinate.
And one can always use set_time_limit(x)

I found the cron job thing, it looks usefull.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users