Recently, I need to build a web site for some personal reason. One of my colleague suggested me to use WordPress. It is not only because WordPress is widely used, but PHP is the most beautiful programming language around the world. Althouth I can use cloud server directly, it is still a good practice to make sure everything work well before publishing. So a local environment is required for this purpose. It also provide lots of flexibilities to work offline.
XAMPP is a open source PHP development environment which contains Apache, MySQL, and PHP. It can help developers to establish environment very quick. Can be download from the officail site. For Mac OS, it is pretty easy to install via the .dmg file. Double click and drug to the Application directory.
When open XAMPP-VM, it may looks like in following figure. Click Start to start all the services.
PhpMyAdmin is a web based GUI for MySQL which is also come with XAMPP package. It is pretty easy to manage database using this. However, the VM version XAMPP is a little different with the traditional one. The service is not really host on the local machine. So http://192.168.64.2/phpmyadmin/ need to be used instead http://localhost/phpmyadmin/. And we also need to have remote access to this application.
As shown in the following figure, after click Mount -> Explore.
We can then modify the file /lampp/etc/extra/httpd-xampp.conf. After modified the following access control part, we can then access http://192.168.64.2/phpmyadmin/ properly.
# since XAMPP 1.4.3
Create a new DB name as wordpress for WordPress using PhpMyAdmin.
Download latest version of WordPress form https://wordpress.org/download/. Unzip the archive and move the folder wordpress to /lampp/htdocs/.
Rename the file wp-config-sample.php to wp-config.php, and then modify the MySQL settings.
/** The name of the database for WordPress */
This is a pretty important setp because when updating or downloading WordPress plugins or themes, FTP will required. However, if the direct file stream method is enabled, we can directly update everything from WordPress.
This is the last step, visit http://192.168.64.2/wordpress/ and enjoy your local WordPress.