How to Install Laravel via Composer?

1. Go to the htdocs folder in the XAMPP installation directory:

cd /xampp/htdocs/test

2. In this directory, run the following Composer command:

composer create-project laravel/laravel --prefer-dist

If the following appears


[SymfonyComponentProcessExceptionRuntimeException]
The Process class relies on proc_open, which is not available on your PHP installation.

you should now remove the proc_open restriction in the php.ini file. The specific steps are as follows:

Open the php.ini file, find disable_function=, and remove the proc_open function.

3. This will install a new Laravel application with the directory name laravel in this directory:

4. If you want to specify a custom installation directory name, such as laravelapp, use the following command:

composer create-project laravel/laravel laravelapp --prefer-dist

5. If an error occurs during installation:

[RuntimeException]
Could not load package classpreloader/classpreloader in http://packagist.org: [UnexpectedValueException] Could not parse version constraint ^1.2.2: Invalid version string "^1.2.2"

this means Composer needs to be updated:
Run the following command:

composer self-update

6. After the update is complete, run the installation command again.

7. Installation will take some time. After it is complete, you can access the newly installed Laravel application in your browser via http://localhost/laravelapp/public.

8. Of course, you can also configure a virtual host to access the application through a domain name. For example, here I configured the virtual host domain name as

http://testlaravel.com:

9. The corresponding Apache httpd-vhosts.conf configuration is as follows:

<VirtualHost *:80>
    DocumentRoot "D:/xampp/htdocs/test/laravelapp/public"
    ServerName laravel.app
    ErrorLog "logs/laravelapp-error.log"
    CustomLog "logs/laravelapp-access.log" common
</VirtualHost>

Note: In your own configuration file, you need to set DocumentRoot to your own Laravel installation directory.

Leave a Comment

Your email address will not be published. Required fields are marked *

中文 EN
🚀

RedGate VPN

免费节点太挤太慢?
升级高速稳定专线

立即体验 →

告别卡顿

RedGate VPN
全球高速节点

免费下载 →
Scroll to Top