Strengthening PHP settings in Obsidian and the new PHP Composer

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!

All About Managing Domain Names in Plesk

Managing Domain Names in Plesk

Your domain name is essential to your online presence because it’s the first thing visitors interact with. A domain name is your address – the one visitors use to find you out there in the vast internet. Many choose to rely on a managed domain service to have a few responsibilities carried off their busy shoulders – like setting up or changing domain names.

However, you may find yourself left in the dark if your IT admin is ever unavailable. What if they are out of office when you need a quick domain edit? Luckily, setting up and editing domain names in Plesk is easy business that you can swiftly take care of by yourself. Considering the importance of domains, it’s definitely a great addition to add to your skill set.

How to Change a Domain Name

No need to worry about changing a domain name in Plesk, since this is super simple.

  • First, login to your Plesk account and head over to Domains in the Navigation menu.
  • Then, click on example.com > Hosting settings to change your domain name as below:
managing domain names add domain - Plesk

The red box shows where you can input your domain name, and you’re all done. It really can’t be simpler than that.

And to Add or Remove?

If you manage more than one website, you’ll need to add an additional domain name to the server. You can add your domain name right from the Plesk panel. So, to host a new website, with a second-level domain name:

  1. Head over to Websites & Domains and click Add Domain
  2. Follow the on-screen instructions as you can see from the screenshot below.
  3. Select OK. Your new domain name will now appear in the list at the bottom of the screen.
  4. If changing the hosting settings is available for your account, then you can simply click on the domain name of your new website to view or change the hosting settings. And you’re ready to go!
managing domain names 2 - Plesk

What if you need to remove a domain name for good? Then Plesk has you sorted, because once you delete a domain, all the site’s corresponding data is deleted from the server. If that’s what you want, the following 3 steps are here to show you how:

  1. Click on Websites & Domains and find the domain name you want to remove.
  2. Click on Remove Website or Remove Subdomain.
  3. Confirm removal and select OK.

Working with Plesk, there are also plenty of other services you can access as a user in order to have full reign over your domains. From accessing email services, to setting up mailboxes on the website domain, and managing mailing lists. This can all be done from the Plesk interface. Thus, giving you full control over your domains, without having to rely on, possibly unreliable, third-parties.

Next, learn how to set up a Domain Name Server (DNS).