Setting up a Windows PHP development environment

3 Minute(s) to read

Setting up a local development environment for PHP on Windows has proven to be tricky if you're using an existing web-server package such as XAMPP or WAMP.

For my own personal configuration I use a combination of the following:

  • NGINX
    • A high-availability web server with integrated load-balancing features.
  • PHP 7.2
    • Server-sided scripting language interpreter.
  • MariaDB
    • Database server.

Tools

Local PHP development on Windows (10+) is best suited to an IDE like Visual Studio Code. It's free, open-source, and has great out-of-the-box support for PHP, with even better and community supported extensions for the language.

Download Visual Studio Code

Extensions

Next you are going to want to install some extensions for Visual Studio Code. I recommend installing these for PHP syntax highlighting, linting, and debugging.

Debugging PHP on Windows (10+) works best with the following extensions for both PHP, and Visual Studio Code.

felixfbecker.php-debug
felixfbecker.php-intellisense
ikappas.phpcs
junstyle.php-cs-fixer
linyang95.php-symbols

You can get the extensions from the following links:

PHP

XDebug

I strongly recommend using XDebug, as Visual Studio Code can support breakpoint debugging through the usage of an extension that is available here.

Create a basic script with the following code.

<?php

echo phpinfo();

Navigate to the page, and make sure that the script executes.

Copy the entire page contents and then paste it into this useful tool. The page will then inform you of which version of XDebug you should use for your installation of PHP.

Next, place the downloaded DLL into the following directory.

Change your php.ini configuration file to reflect the following.

extension=curl
extension=fileinfo
zend_extension=php_xdebug-2.6.1-7.2-vc15-x86_64.dll
extension=gd2
extension=gettext
;extension=gmp
extension=intl
;extension=imap
;extension=interbase
;extension=ldap
extension=mbstring
extension=exif; Must be after mbstring as it depends on it
extension=mysqli
;extension=oci8_12c  ; Use with Oracle Database 12c Instant Client
extension=openssl
;extension=pdo_firebird
extension=pdo_mysql
;extension=pdo_oci
extension=pdo_odbc
;extension=pdo_pgsql
extension=pdo_sqlite
;extension=pgsql
;extension=shmop

You will likely also want to change the following parameter.

extension_dir = "./ext"

Visual Studio Code

You will likely want to make use of this configuration for your launch.json file. The following configuration gives you three debugging profiles.

launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "PHP: XDebug (Listen)",
            "type": "php",
            "request": "launch",
            "port": 9001
        },
        {
            "name": "PHP: XDebug (File)",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9001
        }
    ]
}

Environment

After installing your integrated development environment (IDE), and additional extensions to go with them, you will want to configure them using the following environment and configuration variables.

Variables

Several of the recommended PHP extensions make use of the PHP command-line for linting, code inspection, and syntax highlighting. Their default behaviour is to make use of the PHP client that is available from the path environment variable.

XDebug

You will want to place the following parameters at the end of your *.ini based configuration file for PHP.

These parameters ensure that you have XDEBUG configured, enabled, and listening for incoming debugger connections from Visual Studio Code. 

[XDebug]
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9001
xdebug.remote_handler=dbgp
xdebug.remote_autostart=1


Comments

Comments

Gravatar for trashamators.live

A retired high school teacher, widowed, she now works in an workplace after
a lifetime of teaching English. Here she
meets the man with whom she may have her single extramarital affair, a black faculty principal named Nathanael.
The explanation was He knew that they should have the ability of the Holy Spirit
to be able to endure and maintain there good character. Good character is not imagined to go dangerous.
So with all of that, I must make the declaration that dangerous firm doesn't corrupt good character!

The actual fact is that Jesus did not let His disciples minister
to "dangerous company" unequipped. Jesus is our good instance, our moral
compass if you'll (WWJD). Simply hit the Categories section - and you can be simply blown away by the variety of porn that we
provide. Very merely put, men who use lots of porn are way more prone to endure from ED symptoms than men who don't
use it. But seeing David get pleasure from it as a lot as
I do makes me suppose perhaps we are even more
compatible than I thought.

Gravatar for dream-flirt.live

The rationale for this is that dopamine is released, and that is the neurotransmitter responsible for reward and
pleasure. Hope you'll spend your time with pleasure!
We are so critical about porn and we hope that this amazing xxx site could be your first
choice relating to porn of every kind. Since you might be already on an ideal ass fucking
site you realize what to anticipate right here. Dreaded sizzling flashes
are successfully fought off as properly. However, chances are you'll not have realized that ladies possess some operating by their systems as well.
They'll even have a unfavorable impact on an individual's level.
No matter an individual's sex, there is probably a extreme scarcity
of the highly effective hormone being produced in a center-aged mind's pituitary glands.
There have been certain issues that were essential by way
of affect which are being produced. Make a list of issues you have
to be doing, each particular to your marriage and other things you need
to improve in your life, after which apply the time you would spend masturbating to the completion of the
tasks on that record.

Gravatar for mybabyforfun69.live

The reality is - a video game tester job can provide the same things to the soon to be 3D
character model designer that a clerical position with
a small clinic gives to the soon to be medical technician, nurse, or doctor.
The lowly and relatively low paying Video Sport Tester Jobs.
Video game tester jobs are readily accessible, industry related,
work with which you'll offset different prices while in class or coaching for your desired function, achieve expertise and familiarity
with the software improvement process, and which comes with comparatively low entry requirements.
When individuals consider a QA tester job, they usually think of someone who was lucky sufficient to get paid to play
video games. Solely senseless sheep would think this individual should charge multiple second
worth of their time, if that. While considering any work they
think of as "from an actual company" with "a real paycheck hooked up" mechanically extra essential.
I once worked for a corporation whose proprietor gave the company to his grand youngsters.

Gravatar for cockclub.world

DP

Gravatar for blexime

Propecia Ricetta https://abuycialisb.com/ - Cialis levitra be ordered in usa <a href=https://abuycialisb.com/#>Buy Cialis</a> Acquistare Levitra Originale