# Streams and Threads under Php

- Thread: https://externals.io/message/24212
- Original archive: https://news-web.php.net/php.internals/24212
- Started by Andrew Mather BT Std on 2006-06-25T21:45:02+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #24212 — Andrew Mather BT Std — 2006-06-25T21:45:02+00:00

URL: https://externals.io/message/24212#24212

I have a C++ based php-extension accessing a C++ based non-php .so data 
engine, which reads and writes using the open/read/write/close calls in 
fcntl.h. 

The non-php engine is reliable away from php, but when accessed via the
php extension, it works, but runs into two forms of errors:

a) seek/read/write errors - one moment it reads fine, the next it fails.

b) data corruption/variable switching - looks like variables are getting
confused as to their appropriate value, which smacks of a threading issue.

Regarding a) streams:

Must any file access either in an extension directly, or in a library or .so
object called by that extension, use php streams, to be safe? Or is there
a way to allow them to use native system calls, without the strange errors?

Regarding b) threads:

Is there a useful reference as to the threading model in zend/php, and/or
its relation to the apache threading model?

Cheers,

Andrew.
