|
| 1 | +--- |
| 2 | +title: Installation |
| 3 | +--- |
| 4 | + |
| 5 | +import InstallCommand from '@site/src/components/InstallCommand'; |
| 6 | + |
| 7 | +The quickest way to get PHP Debugger onto your machine is the installer, a small |
| 8 | +command-line tool that fetches the right build for your system and puts it in |
| 9 | +place. Installing it is a single command. |
| 10 | + |
| 11 | +## 1. Get the installer |
| 12 | + |
| 13 | +<InstallCommand /> |
| 14 | + |
| 15 | +The script downloads the latest release and drops the `php-debugger` binary into |
| 16 | +the current directory. Set `INSTALL_DIR` if you would rather it landed somewhere |
| 17 | +else. |
| 18 | + |
| 19 | +:::tip[Prefer Docker?] |
| 20 | + |
| 21 | +Use a container image instead — see [Docker](./docker.md). |
| 22 | + |
| 23 | +::: |
| 24 | + |
| 25 | +## 2. Install the debugger |
| 26 | + |
| 27 | +The installer offers two ways to get a working debugger. Run it with no arguments |
| 28 | +for the default: |
| 29 | + |
| 30 | +```bash |
| 31 | +php-debugger install |
| 32 | +``` |
| 33 | + |
| 34 | +That installs a **self-contained PHP interpreter** with the debugger compiled |
| 35 | +straight into it, and makes it the active `php` on your PATH. Nothing else on your |
| 36 | +system needs to change. |
| 37 | + |
| 38 | +If you would rather keep the PHP you already have, install **only the extension** |
| 39 | +into it: |
| 40 | + |
| 41 | +```bash |
| 42 | +php-debugger install --extension-only |
| 43 | +``` |
| 44 | + |
| 45 | +The two are mutually exclusive, and the installer knows it: installing the |
| 46 | +interpreter removes any extension you had installed, so you never end up running |
| 47 | +both at once. |
| 48 | + |
| 49 | +A few flags are worth knowing: |
| 50 | + |
| 51 | +| Flag | What it does | |
| 52 | +| --- | --- | |
| 53 | +| `-u, --user` | Install into a per-user directory, so no `sudo` is needed. The default is system-wide. | |
| 54 | +| `-p, --php <x.y>` | Pick the PHP version to install. Defaults to the latest, and applies to the interpreter only. | |
| 55 | +| `-e, --extension-only` | Install just the extension into your current PHP. | |
| 56 | +| `-z, --zts` | Install a thread-safe build instead of the default non-thread-safe one. | |
| 57 | +| `-y, --yes` | Answer yes to every prompt, for unattended or CI use. | |
| 58 | + |
| 59 | +If the directory it installs into is not on your `PATH`, the installer prints the |
| 60 | +exact line you need to add. |
| 61 | + |
| 62 | +## Changing your mind |
| 63 | + |
| 64 | +Nothing here is a one-way door. Whether you installed the interpreter or just the |
| 65 | +extension, whatever it replaced is backed up first — the PHP you already had, or |
| 66 | +the ini configuration it changed. To put things back as they were: |
| 67 | + |
| 68 | +```bash |
| 69 | +php-debugger uninstall |
| 70 | +``` |
| 71 | + |
| 72 | +That removes whatever was installed and restores your previous setup from the |
| 73 | +backup — the interpreter it replaced, or the ini configuration it changed. You do |
| 74 | +not have to tell it which kind you installed; it works that out for itself. |
| 75 | + |
| 76 | +The installer also tries hard not to leave you with a broken `php` in the first |
| 77 | +place. It runs the downloaded interpreter before changing anything, so a build |
| 78 | +that cannot run on your system is never installed. After activating it, it checks |
| 79 | +that `php` still runs and reports the debugger module, and rolls everything back to |
| 80 | +the previous working state if either check fails. |
| 81 | + |
| 82 | +## Staying up to date |
| 83 | + |
| 84 | +To move to the latest release: |
| 85 | + |
| 86 | +```bash |
| 87 | +php-debugger update |
| 88 | +``` |
| 89 | + |
| 90 | +It takes no arguments. Whether you installed the interpreter or just the |
| 91 | +extension, it detects what is there and reinstalls the same thing against the |
| 92 | +latest version. |
| 93 | + |
| 94 | +:::info[Prefer to install some other way?] |
| 95 | + |
| 96 | +See [More install options](./install-options.md). |
| 97 | + |
| 98 | +::: |
| 99 | + |
| 100 | +## Next steps |
| 101 | + |
| 102 | +With the debugger installed, point your editor at it and set your first |
| 103 | +breakpoint: |
| 104 | + |
| 105 | +- [Quick Start](./quick-start.md) |
| 106 | +- [Configuration](./configuration.md) |
0 commit comments