Recently, our web developer Dmitry Drevko shared in our blog why it is sometimes necessary to connect alternative versions of PHP and how to do it manually. Today, he will talk more about configuring PHP with ispmanager and share some case studies.
Content
Configuring alternate versions of PHP
Debugging the operation of PHP extensions
Configuring alternate versions of PHP
At the beginning of my career, I was working in a web studio. We rented a server that hosted many websites on different CMS. At the time, I had no experience with the command line, and I had no idea how to set up a particular version of PHP for the website. Ispmanager helped me out. It allows you to independently install and configure the PHP version of the website. To do this, go to the list of websites, select the one you need and click on it twice in the table. This will open a section with settings, where in the PHP section you can select in which mode PHP will run (Apache, CGI or FastCGI), and below - which version of PHP will be installed for the website.
Uploading large files
Another problem I have encountered is how to upload large files to a website or import a database over the standard 2 Mb. Here it was not clear for me at all as a novice developer how to change such parameters and which files to edit, so as not to break anything. And if you do edit, what syntax to use. The ispmanager panel served to simplify all these steps. In the PHP settings section you can easily configure these settings: Settings → PHP settings → select the required version → press Advanced settings:
Debugging the operation of PHP extensions
We were updating the company website, and I had the task of styling the blog. I had to make the announcements of articles in the blog to be shaded in the same color as the main images for these articles. It looks like this:
It was necessary to determine the background color of the image of the last published article by means of PHP. Then this color had to be displayed on the main page of the blog.
To do this, I used the Imagick PHP extension. At first it did not work - the server persistently returned the php error: Class 'Imagick' not found. However, by then I already had enough experience with PHP. When I saw the error, I knew right away what to do - I had to go to ispmanager and install the extension without pain.
To activate Imagick and make the code work, it took literally just a few clicks in ispmanager - Settings → PHP settings → select the required version → press on Manage extensions → Find imagick and activate it by clicking the light bulb: