[{"data":1,"prerenderedAt":845},["ShallowReactive",2],{"navigation":3,"/docs/framework-guides/laravel/octane":221,"/docs/framework-guides/laravel/octane-surround":840},[4],{"title":5,"path":6,"stem":7,"children":8},"Docs","/docs","docs",[9,12,56,85,132,153,178,195,208],{"title":10,"path":6,"stem":11},"","docs/index",{"title":13,"path":14,"stem":15,"children":16,"icon":55},"Getting Started","/docs/getting-started","docs/1.getting-started/1.index",[17,19,23,27,31,35,39,43,47,51],{"title":18,"path":14,"stem":15},"Introduction",{"title":20,"path":21,"stem":22},"Container Basics","/docs/getting-started/container-basics","docs/1.getting-started/2.container-basics",{"title":24,"path":25,"stem":26},"Installation","/docs/getting-started/installation","docs/1.getting-started/3.installation",{"title":28,"path":29,"stem":30},"These Images vs Others","/docs/getting-started/these-images-vs-others","docs/1.getting-started/4.these-images-vs-others",{"title":32,"path":33,"stem":34},"Choosing an Image","/docs/getting-started/choosing-an-image","docs/1.getting-started/5.choosing-an-image",{"title":36,"path":37,"stem":38},"Default Configurations","/docs/getting-started/default-configurations","docs/1.getting-started/6.default-configurations",{"title":40,"path":41,"stem":42},"Upgrade Guide","/docs/getting-started/upgrade-guide","docs/1.getting-started/7.upgrade-guide",{"title":44,"path":45,"stem":46},"Changelog","/docs/getting-started/changelog","docs/1.getting-started/8.changelog",{"title":48,"path":49,"stem":50},"About","/docs/getting-started/about","docs/1.getting-started/9.about",{"title":52,"path":53,"stem":54},"Contributing","/docs/getting-started/contributing","docs/1.getting-started/99.contributing",false,{"title":57,"path":58,"stem":59,"children":60,"page":55},"Image Variations","/docs/image-variations","docs/2.image-variations",[61,65,69,73,77,81],{"title":62,"path":63,"stem":64},"CLI","/docs/image-variations/cli","docs/2.image-variations/cli",{"title":66,"path":67,"stem":68},"FPM","/docs/image-variations/fpm","docs/2.image-variations/fpm",{"title":70,"path":71,"stem":72},"FPM-Apache","/docs/image-variations/fpm-apache","docs/2.image-variations/fpm-apache",{"title":74,"path":75,"stem":76},"FPM-NGINX","/docs/image-variations/fpm-nginx","docs/2.image-variations/fpm-nginx",{"title":78,"path":79,"stem":80},"FrankenPHP","/docs/image-variations/frankenphp","docs/2.image-variations/frankenphp",{"title":82,"path":83,"stem":84},"Unit (Deprecated)","/docs/image-variations/unit","docs/2.image-variations/unit",{"title":86,"path":87,"stem":88,"children":89,"page":55},"Framework Guides","/docs/framework-guides","docs/3.framework-guides",[90,123],{"title":91,"icon":55,"defaultOpen":55,"path":92,"stem":93,"children":94,"page":55},"Laravel","/docs/framework-guides/laravel","docs/3.framework-guides/1.laravel",[95,99,103,107,111,115,119],{"title":96,"path":97,"stem":98},"Automations","/docs/framework-guides/laravel/automations","docs/3.framework-guides/1.laravel/1.automations",{"title":100,"path":101,"stem":102},"Task Scheduler","/docs/framework-guides/laravel/task-scheduler","docs/3.framework-guides/1.laravel/2.task-scheduler",{"title":104,"path":105,"stem":106},"Queue","/docs/framework-guides/laravel/queue","docs/3.framework-guides/1.laravel/3.queue",{"title":108,"path":109,"stem":110},"Horizon","/docs/framework-guides/laravel/horizon","docs/3.framework-guides/1.laravel/4.horizon",{"title":112,"path":113,"stem":114},"Reverb","/docs/framework-guides/laravel/reverb","docs/3.framework-guides/1.laravel/4.reverb",{"title":116,"path":117,"stem":118},"Nightwatch","/docs/framework-guides/laravel/nightwatch","docs/3.framework-guides/1.laravel/5.nightwatch",{"title":120,"path":121,"stem":122},"Octane","/docs/framework-guides/laravel/octane","docs/3.framework-guides/1.laravel/octane",{"title":124,"icon":55,"defaultOpen":55,"path":125,"stem":126,"children":127,"page":55},"WordPress","/docs/framework-guides/wordpress","docs/3.framework-guides/2.wordpress",[128],{"title":129,"path":130,"stem":131},"Using Docker with WordPress","/docs/framework-guides/wordpress/using-wordpress-with-docker","docs/3.framework-guides/2.wordpress/4.using-wordpress-with-docker",{"title":133,"path":134,"stem":135,"children":136,"page":55},"Deployment And Production","/docs/deployment-and-production","docs/4.deployment-and-production",[137,141,145,149],{"title":138,"path":139,"stem":140},"Development to Production","/docs/deployment-and-production/development-to-production","docs/4.deployment-and-production/2.development-to-production",{"title":142,"path":143,"stem":144},"Packaging Your App for Deployment","/docs/deployment-and-production/packaging-your-app-for-deployment","docs/4.deployment-and-production/3.packaging-your-app-for-deployment",{"title":146,"path":147,"stem":148},"Configuring SSL","/docs/deployment-and-production/configuring-ssl","docs/4.deployment-and-production/4.configuring-ssl",{"title":150,"path":151,"stem":152},"Choosing a Host","/docs/deployment-and-production/choosing-a-host","docs/4.deployment-and-production/5.choosing-a-host",{"title":154,"icon":55,"defaultOpen":55,"path":155,"stem":156,"children":157,"page":55},"Advanced Guides","/docs/guide","docs/5.guide",[158,162,166,170,174],{"title":159,"path":160,"stem":161},"Migrating from official PHP images","/docs/guide/migrating-from-official-php-images","docs/5.guide/1.migrating-from-official-php-images",{"title":163,"path":164,"stem":165},"Using Healthchecks With Laravel","/docs/guide/using-healthchecks-with-laravel","docs/5.guide/2.using-healthchecks-with-laravel",{"title":167,"path":168,"stem":169},"Using S6 Overlay","/docs/guide/using-s6-overlay","docs/5.guide/2.using-s6-overlay",{"title":171,"path":172,"stem":173},"Understanding File Permissions","/docs/guide/understanding-file-permissions","docs/5.guide/3.understanding-file-permissions",{"title":175,"path":176,"stem":177},"Configuring Trusted Proxies","/docs/guide/configuring-trusted-proxies","docs/5.guide/4.configuring-trusted-proxies",{"title":179,"icon":55,"defaultOpen":55,"path":180,"stem":181,"children":182,"page":55},"Customization","/docs/customizing-the-image","docs/6.customizing-the-image",[183,187,191],{"title":184,"path":185,"stem":186},"Changing php.ini settings","/docs/customizing-the-image/changing-common-php-settings","docs/6.customizing-the-image/1.changing-common-php-settings",{"title":188,"path":189,"stem":190},"Installing PHP extensions","/docs/customizing-the-image/installing-additional-php-extensions","docs/6.customizing-the-image/2.installing-additional-php-extensions",{"title":192,"path":193,"stem":194},"Adding Start Up Scripts","/docs/customizing-the-image/adding-your-own-start-up-scripts","docs/6.customizing-the-image/3.adding-your-own-start-up-scripts",{"title":196,"path":197,"stem":198,"children":199,"page":55},"Troubleshooting","/docs/troubleshooting","docs/7.troubleshooting",[200,204],{"title":201,"path":202,"stem":203},"Common Issues","/docs/troubleshooting/common-issues","docs/7.troubleshooting/1.common-issues",{"title":205,"path":206,"stem":207},"Getting Help","/docs/troubleshooting/getting-help","docs/7.troubleshooting/2.getting-help",{"title":209,"path":210,"stem":211,"children":212,"page":55},"Reference","/docs/reference","docs/8.reference",[213,217],{"title":214,"path":215,"stem":216},"Environment Variable Specification","/docs/reference/environment-variable-specification","docs/8.reference/1.environment-variable-specification",{"title":218,"path":219,"stem":220},"Command Reference","/docs/reference/command-reference","docs/8.reference/2.command-reference",{"id":222,"title":120,"body":223,"description":832,"extension":833,"links":834,"meta":835,"navigation":438,"path":121,"redirect":834,"seo":838,"stem":122,"__hash__":839},"docs/docs/3.framework-guides/1.laravel/octane.md",{"type":224,"value":225,"toc":818},"minimark",[226,233,238,241,248,254,260,264,267,282,287,290,367,370,374,377,409,416,540,543,547,550,566,708,711,727,731,734,748,755,759,762,766,775,779,788,792,814],[227,228,229],"lead-p",{},[230,231,232],"p",{},"Laravel Octane supercharges your application's performance by keeping it loaded in memory and serving requests at incredible speeds. The FrankenPHP variation of our images provides native Octane support with worker mode built-in.",[234,235,237],"h2",{"id":236},"what-is-laravel-octane","What is Laravel Octane?",[230,239,240],{},"Laravel Octane boots your Laravel application once and keeps it in memory, then processes thousands of requests without reloading. This dramatically improves performance compared to traditional PHP execution.",[230,242,243,247],{},[244,245,246],"strong",{},"Traditional PHP:","\nBootstrap → Handle Request → Teardown → Repeat for every request",[230,249,250,253],{},[244,251,252],{},"With Octane:","\nBootstrap once → Handle unlimited requests",[255,256,257],"tip",{},[230,258,259],{},"FrankenPHP is Laravel's recommended application server for Octane and is included natively in our images. No additional installation required.",[234,261,263],{"id":262},"quick-start","Quick Start",[230,265,266],{},"Let's use this example project to get started.",[268,269,272],"warning",{"target":270,"to":271},"_blank","https://serversideup.net/open-source/spin/docs",[230,273,274,275,281],{},"This example assumes you already have a Laravel application installed. If you need help installing a new Laravel project with Docker, check out ",[276,277,280],"a",{"href":271,"rel":278,"target":270},[279],"nofollow","Spin"," for a simple way to get started.",[283,284,286],"h3",{"id":285},"classic-mode","Classic Mode",[230,288,289],{},"By default, FrankenPHP runs in classic mode. Your compose file might look something like this:",[291,292,297],"pre",{"className":293,"code":294,"filename":295,"language":296,"meta":10,"style":10},"language-yml shiki shiki-themes github-dark","services:\n  php:\n    image: serversideup/php:8.5-frankenphp\n    ports:\n      - \"80:8080\"\n    volumes:\n      - .:/var/www/html/\n","compose.yml","yml",[298,299,300,313,321,334,342,351,359],"code",{"__ignoreMap":10},[301,302,305,309],"span",{"class":303,"line":304},"line",1,[301,306,308],{"class":307},"s4JwU","services",[301,310,312],{"class":311},"s95oV",":\n",[301,314,316,319],{"class":303,"line":315},2,[301,317,318],{"class":307},"  php",[301,320,312],{"class":311},[301,322,324,327,330],{"class":303,"line":323},3,[301,325,326],{"class":307},"    image",[301,328,329],{"class":311},": ",[301,331,333],{"class":332},"sU2Wk","serversideup/php:8.5-frankenphp\n",[301,335,337,340],{"class":303,"line":336},4,[301,338,339],{"class":307},"    ports",[301,341,312],{"class":311},[301,343,345,348],{"class":303,"line":344},5,[301,346,347],{"class":311},"      - ",[301,349,350],{"class":332},"\"80:8080\"\n",[301,352,354,357],{"class":303,"line":353},6,[301,355,356],{"class":307},"    volumes",[301,358,312],{"class":311},[301,360,362,364],{"class":303,"line":361},7,[301,363,347],{"class":311},[301,365,366],{"class":332},".:/var/www/html/\n",[230,368,369],{},"We'll expand upon this classic mode file and modify it to run Laravel Octane (which uses FrankenPHP's worker mode).",[283,371,373],{"id":372},"install-laravel-octane","Install Laravel Octane",[230,375,376],{},"First, install Octane in your Laravel application:",[291,378,383],{"className":379,"code":380,"filename":381,"language":382,"meta":10,"style":10},"language-bash shiki shiki-themes github-dark","docker compose run php composer require laravel/octane\n","Terminal","bash",[298,384,385],{"__ignoreMap":10},[301,386,387,391,394,397,400,403,406],{"class":303,"line":304},[301,388,390],{"class":389},"svObZ","docker",[301,392,393],{"class":332}," compose",[301,395,396],{"class":332}," run",[301,398,399],{"class":332}," php",[301,401,402],{"class":332}," composer",[301,404,405],{"class":332}," require",[301,407,408],{"class":332}," laravel/octane\n",[230,410,411,412,415],{},"When that command runs, you should see a PHP file that Laravel creates in your ",[298,413,414],{},"/public"," directory. This is required for Laravel Octane to work.",[291,417,422],{"className":418,"code":419,"filename":420,"language":421,"meta":10,"style":10},"language-php shiki shiki-themes github-dark","\u003C?php\n\n// Set a default for the application base path and public path if they are missing...\n$_SERVER['APP_BASE_PATH'] = $_ENV['APP_BASE_PATH'] ?? $_SERVER['APP_BASE_PATH'] ?? __DIR__.'/..';\n$_SERVER['APP_PUBLIC_PATH'] = $_ENV['APP_PUBLIC_PATH'] ?? $_SERVER['APP_BASE_PATH'] ?? __DIR__;\n\nrequire __DIR__.'/../vendor/laravel/octane/bin/frankenphp-worker.php';\n\n","public/frankenphp-worker.php","php",[298,423,424,434,440,446,491,522,526],{"__ignoreMap":10},[301,425,426,430],{"class":303,"line":304},[301,427,429],{"class":428},"snl16","\u003C?",[301,431,433],{"class":432},"sDLfK","php\n",[301,435,436],{"class":303,"line":315},[301,437,439],{"emptyLinePlaceholder":438},true,"\n",[301,441,442],{"class":303,"line":323},[301,443,445],{"class":444},"sAwPA","// Set a default for the application base path and public path if they are missing...\n",[301,447,448,451,454,457,460,463,465,467,470,473,475,477,479,482,485,488],{"class":303,"line":336},[301,449,450],{"class":311},"$_SERVER[",[301,452,453],{"class":332},"'APP_BASE_PATH'",[301,455,456],{"class":311},"] ",[301,458,459],{"class":428},"=",[301,461,462],{"class":311}," $_ENV[",[301,464,453],{"class":332},[301,466,456],{"class":311},[301,468,469],{"class":428},"??",[301,471,472],{"class":311}," $_SERVER[",[301,474,453],{"class":332},[301,476,456],{"class":311},[301,478,469],{"class":428},[301,480,481],{"class":432}," __DIR__",[301,483,484],{"class":428},".",[301,486,487],{"class":332},"'/..'",[301,489,490],{"class":311},";\n",[301,492,493,495,498,500,502,504,506,508,510,512,514,516,518,520],{"class":303,"line":344},[301,494,450],{"class":311},[301,496,497],{"class":332},"'APP_PUBLIC_PATH'",[301,499,456],{"class":311},[301,501,459],{"class":428},[301,503,462],{"class":311},[301,505,497],{"class":332},[301,507,456],{"class":311},[301,509,469],{"class":428},[301,511,472],{"class":311},[301,513,453],{"class":332},[301,515,456],{"class":311},[301,517,469],{"class":428},[301,519,481],{"class":432},[301,521,490],{"class":311},[301,523,524],{"class":303,"line":353},[301,525,439],{"emptyLinePlaceholder":438},[301,527,528,531,533,535,538],{"class":303,"line":361},[301,529,530],{"class":428},"require",[301,532,481],{"class":432},[301,534,484],{"class":428},[301,536,537],{"class":332},"'/../vendor/laravel/octane/bin/frankenphp-worker.php'",[301,539,490],{"class":311},[230,541,542],{},"It is safe to commit this file to your repository.",[283,544,546],{"id":545},"configure-worker-mode","Configure Worker Mode",[230,548,549],{},"We now want to update the compose file to run Laravel Octane and use proper health checks.",[551,552,553],"note",{},[230,554,555,556,559,560,565],{},"Laravel Octane provides its own Caddyfile. This may cause some of the serversideup/php environment variables to not be respected (mainly any ",[298,557,558],{},"CADDY_*"," variables). Be sure to review the ",[276,561,564],{"href":562,"rel":563,"target":270},"https://github.com/laravel/octane/blob/2.x/src/Commands/stubs/Caddyfile",[279],"official Laravel Octane Caddyfile"," for which variables are supported.",[291,567,576],{"className":293,"code":568,"filename":295,"highlights":569,"language":296,"meta":10,"style":10},"services:\n  php:\n    image: serversideup/php:8.5-frankenphp\n    ports:\n      - \"80:8080\"\n    volumes:\n      - .:/var/www/html/\n    # Start Octane in worker mode\n    command: [\"php\", \"artisan\", \"octane:start\", \"--server=frankenphp\", \"--port=8080\"]\n    # Set healthcheck to use our native healthcheck script for Octane\n    healthcheck:\n      test: [\"CMD\", \"healthcheck-octane\"]\n      start_period: 10s\n",[570,571,572,573,574,575],8,9,10,11,12,13,[298,577,578,584,590,598,604,610,616,622,629,665,671,679,697],{"__ignoreMap":10},[301,579,580,582],{"class":303,"line":304},[301,581,308],{"class":307},[301,583,312],{"class":311},[301,585,586,588],{"class":303,"line":315},[301,587,318],{"class":307},[301,589,312],{"class":311},[301,591,592,594,596],{"class":303,"line":323},[301,593,326],{"class":307},[301,595,329],{"class":311},[301,597,333],{"class":332},[301,599,600,602],{"class":303,"line":336},[301,601,339],{"class":307},[301,603,312],{"class":311},[301,605,606,608],{"class":303,"line":344},[301,607,347],{"class":311},[301,609,350],{"class":332},[301,611,612,614],{"class":303,"line":353},[301,613,356],{"class":307},[301,615,312],{"class":311},[301,617,618,620],{"class":303,"line":361},[301,619,347],{"class":311},[301,621,366],{"class":332},[301,623,626],{"class":624,"line":570},[303,625],"highlight",[301,627,628],{"class":444},"    # Start Octane in worker mode\n",[301,630,632,635,638,641,644,647,649,652,654,657,659,662],{"class":631,"line":571},[303,625],[301,633,634],{"class":307},"    command",[301,636,637],{"class":311},": [",[301,639,640],{"class":332},"\"php\"",[301,642,643],{"class":311},", ",[301,645,646],{"class":332},"\"artisan\"",[301,648,643],{"class":311},[301,650,651],{"class":332},"\"octane:start\"",[301,653,643],{"class":311},[301,655,656],{"class":332},"\"--server=frankenphp\"",[301,658,643],{"class":311},[301,660,661],{"class":332},"\"--port=8080\"",[301,663,664],{"class":311},"]\n",[301,666,668],{"class":667,"line":572},[303,625],[301,669,670],{"class":444},"    # Set healthcheck to use our native healthcheck script for Octane\n",[301,672,674,677],{"class":673,"line":573},[303,625],[301,675,676],{"class":307},"    healthcheck",[301,678,312],{"class":311},[301,680,682,685,687,690,692,695],{"class":681,"line":574},[303,625],[301,683,684],{"class":307},"      test",[301,686,637],{"class":311},[301,688,689],{"class":332},"\"CMD\"",[301,691,643],{"class":311},[301,693,694],{"class":332},"\"healthcheck-octane\"",[301,696,664],{"class":311},[301,698,700,703,705],{"class":699,"line":575},[303,625],[301,701,702],{"class":307},"      start_period",[301,704,329],{"class":311},[301,706,707],{"class":332},"10s\n",[230,709,710],{},"We make two major changes here:",[712,713,714,721],"ol",{},[715,716,717,720],"li",{},[244,718,719],{},"Set the command to start Octane in worker mode"," - Instead of starting FrankenPHP in classic mode, we start Octane in worker mode.",[715,722,723,726],{},[244,724,725],{},"Set the healthcheck to use our native healthcheck script for Octane"," - This is important to ensure that Octane is running and healthy.",[283,728,730],{"id":729},"testing-locally","Testing Locally",[230,732,733],{},"Run your application locally to test Octane:",[291,735,737],{"className":379,"code":736,"filename":381,"language":382,"meta":10,"style":10},"docker compose up\n",[298,738,739],{"__ignoreMap":10},[301,740,741,743,745],{"class":303,"line":304},[301,742,390],{"class":389},[301,744,393],{"class":332},[301,746,747],{"class":332}," up\n",[230,749,750,751,754],{},"Your Laravel application will be available at ",[298,752,753],{},"http://localhost"," with Octane running in worker mode.",[234,756,758],{"id":757},"things-to-watch-out-for","Things to Watch Out For",[230,760,761],{},"Since Octane is a whole different way of running Laravel compared to traditional PHP-FPM, there are a few things to watch out for.",[283,763,765],{"id":764},"dependency-injection","Dependency Injection",[230,767,768,769,774],{},"Be careful with how you inject dependencies into long-lived objects. Injecting the wrong things into constructors can cause requests to \"leak\" between users. Review Laravel's ",[276,770,773],{"href":771,"rel":772},"https://laravel.com/docs/12.x/octane#dependency-injection-and-octane",[279],"Dependency Injection and Octane"," documentation for details.",[283,776,778],{"id":777},"memory-leaks","Memory Leaks",[230,780,781,782,787],{},"Review Laravel's ",[276,783,786],{"href":784,"rel":785},"https://laravel.com/docs/12.x/octane#managing-memory-leaks",[279],"Octane documentation on memory leaks"," to understand what to avoid.",[234,789,791],{"id":790},"learn-more","Learn More",[793,794,795,800,807],"ul",{},[715,796,797],{},[276,798,799],{"href":79},"FrankenPHP Variation Documentation",[715,801,802],{},[276,803,806],{"href":804,"rel":805},"https://laravel.com/docs/12.x/octane",[279],"Laravel Octane Documentation",[715,808,809],{},[276,810,813],{"href":811,"rel":812},"https://frankenphp.dev/docs/",[279],"FrankenPHP Documentation",[815,816,817],"style",{},"html pre.shiki code .s4JwU, html code.shiki .s4JwU{--shiki-default:#85E89D}html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}html pre.shiki code .snl16, html code.shiki .snl16{--shiki-default:#F97583}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}html pre.shiki code .sAwPA, html code.shiki .sAwPA{--shiki-default:#6A737D}",{"title":10,"searchDepth":315,"depth":315,"links":819},[820,821,827,831],{"id":236,"depth":315,"text":237},{"id":262,"depth":315,"text":263,"children":822},[823,824,825,826],{"id":285,"depth":323,"text":286},{"id":372,"depth":323,"text":373},{"id":545,"depth":323,"text":546},{"id":729,"depth":323,"text":730},{"id":757,"depth":315,"text":758,"children":828},[829,830],{"id":764,"depth":323,"text":765},{"id":777,"depth":323,"text":778},{"id":790,"depth":315,"text":791},"Learn how to configure Laravel Octane with Docker.","md",null,{"head":836,"layout":7},{"title":837},"Laravel Octane with Docker - Docker PHP - Server Side Up",{"title":120,"description":832},"j1jAs3R0jCgNMzv90UotUfAk-ZW5tmLWgXpMBazY9zA",[841,843],{"title":116,"path":117,"stem":118,"description":842,"children":-1},"Learn how to configure Laravel Nightwatch with Docker.",{"title":129,"path":130,"stem":131,"description":844,"children":-1},"Learn how serversideup/php is optimized for running WordPress in production.",1776367063241]