1,576
edits
Changes
→Modify Wordpress Configuration File
== Modify Wordpress Configuration File ==
From your work with Wordpress in Assignment 1, you know you can simply upload the source code and the first time you load the webpage, you'll be asked for database connector information. However, Elastic Beanstalk applications are meant to be disposable. In A1, when you were adding that database connector info, it was being saved in a file called ''wp-config.php''. This is fine for that kind of setup, but in Elastic Beanstalk, changes made to static HTML or PHP ''are not saved it the Beanstalk application restarts'', which it will do often. Whenever the application restarts, it will load from the source zip file. If you did as in A1, you'd have to constantly re-enter your DB connector info every time you started up your Learner Lab environment.
We ''could'' add the DB connector info to '''wp-config.php''' manually before we upload the source code, but there's a much better way. We use environment variables to allow us to put all the info in the Elastic Beanstalk application wizard. That way, every time the application restarts and reloads from the source code zip, it'll then read our connector information from AWS. Read below for details and steps.
# In the local ''wordpress'' folder, find a file called: '''wp-config-sample.php'''
# Duplicate this file, and call it: '''wp-config.php'''