bhylu.com

Advertisements

PHP Installation and Setup

Establish which PHP executable and configuration your terminal actually uses. A working command-line installation and a running web server are related but separate facts.

How it works

Save a source file as main.php and run php main.php from its directory. Check php -v, php --ini and php -m to inspect the version, active configuration and extensions. On this project the existing XAMPP executable is sufficient; starting MySQL does not install or enable PHP. The course targets PHP 8.2 and later, with clearly labelled newer APIs. Never infer that a command-line extension is also enabled in a differently configured web SAPI.

Run it locally

Run this complete source locally with PHP 8.2 or newer. Save it using the filename shown and run the command below. PHP is not currently available in Bhylu’s browser playground. Apache and MySQL are not needed for an ordinary CLI example.

php -l setup.php
php setup.php

Download this source as a local PHP lab file. Keep lab files separate from the Bhylu project and production data.

Example

PHP 8.2+ · setup.php

<?php
declare(strict_types=1);

echo PHP_MAJOR_VERSION >= 8 ? "PHP 8 family\n" : "Check the runtime\n";
echo extension_loaded("pdo_sqlite") ? "SQLite available\n" : "Enable the SQLite lab extension\n";

Expected result

PHP 8 family
SQLite available

The first line checks the major version only, so use php -v for the full requirement. The second checks the lab extension rather than attempting a database connection. This review machine has PDO SQLite enabled. On another machine the second line can legitimately ask you to enable it; that is an environment difference, not a different language result.

Check the official PHP manual for detailed version and API contracts.