When I run xampp php version 7 everything is fine but when I run xampp php version 8 but my current project is not working, this is my laravel 9 xampp php version 8 current project
Another problem occurs when I run new project and install npm install&& npm run dev but it doesn't work npm install When I run npm run dev the result is npm run dev
When I run php artisan migrate and serve after login url
P粉2538003122023-11-09 10:09:07
With a xampp installation you have 2 options:
Run older PHP versions only against the old project's directory: This will do the trick in most cases. You may have an old project or two that you intend to run with an older PHP version. Just configure xampp to run older PHP versions only against these project directories.
Running an older PHP version on a separate port of xampp: Sometimes you may upgrade an old project to the latest PHP version and need to run the same project on a new PHP version and Switch back and forth between older PHP versions. To do this, you can set up an older PHP version on a different port (e.g. 8056), so that when you visit http://localhost/any_project/
, xampp runs PHP 7, and when you visit >http://localhost:8056/any_project/
xampp runs PHP 5.6.
Run older PHP versions on a virtual host: You can create a virtual host (e.g. localhost56) to run PHP 5.6 while you use PHP 7 on localhost.
Step 1:Download PHP
So you are running PHP 7 under xampp and you want to add an older PHP version to it (e.g. PHP 5.6). Download the nts (non-thread-safe) version of PHP zip archive from php.net (see Archives of older versions) and extract the files under c:\xampp\php56
. The thread-safe version does not include php-cgi.exe.
Step 2: Configuration php.ini
Open the file c:\xampp\php56\php.ini
in Notepad. If the file does not exist, copy php.ini-development
to php.ini
and open it with Notepad. Then uncomment the following lines:
extension_dir = "ext"
Additionally, if the following line exists in the Apache configuration httpd-xampp.conf
SetEnv PHPRC "\path\to\xampp\php"
Comment it out using a leading # (pound character).
Step 3: Configure apache
Open the xampp control panel, click the configuration button of apache, and then click Apache (httpd-xampp.conf)
. A text file will open. Place the following settings at the bottom of the file:
ScriptAlias /php56 "C:/xampp/php56" Action application/x-httpd-php56-cgi /php56/php-cgi.exeAllowOverride None Options None Require all denied Require all granted
NOTE: You can follow steps 1 to 3 to add more versions of PHP to your xampp installation if needed.
Step 4 (Option 1): [Add directory to run specific PHP version]
Now you can set the directory that will run in PHP 5.6. Simply add the following to the bottom of the configuration file (httpd-xampp.conf
in step 3) to set up the directory.
SetHandler application/x-httpd-php56-cgi SetHandler application/x-httpd-php56-cgi
Step 4 (Option 2): [Run an older PHP version on a separate port]
Now to set up PHP v5.6 on port 8056, add the following code to the bottom of the configuration file (httpd-xampp.conf
in step 3).
Listen 8056SetHandler application/x-httpd-php56-cgi
Step 4 (Option 3): [Run an older PHP version on a virtual host]
To create a virtual host (localhost56) on the directory (htdocs56) to use PHP v5.6 on http://localhost56, create the directory htdocs56 in the desired location and
Add localhost56 to your hosts file (See how-to),
Then add the following code to the bottom of the configuration file (httpd-xampp.conf
in step 3).
DocumentRoot "C:\xampp\htdocs56" ServerName localhost56 Require all granted SetHandler application/x-httpd-php56-cgi
Complete: Save and restart Apache
Save and close the configuration file. Restart apache from xampp control panel. If you choose option 2, you can see the additional port (8056) listed in the xampp control panel.
For more information, check out this thread: Is there a way to use two PHP versions with XAMPP?