Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FrankenPHP Configuration Instructions #9932

Draft
wants to merge 4 commits into
base: 11.x
Choose a base branch
from

Conversation

olliescase
Copy link

@olliescase olliescase commented Oct 7, 2024

This PR adds a new section to the Octane documentation explaining how to configure PHP settings for FrankenPHP. It instructs users to create a php.ini file in the project root to override system-wide PHP settings.

@Cosnavel
Copy link

Cosnavel commented Oct 7, 2024

This really should be added to the docs. @olliescase and I searched hours to find a solution to increase frankenphp's memory limit

octane.md Outdated
<a name="frankenphp-configuration"></a>
## Configuring FrankenPHP

When using FrankenPHP with Laravel, note that the default system `php.ini` does not apply to the FrankenPHP worker environment. To configure PHP settings, create a `php.ini` file in your project's root directory:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not exact. The system default is taken into account, but FrankenPHP uses the default system path (hardcoded in the PHP source code) which is /lib/php.ini. Most distributions change this default path to /etc, hence the confusion.

If you use the static binary (default with Octane), you can use /lib/php.ini or the root directory of the project. If you use the Docker image, you should use $PHP_INI_DIR. If you compile PHP by yourself, you can specify the path you want by passing --with-config-file-path option to ./configure.

This is documented here: https://frankenphp.dev/docs/config/

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dunglas, I've rewritten to hopefully be a little more precise on this matter. Are you able to take a look and check if you think it covers it?

@taylorotwell taylorotwell marked this pull request as draft October 7, 2024 13:49
@olliescase olliescase marked this pull request as ready for review October 9, 2024 10:31
octane.md Outdated Show resolved Hide resolved
Co-authored-by: Kévin Dunglas <[email protected]>
@taylorotwell
Copy link
Member

I feel like this maybe doesn't belong in our documentation?

@taylorotwell taylorotwell marked this pull request as draft October 9, 2024 19:39
@olliescase
Copy link
Author

Sorry, been a pretty intense week. I disagree that this doesn't belong in the Laravel docs, because Laravel is explicitly supporting FrankenPHP. At the very least I think this should come down to a mention in the documentation. This is a vital piece of knowledge that everyone using Laravel with FrankenPHP should know (and beyond - be warned of).

I understand that its fairly logical to assume that the installed PHP's configuration won't apply to the standalone binary of FrankenPHP, but this is a facet that people making the switch won't necessarily realise the implications of.

Switching from Swoole to FrankenPHP is made out in the Laravel documentation to be as simple as doing the install command and changing the environment variable. This extra step that isn't needed for swoole (as it is just an extension installed on the system php).

This can cause some serious problems that are often not visible in dev/testing and only come to fruition in production when you deal with a more intensive load

@olliescase olliescase marked this pull request as ready for review October 15, 2024 08:29
@dunglas
Copy link
Contributor

dunglas commented Oct 15, 2024

For the record, we're working with the PHP Cli team to improve the default experience: crazywhalecc/static-php-cli#553

Once this PR is merged, maybe a simple note hinting that another php.ini than the system one is used would be enough?

@olliescase
Copy link
Author

Yeah, I think that would be good - this is perhaps a little verbose for the Larvel documentation - I can agree on that. But a small note.

Maybe an additional flag to the install command to be --ini that in combination with --server=frankenphp also creates an empty php.ini in the root of the laravel project? 🙂

A template along the lines of:

# Place your project-specific FrankenPHP ini variables here. Server-level configuration can be done in /usr/local/etc/php/php.ini
# For more information, see https://frankenphp.dev/docs/config/

(haven't invested much time towards an elegant wording)

I think this could make the process more elegant and also serve as an extra tidbit of in-code documentation to point people in the right direction.

@taylorotwell taylorotwell marked this pull request as draft October 15, 2024 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants