Strengthening PHP settings in Obsidian and the new PHP Composer

PHP, standing for “hypertext processor”, started out as a small open source project that evolved as more and more people found out how useful it was. Today, it is one of the most widely used scripting languages in the world. It’s particularly popular for web development since it can be easily embedded into HTML pages.

PHP is so popular and effective that you’ll find it at the core of the biggest content management platform, WordPress. As well as behind the largest social network – Facebook. One of the things that makes PHP so great is that it’s powerful, flexible, and easy to use. It runs on various platforms, is compatible with most servers, and everyone from expert developers to beginners and hosting managers can work with it.

Plesk provides full support for the PHP scripting language. Including support for multiple PHP versions and handler types out of the box. As part of Plesk Obsidian, our latest product release, we introduced PHP Composer. A new extension that allows you greater control over your PHP settings, ensuring they’re as strong as can be.

In this article, we dive into the new Plesk Composer extension. Looking at how you can use it to better manage PHP settings for your domains and subdomains directly from Plesk’s control panel.

The New PHP Composer Extension

PHP Composer is an extension that helps you find, install, and update library packages that your PHP project depends on. Starting from Plesk Obsidian, PHP Composer is available by default as a Plesk extension.

The tool is ready to go, out of the box. Allowing users access to all the most important operations within the Plesk UI. This also means you don’t need to install obligations or manually update to the latest versions. The PHP Composer does it all for you.

There are many benefits to using the new PHP Composer. To give you a better idea how it can strengthen your PHP settings, here’s an overview of its core features.

Use PHP Composer without SSH access

There’s now no need to gain SSH access to execute the most useful Composer actions. Using PHP composer. You can set up environment variables, edit your composer.json file, run the Install and Update commands. All from the Plesk UI.

Install and update dependencies with one click

Instead of having to remember all the commands and options to run to install dependencies, the Plesk Composer takes care of it with a click of a button. You’ll also soon be able to use it to perform test runs before executing dependencies, to ensure they don’t break your production site.

Review installed dependencies before updating

To maintain a secure website, it’s important to update dependencies. But doing so can lead to a broken site. With Composer, you can review installed dependencies and decide if it makes sense to update them before doing so. Soon you’ll also be able to use Composer to identify security issues with the installed version.

Get the right PHP version automatically

You want to make sure your website is using the right PHP version. PHP composer ensures your website automatically uses the PHP version specified in composer.json. Soon Composer will also allow you to choose the correct PHP version and handler. Just log in via SSH and run the “php” command.

How to Run PHP Composer

As mentioned, Plesk Obsidian comes with PHP Composer already installed and compiled with the most popular modules. However, if you need to install some additional libraries, you can connect to a Plesk server via SSH (Linux) / RDP (Windows Server).

Instead of running the default command:

# composer [options] [arguments]

use the following commands instead:

X.X  (XX  for Windows Server) should be replaced with an installed PHP version provided by Plesk (5.6, 7.0, 7.1, etc).

On CentOS/RHEL-based distributions, use the command:

# /opt/plesk/php/X.X/bin/php /usr/lib64/plesk-9.0/composer.phar [options] [arguments]

On Debian/Ubuntu-based distributions, use the command:

# /opt/plesk/php/X.X/bin/php /usr/lib/plesk-9.0/composer.phar [options] [arguments]

on Windows Server, use the command:

c:\> “%plesk_dir%Additional\PleskPHPXX\php.exe” “%plesk_dir%Additional\Composer\composer.phar” [options] [arguments]

Customizing PHP Settings in Plesk Obsidian

Customizing your PHP settings is now super simple. Whether you want to alter one domain, a selection of domains assigned to a specific plan, or all your domains. To adjust PHP setting for a domain, go to:

Domains > example.com > PHP Settings

You can then adjust the PHP settings according to your needs and apply the changes.

plesk obisidian- php settings

To customize the PHP settings for domains that are assigned to a specific service plan, go to:

Service Plans > plan_name > PHP Settings

You can then adjust the PHP settings according to your needs and apply the changes by clicking Update & Sync.

deafult-domain-settings-php-obsidian

Finally, you can customize PHP settings for all domains by going to:

Tools & Settings > PHP Settings > click on a required PHP version (any application) > switch to the php.ini tab.

You can then adjust the values for existing PHP parameters or specify your own. Once you finish, apply the changes.

Managing PHP Dependencies with Composer

To store the list of modules for a project, PHP Composer uses two files. Composer.json – to list libraries on which your project depends directly. And composer.lock, to list all libraries on which the libraries in composer.json depend directly and indirectly.

Plesk offers two ways to use Composer: Through the command line, and through Websites & Domains > Applications. Below are a few of the main ways you can use PHP Composer to manage dependencies.

For more detailed information, you can refer to the PHP Composer documentation.

Manage PHP Project Dependencies with Composer

To manage dependencies, you can find all applications that have composer.json by clicking Scan in the Applications section. The applications will appear in the list. The commands below are available only for applications with the composer.json file.

Installing Dependencies

You can use PHP Composer to install all modules necessary for your project by going to: Websites & Domains > Applications > Manage My Applications. Click the application name in the list, and finally select Install Dependencies.

Updating Dependencies

You can update module dependencies by running Websites & Domains > Applications > Manage My Applications > clicking the application name. And then selecting Update Dependencies.

Editing Dependencies

To manually edit dependencies, you can select the Edit Configuration button and open up composer.json in Plesk’s Code Editor.

Remove Dependencies Management from Your App

By clicking Remove, the application will no longer appear in the list of applications in My Apps. However, the composer.json and composer.lock files will remain in the application directory. So you can add the application to the list by clicking Scan.

Have you tried the new PHP composer yet? Let us know your feedback and suggestions in the comments!

4 Comments

  1. php composer uses laravel apparently, and as usual, laravel is having issues with updates. (Carbon 1 has been deprecated).

    We are running latest version of Obsidian 18.0.25 update 1 running on Centos 7 64-bit

    Plesk gives these errors when you try to run the laravel framework update:

    Loading composer repositories with package information
    Updating dependencies
    Nothing to install or update
    Generating autoload files
    > php artisan clear-compiled
    Script php artisan clear-compiled handling the post-update-cmd event returned with error code 1
    Carbon 1 is deprecated, see how to migrate to Carbon 2.
    https://carbon.nesbot.com/docs/#api-carbon-2
    You can run ‘./vendor/bin/upgrade-carbon’ to get help in updating carbon and other frameworks and libraries that depend on it.
    Mcrypt PHP extension required.

  2. I get unexpected errors when maintaining composer based applications on my web server.
    Composer is now version 2.0-dev (Composer version 2.0-dev (2.0-dev+40a35abb9423e16f8bafcb1ed1b7e027881b0422) 2020-04-10 10:24:43) on Plesk onyx.

    When was this update published? Why do we get this update?
    Version 2.0-dev is also no official release. The latest version is 1.10.5 2020-04-10 sha256 d5f3fddd0be28a5fc9bf2634a06f51bc9bd581fabda93fee7ca8ca781ae43129
    Seems like plesk is running a public alpha test with all of its customers. Rolled out during easter weekend.

    After each automatic Plesk update we have to perform a manual update of composer:
    /opt/plesk/php/7.2/bin/php /usr/lib64/plesk-9.0/composer.phar self-update

    This rolls it back to the official version:
    Composer version 1.10.5 2020-04-10 11:44:22

    Strange that this is slipping through, has been a problem now for a couple of weeks.

Add a Comment

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

GET LATEST NEWS AND TIPS

  • Yes, please, I agree to receiving my personal Plesk Newsletter! WebPros International GmbH and other WebPros group companies may store and process the data I provide for the purpose of delivering the newsletter according to the WebPros Privacy Policy. In order to tailor its offerings to me, Plesk may further use additional information like usage and behavior data (Profiling). I can unsubscribe from the newsletter at any time by sending an email to [email protected] or use the unsubscribe link in any of the newsletters.

  • Hidden
  • Hidden
  • Hidden
  • Hidden
  • Hidden
  • Hidden

Related Posts

Knowledge Base

Plesk uses LiveChat system (3rd party).

By proceeding below, I hereby agree to use LiveChat as an external third party technology. This may involve a transfer of my personal data (e.g. IP Address) to third parties in- or outside of Europe. For more information, please see our Privacy Policy.

Search
Generic filters
Exact matches only
Search in title
Search in content
Search in excerpt