Comments (7)
PCNTL should only be used in the CLI.
Per the docs:
Process Control should not be enabled within a web server environment and unexpected results may happen if any Process Control functions are used within a web server environment.
The behavior you are experiencing is because the process you are forking is the php-fpm process...which is always going to cause weird things to happen.
from fork.
@freekmurze May be worth adding a note in the README about this. Maybe even add a check like:
if (php_sapi_name() !== 'cli') {
throw new RuntimeException('Process forking is only supported in CLI mode');
}
from fork.
Doh! Sorry about this 🤦🏼♂️ Thanks for the info!
from fork.
We should definitely mention in the readme that it doesn't word in a web context.
I'm a bit torn what we should do when this code is executed in a web context: throw an exception like suggested or above, or silently execute all given closures without concurrency.
@brendt What do you think?
from fork.
Definitely throw an exception :) I'll make the necessary changes.
from fork.
Done: https://github.com/spatie/fork/releases/tag/1.0.1
from fork.
Sorry to comment on a closed issue.
function_exists('pcntl_fork')
returns true
in my browser. (At least, when using Valet)
from fork.
Related Issues (7)
- Compatibility with laravel octane Roadrunner
- Bug with unserialize big json from api with 200 items
- [ErrorException] unserialize(): Error at offset 219249 of 219250 bytes HOT 4
- using fork with pcntl_signal/pcntl_alarm
- Undefined array key 51266 HOT 1
- Terminating a process after its execution does not work correctly
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fork.