Install PHP - jzohrab/lute GitHub Wiki
This documentation is deprecated/obsolete. Lute v2 has been replaced by Lute v3, a full Python rewrite. Please see the Lute v3 manual which includes notes on installation. If you have Lute v2, you can easily migrate to v3. Thank you!
The steps to install PHP depend on your system. You'll need to setup PHP so that it can be run from the command line.
PHP also needs some extra extensions (such as database drivers), and usually some configuration in the php.ini file to enable those extensions.
Feedback/verification needed for these steps!
- Install
For installing just PHP, I'll steal some of Microsoft's page Configuring Step 1: Install IIS and PHP. You don't need IIS or WebCache, so we'll just install PHP.
- Open your browser to Windows for PHP Download Page and download the PHP thread-safe zip package.
- Extract all files in the PHP .zip package to a folder of your choice, for example C:\PHP.
- Open Control Panel, click System and Security, click System, and then click Advanced system settings.
- In the System Properties window, select the Advanced tab, and then click Environment Variables.
- Under System variables, select Path, and then click Edit.
- Add the path to your PHP installation folder to the end of the Variable value, for example ;C:\PHP. Click OK.
The page https://www.geeksforgeeks.org/how-to-install-php-in-windows-10/ gives the same instructions, in a more verbose but perhaps easier-to-follow layout.
- Configuration
The Windows install creates template files "php.ini-production" and "php.ini-development" that you can use for the "php.ini" file.
Those might be in a folder like C:\Program Files\php-8.1.23-nts-Win32-vs16-x64, depending on your system.
Copy "php.ini-production" to "php.ini" in the same folder. Then open the file with notepad and change the lines
;extension=mbstring
;extension=pdo_sqlite
to
extension=mbstring
extension=pdo_sqlite
(i.e. remove the ";", which is a comment marker)
Also from https://www.php.net/manual/en/sqlite3.installation.php , you may need to put the libsqlite3.dll on your PATH -- which is outside of my of experience!
Refs:
- install homebrew, by following the instructions at brew.sh
- On Terminal, run:
brew install php
With *nix, you have to install extra PHP extensions, and then create and edit the php.ini file to enable those extensions for PHP. There are a few variations, some examples below -- you may need to tweak those instructions for your system.
- Install extra libraries:
Sample for Ubuntu 22.04.2(LTS):
apt-get update
apt-get install php php-mbstring php-xml php-sqlite3
Sample for Linux:
sudo apt update
sudo apt install php8.3 php8.3-sqlite3 php8.3-xml php8.3-mbstring
- Create php.ini if needed.
Some php installations create template files, e.g.:
/usr/lib/php/8.3$ ls
php.ini-development php.ini-production php.ini-production.cli sapi
Copy one of these templates in the PHP directory, e.g.:
sudo cp php.ini-production php.ini
- Edit php.ini to activate required extensions
The php.ini file shows various possible extensions that can be enabled by removing the comment character ; from the start of the lines. Lute needs PHP extensions for sqlite and mbstring. Some example lines that should be changed (remove the ; comment char):
;extension=pdo_sqlite.so
;extension=mbstring
I'm not sure what the exact lines are for your particular system, but the above should get you looking in the right direction.
On the command line, type:
php --version
You should see something like:
PHP 8.3.0RC1 (cli) (built: Sep 2 2023 06:34:23) (NTS)
Windows users may need to add the php folder to their system PATH.
When you start Lute, you may get errors such as "missing driver", indicating that you need to install or activate further PHP extensions.