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

Q: config.yml: Inject PHP settings into wp-config.php? #2744

Open
mcyzyk opened this issue Nov 2, 2024 · 4 comments
Open

Q: config.yml: Inject PHP settings into wp-config.php? #2744

mcyzyk opened this issue Nov 2, 2024 · 4 comments

Comments

@mcyzyk
Copy link

mcyzyk commented Nov 2, 2024

Hi! I have a massive 30+ GB WP Multisite backup that I'm trying to Restore into VVV (using the really handy WP All-In-One Migration plugin) and no matter what I do the Restore of the database stops at exactly 91 percent.

I'm thinking something is timing out somewhere.

And so, I've put the following in my VVV config.yml:

custom:
wp_type: subdirectory
wpconfig_constants:
WP_DEBUG: true
WP_DEBUG_LOG: true
WP_MEMORY_LIMIT: 1750M
WP_MAX_MEMORY_LIMIT: 1750M
WP_SET_TIME_LIMIT: 9999
WP_MAX_EXECUTION_TIME: 9999

  • php74

From what I'm reading, I should be able to inject PHP config overrides this way, via VVV config.yml into wp-config.php, no?

Once I have my Site up, I go to check its environment and it says "php80" and overrides nowhere to be found.

(I am trying to initially Restore into a php74 server so I can see what happens when I upgrade to php80. Our SysAdmin did this in Production last spring and there were exceptions thrown. I'm now trying to figure out what those were, but in a development environment.)

How can I inject PHP configuration overrides via my config.yml file?

How can I force php74 via my config.yml file?

Thanks,

Mark

@tomjn
Copy link
Member

tomjn commented Nov 2, 2024

@mcyzyk looks like the formatting of the config snippet got mangled as it wasn't in a code block, however:

  • you can't set PHP ini settings via config.yml
  • WP_MEMORY_LIMIT etc are WordPress constants, the custom site template provisioner can put those in wp-config.php but it's actually WordPress not VVV that's reading those and trying to change the PHP ini
  • You set the PHP version via php:, you'd only specify php74 or php80 if you were trying to use the old method with nginx_upstream. You should use the newer php: syntax, if you do not do this then it won't use that version of PHP when provisioning the site. It's also much easier.
  • If you don't tell VVV to install PHP 7.4 it won't use it even if you correctly specify that's what you want a site to use, VVV will show in the output a warning message that you tried to use a version of PHP that hasn't been installed, then it'll use the default PHP version so that the site has something to server PHP with

But importantly:

WP_MAX_MEMORY_LIMIT: 1750M

1.7GB is HUGE, and it should not be necessary. Additionally for a 30GB import you should not be using the browser, you should be using WP CLI or connecting directly to the database to do it. I would also note that your VM is only so big, if you don't have the allocated disk space it will get full, and you can't ask for 8GB if there's only 4GB of ram in the VM etc

@tomjn
Copy link
Member

tomjn commented Nov 2, 2024

I should also say, memory and time limits shouldn't apply to PHP CLI

@mcyzyk
Copy link
Author

mcyzyk commented Nov 2, 2024

So useful!

Wondering how to do this:

"If you don't tell VVV to install PHP 7.4 it won't use it even if you correctly specify that's what you want a site to use"

Searching...

@tomjn
Copy link
Member

tomjn commented Nov 2, 2024

"If you don't tell VVV to install PHP 7.4 it won't use it even if you correctly specify that's what you want a site to use"

It's in the official docs under changing PHP: https://varyingvagrantvagrants.org/docs/en-US/adding-a-new-site/changing-php-version/

VVV
VVV supports the php option in the sites section of config/config.yml to set the PHP version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants