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

Site-type scripts not working vm php8.2 + enhancement suggestion #1881

Closed
vsmash opened this issue May 31, 2023 · 1 comment
Closed

Site-type scripts not working vm php8.2 + enhancement suggestion #1881

vsmash opened this issue May 31, 2023 · 1 comment

Comments

@vsmash
Copy link

vsmash commented May 31, 2023

Bug report & enhancement request

TLDR: php8.2 not compatible with site-type scripts

Versions

  • Vagrant: 2.3.4
  • Provider: Parallels 18.3.0 (53606)
  • Homestead: 14.4.1

Host operating system

OSX Ventura 13.3.1 (a) on Apple M1 chip

Actual behavior

vagrant up --provision hangs only when site-type scripts are used.
php 8.2 throws:
homestead: PHP Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///usr/local/bin/wp/vendor/rmccue/requests/library/Requests/Utility/CaseInsensitiveDictionary.php on line 51

then simply hangs at this line:
homestead: md5 hash verified: 7bc3c3122d8b89b7b5da8c94bda55f4e

Workaround

change vm php from 8.2 back to 8

vagrant ssh
php80

Enhancement suggestion

Enable nginx failover rewrite for wordpress uploads folder :

  1. add a prod variable in scripts/homestead.rb line 405
    s.args = [ site['map'], # $1 site['to'], # $2 site['port'] ||= http_port, # $3 site['ssl'] ||= https_port, # $4 site['php'] ||= '8.2', # $5 params ||= '', # $6 site['xhgui'] ||= '', # $7 site['exec'] ||= 'false', # $8 headers ||= '', # $9 rewrites ||= '', # $10 site['prod'] ||='' # $11 ]

  2. add rewrite to scripts/site-types/wordpress.sh (and any others):
    ` location ~*/wp-content/uploads {
    log_not_found off;
    try_files $uri @prod_site;
    }

    location @prod_site {
    rewrite ^/(.*)$ https://${11}/$1 redirect;
    }
    `

  3. to use, specify site type in yaml:
    eg:
    - map: vanillabeans.test to: /home/vagrant/sites/vanillabeans php: "8.1"
    type: "wordpress"
    prod: "https://vanillabeans.com"

Great product - thanks :)

Edit: I saw support for redirects but couldn't figure how ot use it in yaml

@svpernova09
Copy link
Contributor

Thanks, your enhancement suggestion is now available 98aa456

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

No branches or pull requests

2 participants