How to add a custom PHP version?

Follow

Comments

20 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.

    0
    Comment actions Permalink
  • 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.

     

    0
    Comment actions Permalink
  • 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

    0
    Comment actions Permalink
  • 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.

    0
    Comment actions Permalink
  • 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

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

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

    plesk -v

    php -v

    0
    Comment actions Permalink
  • 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?

    0
    Comment actions Permalink
  • 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

    0
    Comment actions Permalink
  • 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>

    0
    Comment actions Permalink
  • 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

    0
    Comment actions Permalink
  • 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.

    0
    Comment actions Permalink
  • 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!

    0
    Comment actions Permalink
  • Avatar
    dasty

    After weeks I succeeded, I put the link of the commands to run on centos to install plesk with php + argon2

    https://github.com/xdasty/plesk-php-argon2

     

     

     

    0
    Comment actions Permalink
  • Avatar
    Ivan Postnikov

    @dasty,

    This may help other Plesk users, thank you.

    0
    Comment actions Permalink
  • Avatar
    Peer Hoffmann

    Hi a working guide to fix the mysql connection would be nice. Could you update the article please!?


    Thanks for your help

    Peer

    0
    Comment actions Permalink
  • Avatar
    Lev Iurev

    Hi @Peer Hoffmann

    Could you please elaborate on this? Please send me the error message, may be we have another article for your issue

    0
    Comment actions Permalink
  • Avatar
    Anzhelika Khapaknysh

    Hi @kriskrkpl,

    The article was deleted due to being non-actual.
    I would suggest you checking other ones.

    0
    Comment actions Permalink
  • Avatar
    kriskrkpl

    can you help me find an article that fixes the problem described in the article above?

    0
    Comment actions Permalink
  • Avatar
    Anzhelika Khapaknysh (Edited )

    @kriskrkpl,

    As a troubleshooting step, try switching PHP version on a affected domain to another one in Domains > example.com > PHP Settings.
    In case it'll make a trick, the most possible cause is that mysql socket isn't specified in php.ini for the previous chosen version of PHP.

    The socket can be specified either in Plesk UI in Tools & Settings > PHP Settings > PHP 5.6 (chose the version according to your needs) or via command line:

    1. Connect to the server via SSH and add the following line in the corresponding php.ini file:
      # grep -ir mysql.sock /opt/plesk/php/5.6/etc/php.ini |grep -v ';'
      mysql.default_socket = /var/lib/mysql/mysql.sock

      Note: for Debian 9 the socket path should be /var/run/mysqld/mysqld.sock.
      The path to php.ini should be adjusted according to the PHP version.
    2. Re-apply PHP settings on a domain in Domains > example.com > PHP Settings after changes in main php.ini file.

    If it won't help, submit a ticket to the Support Team to look deeper into the issue.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Have more questions? Submit a request