Jump to content

Archived

This topic is now archived and is closed to further replies.

sneskid

Active PHP script identification

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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"

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.