Direct Installation
Introduction
Below you can find detailed instructions for preparing and configuring environment for PHP directly on your machine.
1. Installing PHP 8.3 (Latest Stable Version as of April 2024)
For Windows:
Download the latest PHP 8.3 version from the official PHP website (https://windows.php.net/download/)
Extract the ZIP file to a directory (e.g.,
C:\php
)Add the PHP directory to your system's PATH environment variable
Rename
php.ini-development
tophp.ini
in the PHP directory
For macOS:
For Linux (Ubuntu/Debian):
2. Configuring PHP for Optimal Performance
Edit your php.ini
file:
3. Setting Up a Web Server
Apache (with mod_php):
Nginx (with PHP-FPM):
Configure Nginx to work with PHP-FPM (edit /etc/nginx/sites-available/default
):
4. Installing Necessary PHP Extensions for Machine Learning
5. Setting Up Composer (Package Manager)
6. Installing Popular PHP Machine Learning Libraries
7. Configuring IDE
Install PHPStorm or VS Code
Install PHP extensions (for VS Code):
PHP IntelliSense
PHP Debug
PHP Intelephense
8. Setting Up Version Control (Git)
9. Configuring a Database System (MySQL)
Configure PHP to work with MySQL:
10. Setting Up a Virtual Environment
Install and use PHP's built-in development server for isolated projects:
11. Testing the Setup
Create a phpinfo.php
file in your web server's document root:
Access this file through your web browser to verify your PHP configuration.
12. Creating a Simple ML Test Script
We'll create two test scripts, one for each library, to verify that both PHP-ML and Rubix ML are working correctly.
PHP-ML Test Script
Create a file named php_ml_test.php
in your public
directory:
Rubix ML Test Script
Create another file named rubix_ml_test.php
in your public
directory:
To run these scripts, use the following commands:
If everything is set up correctly, you should see a prediction output.
Last updated