How to add a custom PHP version?

Follow

Comments

12 comments

  • Avatar
    final coat app (Edited )

    hello i want to update PHP version because my laravel app version is newer then plesk version,please give me solution.

  • Avatar
    Ivan Postnikov

    Hello @final coat app!

    As I can see the most recent Laravel version requires PHP 7.1.3 or higher. Such PHP versions are provided by Plesk Onyx and may be installed at Tools & Settings > Updates and Upgrades > Add/Remove Components.

    In case you have Plesk 12.5 or lower, the easiest solution would be to Upgrade to Plesk Onyx.

    In case you want to install custom PHP version manually, follow the steps from this article.

     

  • Avatar
    final coat app (Edited )

    thanks for replay,

    my plesk version is onyx 17.5.3 (1.png) and in plesk server PHP version is 7.0.30 but my composer says your plesk version is 5.4.16 (2.png) ,please give me solution . see below images

  • Avatar
    Ivan Postnikov

    Hello @final coat app, the reason of such behavior is that composer uses OS PHP version, not the PHP version set for subscription.

    You may upgrade system PHP at your own risk. Alternatively, consider migration to Plesk server with OS supplied by more modern PHP version out of the box.

  • Avatar
    final coat app

    but my OS PHP version is 7.2.1 and plesk server version is 7.0.30 but error still come on composer update.composer show PHP version is 5.4.16

  • Avatar
    Ivan Postnikov

    @final, could you, please, show the output of the following commands:

    plesk -v

    php -v

  • Avatar
    Cirrus Tecnologia (Edited )

    What would be the proper way to remove / rollback an installation made with the instructions in this article?
    Besides, what if a new PHP configuration option is needed after installation?

  • Avatar
    Pavel Rozental

    Hello @Cirrus Tecnologia,

    > What would be the proper way to remove / rollback an installation made with the instructions in this article?

    1. Find ID of registered PHP
    /usr/local/psa/bin/php_handler --list
    2. Unregister PHP from Plesk
    /usr/local/psa/bin/php_handler --remove ID_from_step_1
    3. Optionally:
    Remove folder where PHP was compiled

    > Besides, what if a new PHP configuration option is needed after installation?

    Compile PHP again with new option

  • Avatar
    Robert

    Please update this page so old php 5.6x will be useable with ubuntu 18.04. that comes only with php 7.2

    Unfortunately I tried the above step and plesk show me PHP 5.6-40 but the domain was not able to connect to the Database.

    Might someone help with this last step so this php5.6.40 addition will actually work?

    /usr/local/psa/bin/php_handler --add -displayname <NN> -path <path to php cgi> -phpini <path to php.ini> -type <php handler> -id <NN-custom> -clipath <path to php cli>

  • Avatar
    Alisa Kasyanova

    @Robert
    This command was successfully used on my test machine:
    /usr/local/psa/bin/php_handler --add -displayname 5.6.40 -path /usr/local/php56/bin/php-cgi -phpini /usr/local/lib/php.ini -type fastcgi -id PHP5.6.40 -clipath /usr/local/php56/bin/php
    Check the following article, it is possible that mysql socket is not specified for 5.6.40: https://support.plesk.com/hc/en-us/articles/213394269-Unable-to-open-a-website-after-switching-to-additional-PHP-Error-establishing-a-database-connection

  • Avatar
    Robert

    Yes this might include php 5.6, but has no mysql connection.

    Please talk to your plesk colleague as i have received a working installation guide.

  • Avatar
    Alisa Kasyanova

    @Robert
    Just checked - it was needed to add the mysql module to the new PHP handler. Glad that you have found the cause!

Please sign in to leave a comment.

Have more questions? Submit a request