Hello Punk! Yes I am, in this journal I want to share with you how to install libSQL in your PHP Environment without worry to configure php.ini
file in your current PHP Version.
Install the libSQL extension for PHP it's like install a composer package:
composer require vendor/package
to install libSQL extension for PHP
turso-php-installer install
Anyway... I want you to know how the punk'in single file installer script work and setup it for you.
help
command
You already see in the image above. That's the help
command does.
install
command
The install
command will do some necessary checks before installing the libSQL Extension for PHP, what a questions will ask for? (checking in the background)
Are You Using Windows?
Even though Turso Client PHP has an extension built for Windows MSVC 2022. However, the installation process using this installer script will not work for Windows. WSL will work or you can use Turso Docker PHP!
If you're using Windows then you will get this message:
> turso-php-installer install # In Windows
Sorry, Turso PHP Installer is only support for Linux and MacOS.
You are using Windows, you can try our alternative using Dev Containers
visit: https://github.com/darkterminal/turso-docker-php
Thank you!
Are You Using Laravel Herd?
Dang yeah... the installer is not support yet for Laravel Herd. But I will support soon, and you can follow up this discussion on Herd Community GitHub Disccussion.
$ turso-php-installer install
You are using Laravel Herd
Sorry, Laravel Herd is not supported yet.
You can try our alternative using Dev Containers
visit: https://github.com/darkterminal/turso-docker-php
Thank you!
Is Already Installed
Sometimes I forgot when it's already installed.
$ turso-php-installer install
Turso Client PHP is already installed and configured!
Which PHP Version?
Turso Client PHP / libSQL Extension for PHP need minimal PHP 8.0 and later. You see it at Turso Client PHP - Release page
If you have PHP below the minimum requirement, then it will failed
$ turso-php-installer install
Oops! Your PHP version environment does not meet the requirements.
Need a minimal PHP 8.0 installed on your environment.
Check php.ini
The installer script need to lookup
$ turso-php-installer install
You don't have PHP install globaly in your environment
Turso Client PHP lookup php.ini file and it's not found
Check The Functions Requiered
The installer script also need a shell_exec
and curl
function
$ turso-php-installer install
It looks like the 'shell_exec' and 'curl_version' functions are disabled in your PHP environment. These functions are essential for this script to work properly.
To enable them, follow these steps:
1. Open your 'php.ini' file. You can find the location of your 'php.ini' file by running the command 'php --ini' in your terminal or command prompt.
2. Search for 'disable_functions' directive. It might look something like this:
disable_functions = shell_exec, curl_version
3. Remove 'shell_exec' and 'curl_version' from this list. It should look like:
disable_functions =
4. Save the 'php.ini' file.
5. Restart your web server for the changes to take effect. If you are using Apache, you can restart it with:
sudo service apache2 restart
or for Nginx:
sudo service nginx restart
If you are using a web hosting service, you might need to contact your hosting provider to enable these functions for you.
For more information on 'shell_exec', visit: https://www.php.net/manual/en/function.shell-exec.php
For more information on 'curl_version', visit: https://www.php.net/manual/en/function.curl-version.php
Thank you!
Asking Permission
The installer need to run with sudo role, because the installer will need to write php.ini
file in your environment.
$ turso-php-installer install
Turso need to install the client extension in your PHP environment.
This script will ask your sudo password to modify your php.ini file:
Are you ok? [y/N]:
Download and Extract
After all requirements is meet, then installer will download and extract the libSQL Extension for PHP based on Current PHP version that used in your environment and store it at $HOME/.turso-client-php
The extension is required before you used Turso Driver Laravel and Turso Doctrine DBAL
Top comments (0)