I want to make my Laravel app portable so that I can run it on other Windows machines. So, I want to include the PHP interpreter with the project so that I don't have to worry about the PHP version installed on the other machines.
I have the following folder structure:
.
|- server-runner.bat
|- php\
|- src\
where src\
contains a Laravel project, and php\
is the php interpreter folder copied from C:\xampp\
. I renamed the original C:\xampp\
folder for testing purposes (as if Xampp is not installed).
I want to write a batch script server-runner.bat
to start the Laravel app server using the local php interpreter. This is the code I write:
@echo off
php\php.exe src\artisan serve
pause
but I get many errors like this one
PHP Warning: PHP Startup: Unable to load dynamic library 'bz2'
(tried: C:\xampp\php\ext\bz2 (The specified module could not be found),
C:\xampp\php\ext\php_bz2.dll (The specified module could not be found))
in Unknown on line 0
It still uses the C:\xampp\php
path although it's not currently in this location.
How to solve this problem?