Re: [PHP] spawing new PHP process

2002-11-27 Thread Geranium
In article [EMAIL PROTECTED], Robert McPeak
[EMAIL PROTECTED] wrote:

 I have other situations where I would like to somehow spawn a new php
 process so that the page loads quickly and my user doesn't get frustrated or
 confused.

Hang on, there's lots of talking around the point here. This is not
hard. Look in the manual under pcntl_fork. This will let you create a
separate process that stays running all the time (not just when you're
running a web page) and you can send commands to either using
pcntl_signal (docs are out of date - also look up ticks) or through
your database. You will need to have the CGI version of PHP installed,
as well as mod_php - and in 4.3 this happens very easily.

Having said all that, I've run into a separate probem further down the
road doing just what you're wanting to do. My back-end process runs
perfectly with no problems but after 5 mins or so starts generating
chunk/page already free errors, then crashes. Looks to be a bug in
there somewhere, but not sure where yet.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Building PHP extensions for MacOS X

2002-10-24 Thread Geranium
I need to build a PHP extension that also talks to parts of the MacOS X
API/frameworks. I could build simple, generic extensions in gcc, but
for OS X APIs, I need to use something a bit bigger.

Can anybody give me any tips of how to build PHP extensions in
CodeWarrior or ProjectBuilder on MacOS X? Or perhaps a link to
somewhere that might help?

Thanks

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] sysvshm examples?

2002-10-07 Thread Geranium

Can anyone point me at some examples of using sysv shared memory,
particularly for passing values between a mod_php script and a PHP CLI
process?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Signal handling

2002-10-07 Thread Geranium

Is signal handling broken in PHP 4.3-cvs? I've set up some handlers as
per the docs, but nothing happens when I send appropriate signals.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Getting local domain name in CLI

2002-08-29 Thread Geranium

I need to get the domain name of the local machine.
I'm running a CLI script in PHP 4.3-cvs (on OpenBSD) so I have no HTTP
or other global vars to look at. The posix_uname command doesn't
include the domain on non-GNU OSs. I can get the hostname, but not the
domain. Can I get it through some other PHP command? I'd really prefer
not to resort to rummaging in /etc and parsing files or doing something
silly like a DNS lookup...

Any ideas?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] sysvshm examples?

2002-08-29 Thread Geranium

Can anyone point me at some examples of using sysv shared memory,
particularly for passing values between a mod_php script and a PHP CLI
process?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] PHP and Transactions with InnoDB

2002-08-29 Thread Geranium

I could use some practical tips on doing transactions with InnoDB
tables in MySQL.

I want to grab and lock a record and do a whole load of related stuff,
then make sure everything is updated in a consistent way, something
like this skeleton:

BEGIN

SELECT * from blah WHERE something=n FOR UPDATE //Grab and lock a record

SELECT * from t1, t2 where a=1 ...

INSERT blah...

UPDATE something else...

if ($allok)
   COMMIT
else
   ROLLBACK

I don't quite get what I need to do to make sure these are all regarded
as part of the same transaction. Does the transation apply to all
queries made between the begin and commit (I assume so)? What happens
when I have another process doing the same thing at the same time?
Do I need to keep the result value I get from the begin query and
somehow use it for the commit at the end so MySQL knows they are two
ends of the same transaction? Or does MySQL somehow track that for me -
i.e. can there only be one transaction in progress per connection?

I'm finding the MySQL docs are extremely dry and somewhat short on
examples...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP and Transactions with InnoDB

2002-08-29 Thread Geranium

In article [EMAIL PROTECTED],
Miles Thompson [EMAIL PROTECTED] wrote:

 I've not worked with InnoDb, but given that the web is a stateless space 
 and all kinds of things can happen, I'd be very reluctant to lock a record 
 until the very moment I'm updating it. In other words, when I have my batch 
 of updates and inserts ready to go, then I'd begin by transaction, execute 
 them, and do a commit or a rollback.

I should have mentioned: it's not actually running behind a web process
but as a stand-alone CLI process in PHP 4.3-cvs, so it's not quite as
subject to the vagaries of web accesses. At the moment there's really
only one process involved, but I'm intending to expand it later, hence
this query.

I see what you're saying, but the problem I have is that the results of
the intermediate queries are dependent on me having control of the
master record, i.e. If I make them without the master record being
locked, by the time it comes to posting them back to the database, they
may be meaningless, so I need to make sure that the state of the
database is consistent throughout all the queries, as if I was the only
client. Isn't this the whole point of transactions?

Is ther any particular problem with having transactions that take a
while, say 10-20 seconds overall?

I suspect I'm just not quite clear on exactly the relationship between
record locking and transactions.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Getting local domain name in CLI

2002-08-29 Thread Geranium

In article [EMAIL PROTECTED],
Philip Hallstrom [EMAIL PROTECTED] wrote:

 What about...
 
 $hostname = `/bin/hostname`;
 
 or something along those lines...

Well that's rather the kind of thing I was wanting to avoid - it's much
akin to rummaging in /etc.

the hostname command gives me my hostname ONLY (like www), much as
the posix_uname function does, but on my system (OpenBSD 3.1) the
corresponding domainname utility returns nothing (as I'm not using YP),
so I still can't seem to find this out from PHP. This seems very silly!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php