Test
Test
Posts List
  1. Install XAMPP
    1. XAMPP(-VM) Configuration
      1. Visit PhpMyAdmin
      2. Create New DB for WordPress
  2. Install WordPress
    1. WordPress Configuration
    2. Enable FS_METHOD
    3. Almost Done

Setup WordPress Local Environment

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.

Install XAMPP

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.

XAMPP(-VM) Configuration

When open XAMPP-VM, it may looks like in following figure. Click Start to start all the services.
xampp-general
xampp-services

Visit PhpMyAdmin

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.

xampp-volumes

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.

1
2
3
4
5
6
7
8
# since XAMPP 1.4.3
<Directory "/opt/lampp/phpmyadmin">
AllowOverride AuthConfig Limit
Order allow,deny
Allow from all
Require all granted
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>

Create New DB for WordPress

Create a new DB name as wordpress for WordPress using PhpMyAdmin.

Install WordPress

Download latest version of WordPress form https://wordpress.org/download/. Unzip the archive and move the folder wordpress to /lampp/htdocs/.

WordPress Configuration

Rename the file wp-config-sample.php to wp-config.php, and then modify the MySQL settings.

1
2
3
4
5
6
7
8
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');

/** MySQL database username */
define('DB_USER', 'root');

/** MySQL database password */
define('DB_PASSWORD', '');

Enable FS_METHOD

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.

1
define('FS_METHOD', 'direct');

Almost Done

This is the last step, visit http://192.168.64.2/wordpress/ and enjoy your local WordPress.

Test
Thanks for testing~
  • Wechat Scan
  • Alipay Scan