Setup Your Portable Dev Environment on Windows with PHP 8 & MySQL 8

Starting with Apache

To host a PHP site we again use it as module in the Apache web server. As suggested by PHP developers first download the latest version of Apache from https://www.apachelounge.com/download/. Unless there is a reason let’s say the 64 bit edition is the one to choose, compiled with Visual Studio 2019 (VS16).

Download Apache Web server
C:
+- wamp
+- apache
+- all the apache stuff like bin, conf, etc...

Add PHP to the server

The release candidate of PHP for Windows is available https://windows.php.net/qa/. There are multiple versions available — be sure to download a version that’s compatible with the former components: meaning a thread safe VC16 binary for 64 bit systems. The difference to Non Thread Safe binaries are explained in the left hand sidebar.

C:
+- wamp
+- apache
+- all the apache stuff like in, conf, etc...
+- htdocs (still empty)
+- php
+- all the php stuff like ext, extras and logs
+- tmp (still empty)

Running tests

After all configuration is done, let’s test if all works: Open the command line (Win+R) and change the directory to the Apache binary folder older

cd c:\wamp\apache\bin
httpd
<?php phpinfo(); ?>
PHP 8 (RC) up and running

What about the database?

MySQL runs seperately from the Apache server. The community edition of the database server is freely available at the MySQL Dev Site. In consistency with all other components download a 64 bit version which is the default by now. Choose the ZIP archive instead of the MSI installer as we want it to run as portable as the rest.

C:
+- wamp
+- apache
+- htdocs
+- mysql
+- php
+- tmp
C:\wamp\mysql\bin\my_print_defaults.exe
[mysqld]
port=3306
innodb_buffer_pool_size=998M
character-set-server=utf8
transaction_isolation = READ-COMMITTED
[client]
port=3306
mysql\bin\mysqld.exe --defaults-extra-file="my.ini"
bin\mysqld --initialize --console
bin\mysqld --initialize --basedir=c:\wamp\mysql --datadir=c:\wamp\mysql\data --console
bin\mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'YourPassword';

One more thing: the IDE

To begin coding, we recommend to use Visual Studio Code, which can be configured to run in Portable Mode as well. Just head over to https://code.visualstudio.com/download and grab a 64 bit copy of the ZIP file. Extract it to c:\wamp\vscode — you might be tempted to use code as directory name but we think that’s misleading. So the final setup of out wamp directory looks like this:

C:
+- wamp
+- apache
+- htdocs
+- mysql
+- php
+- tmp
+- vscode
+- my.ini
+- mysqld.bat

That’s it.

Thanks for reading and have fun with your dev environment. Best way to stay tuned is following us on Twitter. Comments are very welcome.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
OneBitAhead

OneBitAhead

The tech staff of OneBitAhead GmbH, putting the web stack to work. Here to discuss daily bits & bytes. #javascript #nodejs #webcomponents #rdbms #php