{"id":34613693,"url":"https://github.com/true-async/fpm","last_synced_at":"2026-05-26T06:32:25.492Z","repository":{"id":320246372,"uuid":"1081359394","full_name":"true-async/fpm","owner":"true-async","description":"FPM Docker","archived":false,"fork":false,"pushed_at":"2025-10-22T17:59:57.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-22T19:35:12.584Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/true-async.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-22T17:11:04.000Z","updated_at":"2025-10-22T18:00:01.000Z","dependencies_parsed_at":"2025-10-22T19:35:15.795Z","dependency_job_id":null,"html_url":"https://github.com/true-async/fpm","commit_stats":null,"previous_names":["true-async/fpm"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/true-async/fpm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/true-async%2Ffpm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/true-async%2Ffpm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/true-async%2Ffpm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/true-async%2Ffpm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/true-async","download_url":"https://codeload.github.com/true-async/fpm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/true-async%2Ffpm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33507935,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T03:12:49.672Z","status":"ssl_error","status_checked_at":"2026-05-26T03:12:47.976Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-24T14:19:26.027Z","updated_at":"2026-05-26T06:32:25.484Z","avatar_url":"https://github.com/true-async.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TrueAsync PHP with PHP-FPM and Nginx\n\nThis configuration allows you to run TrueAsync PHP in FPM mode with Nginx web server.\n\n## Files\n\n- `Dockerfile` - main Dockerfile for building PHP-FPM\n- `nginx.conf` - Nginx configuration\n- `php-fpm.conf` - main PHP-FPM configuration\n- `www.conf` - PHP-FPM pool configuration\n- `supervisord.conf` - supervisor configuration for process management\n- `docker-compose.yml` - Docker Compose file for easy deployment\n\n## Quick Start\n\n### Option 1: Docker Compose (recommended)\n\n```bash\n# Create directory for your application\nmkdir -p app\necho '\u003c?php phpinfo(); ?\u003e' \u003e app/index.php\n\n# Start the container\ndocker-compose up --build\n\n# Open in browser: http://localhost:8080\n```\n\n### Option 2: Plain Docker\n\n```bash\n# Build the image\ndocker build -t trueasync-fpm .\n\n# Run the container\ndocker run -d -p 8080:80 --name trueasync-fpm trueasync-fpm\n\n# Open in browser: http://localhost:8080\n```\n\n## Testing\n\nThe container includes several test files:\n\n1. **http://localhost:8080/** - Landing page with examples\n2. **http://localhost:8080/phpinfo.php** - Full PHPInfo\n3. **http://localhost:8080/async-test.php** - Basic TrueAsync tests\n4. **http://localhost:8080/async-parallel.php** - Parallel execution demo\n5. **http://localhost:8080/async-sleep.php** - Async sleep demo\n6. **http://localhost:8080/async-scraper.php** - Web scraping demo\n\nOr using curl:\n\n```bash\n# Check phpinfo\ncurl http://localhost:8080/phpinfo.php\n\n# Test TrueAsync\ncurl http://localhost:8080/async-test.php\n```\n\n## TrueAsync Code Examples\n\nCreate a file `app/my-async-test.php`:\n\n```php\n\u003c?php\n\nuse function Async\\spawn;\nuse function Async\\await;\nuse function Async\\awaitAll;\nuse function Async\\delay;\n\necho \"Starting async operations...\\n\";\n\n// Example 1: Simple spawn and await\n$coroutine = spawn(function() {\n    delay(1000); // 1 second\n    return \"Task completed!\";\n});\n\n$result = await($coroutine);\necho \"$result\\n\";\n\n// Example 2: Parallel execution\n$coroutines = [\n    spawn(fn() =\u003e delay(1000) ?? \"Task 1\"),\n    spawn(fn() =\u003e delay(1000) ?? \"Task 2\"),\n    spawn(fn() =\u003e delay(1000) ?? \"Task 3\"),\n];\n\n[$results, $exceptions] = awaitAll($coroutines);\nprint_r($results);\n\necho \"All done!\\n\";\n```\n\nTest it: http://localhost:8080/my-async-test.php\n\n## Configuration\n\n### PHP-FPM Pool (www.conf)\n\nMain process parameters:\n\n```ini\npm = dynamic\npm.max_children = 50        # Maximum processes\npm.start_servers = 5        # Starting number\npm.min_spare_servers = 5    # Minimum idle processes\npm.max_spare_servers = 35   # Maximum idle processes\n```\n\n### Nginx\n\nConfiguration is located in `nginx.conf`. Main settings:\n\n- Document root: `/var/www/html`\n- Socket: `/run/php-fpm/php-fpm.sock`\n- Timeouts increased to 300 seconds for async operations\n\n### PHP Configuration\n\nAdd your custom settings in `php.ini`:\n\n```bash\n# In docker-compose.yml, uncomment:\nvolumes:\n  - ./custom-php.ini:/etc/php.d/custom.ini\n```\n\nExample `custom-php.ini`:\n\n```ini\nmax_execution_time = 300\nmemory_limit = 256M\nupload_max_filesize = 50M\npost_max_size = 50M\n```\n\n## Logs\n\nView logs:\n\n```bash\n# All logs\ndocker-compose logs -f\n\n# PHP-FPM only\ndocker exec -it trueasync-fpm tail -f /var/log/php-fpm/error.log\n\n# Nginx only\ndocker exec -it trueasync-fpm tail -f /var/log/nginx/error.log\n```\n\n## Container Access\n\n```bash\n# Bash in container\ndocker exec -it trueasync-fpm bash\n\n# Check PHP version\ndocker exec -it trueasync-fpm php -v\n\n# Check extensions\ndocker exec -it trueasync-fpm php -m | grep async\n```\n\n## Production Settings\n\nFor production environments, it's recommended to:\n\n1. **Disable error display** (custom-php.ini):\n```ini\ndisplay_errors = Off\ndisplay_startup_errors = Off\nlog_errors = On\n```\n\n2. **Increase OPcache**:\n```ini\nopcache.enable=1\nopcache.memory_consumption=256\nopcache.interned_strings_buffer=16\nopcache.max_accelerated_files=20000\n```\n\n3. **Configure process limits** in `www.conf`:\n```ini\npm.max_children = 100\npm.start_servers = 10\npm.min_spare_servers = 10\npm.max_spare_servers = 50\n```\n\n4. **SSL/TLS** - add reverse proxy or modify nginx.conf\n\n## Troubleshooting\n\n### PHP-FPM not starting\n\n```bash\n# Check logs\ndocker logs trueasync-fpm\n\n# Check configuration\ndocker exec -it trueasync-fpm php-fpm -t\n```\n\n### Nginx 502 Bad Gateway\n\n```bash\n# Check if PHP-FPM is running\ndocker exec -it trueasync-fpm ps aux | grep php-fpm\n\n# Check socket\ndocker exec -it trueasync-fpm ls -la /run/php-fpm/\n```\n\n### Permission issues\n\n```bash\n# Check file ownership\ndocker exec -it trueasync-fpm ls -la /var/www/html\n\n# Fix if needed\ndocker exec -it trueasync-fpm chown -R www-data:www-data /var/www/html\n```\n\n## Stop and Cleanup\n\n```bash\n# Stop\ndocker-compose down\n\n# Stop and remove volumes\ndocker-compose down -v\n\n# Full cleanup\ndocker-compose down -v --rmi all\n```\n\n## Links\n\n- [TrueAsync GitHub](https://github.com/true-async/php-src)\n- [TrueAsync Extension](https://github.com/true-async/php-async)\n- [Nginx Documentation](https://nginx.org/en/docs/)\n- [PHP-FPM Documentation](https://www.php.net/manual/en/install.fpm.php)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrue-async%2Ffpm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrue-async%2Ffpm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrue-async%2Ffpm/lists"}