FerryAI is a library in your PHP process; "deployment" means making the native libraries and models available and tuning the runtime.
- PHP 8.3+ with
ext-ffienabled (ffi.enable=1inphp.ini; for CLI it is usually on). - The native shared libraries a feature needs, on
PATH(Windows) /LD_LIBRARY_PATH(Linux): ONNX Runtime,ferry_llama.dll+ llama/ggml DLLs, sqlite-vec, etc. See the Dependencies & downloads matrix. - Models placed on disk; point config at them (never bundle in the image unless intended).
- Reuse the process: model loading is expensive. FerryAI pools models (
AI::warmup()+ModelPool) and caches embedders, so a long-lived worker loads each model once. - Shared weights: set
model_pool.shared_memory=true(needsext-shmop) to share read-only weights across workers. - Memory: keep
model_pool.max_memory_byteswithin the worker's limit; large GGUF/ONNX models useStreamLoader/mmap so they are not fully copied into PHP memory.
Ship a CUDA-enabled build (ONNX Runtime GPU or a llama.cpp CUDA build) plus the NVIDIA CUDA
Toolkit and cuDNN on the host, and set device: cuda. Supported for llama.cpp on Windows and Linux.
For SSE, disable buffering: PHP (ob_end_flush), FPM, and the proxy
(X-Accel-Buffering: no for Nginx). See streaming.
composer check (cs-fix + PHPStan L8 + Psalm L3 + unit tests) is the gate. Native integration
tests require the libraries/models and are skipped otherwise (FERRY_AI_SKIP_NATIVE=1).
Supported target for Linux.