ideasonpurpose / basic-wordpress-vagrant

A fast, easy to use WordPress Vagrant environment modeled after managed WordPress hosting platforms like WP Engine and Flywheel.
MIT License
25 stars 3 forks source link

Is it possible to change the PHP version? #12

Closed jgraup closed 8 years ago

jgraup commented 8 years ago

What it would take to modify the php version included here.

I wrote a bash script to modify this project and create clones with multiple versions of WordPress. A common folder was then copied to all versions to test how a plugin worked across the various WP installs. I'm curious if I could do the same with the PHP - 5.3, 5.4 & 5.5.

PWD (script directory)
├── common_folder
├── wp39-php55.dev
│   └── site/common_folder
├── wp42-php55.dev
│   └── site/common_folder
└── wp431-php55.dev
      └── site/common_folder

I realize the task to change the WP version was pretty straight forward. But maybe it is this easy?

# Path to Ansible task
yml=$(cat $base/$dirname/ansible/roles/wordpress/tasks/install.yml)

### REPLACE THE ANSIBLE WP VERSION w/OUR VERSION
wp_url_latest="https:\/\/wordpress.org\/latest.tar.gz"
wp_url_version="https://wordpress.org/wordpress-$VERSION.tar.gz"

echo "${yml/$wp_url_latest/$wp_url_version}" > $base/$dirname/ansible/roles/wordpress/tasks/install.yml
joemaller commented 8 years ago

The PHP version is baked into the vagrant box, but tweaking versions is kind of outside the scope of this project anyway. The goal here is to provide a stable WordPress environment similar to what's provided by managed WordPress hosts. Not having to worry about server software versions is an advantage of managed hosting.

That said, it would be very easy to install a different version of PHP. The PHP installation task in basic-wordpress-box already has placeholders for alternate versions of PHP. You could either copy that task into this project's Ansible playbook (which would likely add several minutes to vagrant up) or fork the whole box repo to generate your own box with a specific PHP version. The ideasonpurpose/basic-wordpress-box project has instructions on how to do that.

Also, while I want to enforce using the latest stable WordPress, it might be worth documenting how to specify another version. The vars/wordpress.yml file is actually a leftover from directly specifying the download, so that should be easy to implement as an option.

jgraup commented 8 years ago

Thanks! I was really just trying to earn some rep by answering a question on WordPress StackExchange but I obviously didn't have a clue. At the very least, attempting to modify the WP version taught me a ton about Bash and also how flexible this project can be. Thanks for giving me something to hack on.

joemaller commented 8 years ago

Awesome :smile:

Don't stop at Bash, Ansible is an incredible vehicle for learning more about configuring servers. I have learned a ton from using it.

jgraup commented 8 years ago

When is your next talk on Ansible? I've heard about vagrant for over a year but your short demo was able to get me up in running is minutes.