Once all the packages are installed, run the following command to install Composer: php -r "copy('', 'composer-setup.php') " You can install all of them by running the following command: apt-get install php php-common php-cli php-curl php-intl php-zip git curl unzip -y apt-get update -y Step 2 – Install PHP Composer on Debian 11īefore installing Composer, PHP and some other extensions must be installed to your system. Once you are logged in to your server, run the following command to update your base system with the latest available packages. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page. Create a new server, choosing Debian 11 as the operating system with at least 2GB RAM. Step 1 – Create Atlantic.Net Cloud Serverįirst, log in to your Atlantic.Net Cloud Server. A root password configured on your server.A server running Debian 11 on the Atlantic.Net Cloud Platform.In this post, we will explain how to install PHP Composer on Debian 11. It is used by Symfony and Laravel to bootstrap new projects. It provides an easier way to specify the set of all required libraries and dependencies of your project and install them. Manual management is a very time-consuming and tedious process, but Composer can help.Ĭomposer is a dependency manager for PHP that helps developers to manage dependencies used in a PHP project. Thanks.Some PHP-based applications require extra libraries or components that you need to manage. If you liked this post on how to install and use Composer on Ubuntu 20.04, please share it with your friends on social networks or simply leave a reply below. If you find it difficult to install Composer, you can always contact our technical support, and they will do the rest for you. To update only a specific package in your PHP project, you can use the command: $ composer update vendor/packageĬongratulations! You successfully installed Composer on Ubuntu 20.04 and added package dependency in the composer.json file. Now you can add the following PHP code in the monolog.php file to test the functionality of the monolog. Now you can list your directory, and you will see that there is a composer.json file in your directory, which has the monolog package as a dependency. Now to create the directory monolog and add the Monolog package, use the following commands: $ mkdir monolog $ cd monolog $ composer require monolog/monolog For this tutorial, we will use the Monolog package for sending logs to files, sockets, databases, and various web services. Now to use Composer in a PHP project, you will create a directory for your project and add the PHP dependencies using composer. mo GET YOUR VPS Using Composer in a PHP project Now you can run composer with the command: $ php composer.pharĪnd you will receive similar output as previously. For example, if you want to install Composer in the home directory of the user dev, you will need to navigate to his directory and run the following command as the user dev $ curl -sS | php h, -help Display help for the given command…Ĭomposer can also be installed locally to the project’s directory or in the home directory of the user. You should receive similar output to this: _ To check if the installation went through successfully, simply run: $ composer You can now execute the installation script that we previously downloaded in /tmp/composer-setup.php to install composer system-wide in the /usr/local/bin directory with the command: $ sudo php /tmp/composer-setup.php -install-dir=/usr/local/bin -filename=composer If you get this output, the installation is safe to run. Now, to verify if the installation script is safe to run, execute the following code: $ php -r "if (hash_file('SHA384', '/tmp/composer-setup.php') = '$HASH') echo PHP_EOL " Next, we will obtain the Composer signature and save it in the HASH system variable with: HASH=`curl -sS ` $ sudo apt install php-cli unzip Download and Install ComposerĬomposer is installed with a composer-setup.php script, which we will first download in /tmp, verify it and then run the script to install Composer.įirst, run the command to download the script in /tmp/composer-setup.php: $ curl -sS -o /tmp/composer-setup.php Now you can install php-cli and unzip also. If you don’t already have it installed with the command: $ sudo apt install php7.4 User privileges: root or non-root user with sudo privilegesīefore you start, make sure to update apt-cache with: $ sudo apt-get update.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |