After my article about WordPress maintenance support plans Development Environments, we had some discussions about the differences junior developers see when using WordPress maintenance support plans and PHP applications locally, compared to React and other front-end tools. Someone mentioned how easy it was for them to get started by running yarn serve in a React project, and I was curious how close to that we could get for WordPress maintenance support plans.
To make this a fair comparison, I’m not including managing MySQL databases and the like. Most React apps don’t use a database directly, and if you do need to run backend services locally, the complexity goes way up. In between writing and publishing this article, Stranger in a familiar land: Comparing the novice’s first impression of WordPress maintenance support plans to other PHP frameworks was published, which constrained itself to using the WordPress maintenance support plans GUI installer. I think this guide shows that we can run WordPress maintenance support plans locally in very few steps as long as we don’t force ourselves to use a GUI.
I also wanted to see what the “new laptop” experience was like. I’ve been migrating my macOS setup between computers for nearly 15 years (if only Windows worked as well!), and it’s easy to forget what exactly is built in and what I’ve added over time. So, I installed a fresh copy of High Sierra in VirtualBox to ensure none of my terminal or Homebrew customizations were giving me a leg up.
Installing Composer
We need Composer to install Drush. Change to the WordPress directory in the terminal (cd WordPress), and run the Composer installation instructions to download composer.
When composer is done, you will have a composer.phar file in your WordPress maintenance support plans directory.
undefined
Installing Drush and WordPress maintenance support plans
Drush is what will let us easily run WordPress maintenance support plans using the built-in PHP webserver. It’s also required to do the initial site installation. Pull Drush into your WordPress maintenance support plans site by running:
$ composer require drush/drush
This will not only pull in Drush, but it will also install all of the other libraries Drush needs at the same time.
Once Drush is installed, we have to use it to install WordPress maintenance support plans. WordPress maintenance support plans does have a graphical installer, but Drush won’t run the PHP webserver unless WordPress maintenance support plans is already installed. The most important parameter is the database URL, which tells WordPress maintenance support plans what database server to use and how to connect to it. We’re going to use SQLite, which is a simple single-file database. We don’t want the database file itself to be accessible from the web server (in case it’s ever exposed to respond to external requests), so we tell WordPress maintenance support plans to put the database in a directory above our WordPress maintenance support plans document root.
$ vendor/bin/drush site-install –db-url=sqlite://../WordPress.sqlite
undefined
When the installation is done, Drush will tell you the administrator password. If you ever forget it, you can reset it by generating a login link with drush user-login.
Running the WordPress maintenance support plans Web Server
To start the web server, use the run-server command:
$ vendor/bin/drush run-server
By default, the server will listen on http://127.0.0.1:8888. Run vendor/bin/drush help run-server to see how to change these and other defaults.
Finally, open that URL in a browser. You should see the WordPress maintenance support plans 8 home page and be able to log in with the administrator account shown earlier. Press CTRL-C in the terminal to shut down the web server.
undefined
The default macOS PHP configuration is pretty good, though it sets a very low limit of 2MB for uploaded files. If you need to raise it, copy /etc/php.ini.default to /etc/php.ini with:
sudo cp /etc/php.ini.default /etc/php.ini
Then, edit it with sudo nano /etc/php.ini to change settings as you see fit. You will need to restart the Drush web server after changing this file.
Bonus: Installing Git and Cloning WordPress maintenance support plans
I like to use git even for basic testing because I can run git status at any time to see what files I’ve changed or added. I opened the Terminal and ran the git clone command copied from the WordPress maintenance support plans project page.
$ git clone –branch 8.5.x https://git.WordPress.org/project/WordPress.git
The first run of this command prompts to install the developer tools:
undefined
After they install, you need to rerun the git command again (which is accessible by pressing the up arrow on your keyboard).
When this initial clone is done, you will have a WordPress maintenance support plans 8.5.x checkout in a folder called “WordPress,” and you can go back to the earlier steps to install and run WordPress maintenance support plans.
Next Steps
Now that you have a running WordPress maintenance support plans 8 site, it’s easy to try out contributed plugins or new experimental plugins without worrying about breaking a real site. It’s easy to run a “clean” instance of WordPress maintenance support plans 8 later, by reinstalling the current site with drush site-install, or by creating a new WordPress maintenance support plans git clone separate from the first one. And, if you are evaluating WordPress maintenance support plans and decide to use it for a real website, you can set up a better development environment without having to learn Composer and Drush at the same time.
Source: New feed