{"id":933,"date":"2026-09-17T23:47:21","date_gmt":"2026-09-17T20:47:21","guid":{"rendered":"https:\/\/imaxis.ru\/?p=933"},"modified":"2026-09-18T00:06:02","modified_gmt":"2026-09-17T21:06:02","slug":"ustanovka-raznyh-versiy-php-na-ubuntu-i-pereklyuchenie-mezhdu-nimi","status":"publish","type":"post","link":"https:\/\/imaxis.ru\/?p=933","title":{"rendered":"\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 PHP \u043d\u0430 Ubuntu \u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438"},"content":{"rendered":"<h1>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 PHP \u043d\u0430 Ubuntu \u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438<\/h1>\n<p>\u0412 Ubuntu \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0440\u0441\u0438\u0439 PHP \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438. \u0420\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439, \u0432\u044b\u0431\u043e\u0440 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 \u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u0432.<\/p>\n<hr \/>\n<h2>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 PHP<\/h2>\n<h3>\u0411\u0430\u0437\u043e\u0432\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f<\/h3>\n<p>\u041a\u0430\u0436\u0434\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f Ubuntu \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0432\u043e\u044e \u0432\u0435\u0440\u0441\u0438\u044e PHP \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430:<\/p>\n<pre><code class=\"language-bash\">apt search --names-only '^php[.0-9]{3}$'\n<\/code><\/pre>\n<pre><code class=\"language-bash\">apt install php\n<\/code><\/pre>\n<h3>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043d\u0435\u0442 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c PPA:<\/p>\n<pre><code class=\"language-bash\">apt install software-properties-common\nadd-apt-repository ppa:ondrej\/php\n<\/code><\/pre>\n<p><strong>\u041f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435:<\/strong><\/p>\n<pre><code>FileNotFoundError: [Errno 2] No such file or directory: 'gpg'\n<\/code><\/pre>\n<p><strong>\u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c:<\/strong><\/p>\n<pre><code class=\"language-bash\">apt install gnupg-agent\n<\/code><\/pre>\n<p><strong>\u041f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435:<\/strong><\/p>\n<pre><code>AttributeError: 'NoneType' object has no attribute 'people'\n<\/code><\/pre>\n<p><strong>\u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c:<\/strong><\/p>\n<pre><code class=\"language-bash\">apt install python3-launchpadlib\n<\/code><\/pre>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043d\u0443\u0436\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e:<\/p>\n<pre><code class=\"language-bash\">export PHP_VER=8.3\napt install php${PHP_VER}\n<\/code><\/pre>\n<p><strong>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u2014 \u0432\u0435\u0440\u0441\u0438\u044f 8.3.<\/strong><\/p>\n<hr \/>\n<h2>\u0412\u044b\u0431\u043e\u0440 \u0432\u0435\u0440\u0441\u0438\u0438 PHP \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e<\/h2>\n<pre><code class=\"language-bash\">php -v\n<\/code><\/pre>\n<p>\u0421\u043c\u0435\u043d\u0430 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e:<\/p>\n<pre><code class=\"language-bash\">update-alternatives --config php\n<\/code><\/pre>\n<pre><code>There are 2 choices for the alternative php (providing \/usr\/bin\/php).\n\n  Selection    Path             Priority   Status\n------------------------------------------------------------\n* 0            \/usr\/bin\/php8.3   83        auto mode\n  1            \/usr\/bin\/php8.2   82        manual mode\n  2            \/usr\/bin\/php8.3   83        manual mode\n\nPress &lt;enter&gt; to keep the current choice[*], or type selection number: 1\n<\/code><\/pre>\n<p><strong>\u0412\u0432\u043e\u0434 \u043d\u043e\u043c\u0435\u0440\u0430 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u0442 \u0432\u0435\u0440\u0441\u0438\u044e (\u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u2014 \u043d\u0430 <code>php8.2<\/code>).<\/strong><\/p>\n<hr \/>\n<h2>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439<\/h2>\n<p>\u0414\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e:<\/p>\n<pre><code class=\"language-bash\">apt install php-mysqli\n<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438:<\/p>\n<pre><code class=\"language-bash\">apt install php8.2-mysqli\n<\/code><\/pre>\n<p><strong>\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441: <code>php&lt;\u0432\u0435\u0440\u0441\u0438\u044f&gt;-&lt;\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435&gt;<\/code>.<\/strong><\/p>\n<hr \/>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 PHP<\/h2>\n<p>\u0412 Ubuntu \u043a\u043e\u043d\u0444\u0438\u0433\u0438 PHP \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u044b \u043f\u043e \u0432\u0435\u0440\u0441\u0438\u044f\u043c \u0438 \u043f\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0443 \u0437\u0430\u043f\u0443\u0441\u043a\u0430. \u0414\u043b\u044f PHP 8.3:<\/p>\n<p><strong>CLI:<\/strong><\/p>\n<pre><code class=\"language-bash\">vi \/etc\/php\/8.3\/cli\/php.ini\n<\/code><\/pre>\n<p><strong>Apache:<\/strong><\/p>\n<pre><code class=\"language-bash\">vi \/etc\/php\/8.3\/apache2\/php.ini\n<\/code><\/pre>\n<p><strong>FPM:<\/strong><\/p>\n<pre><code class=\"language-bash\">vi \/etc\/php\/8.3\/fpm\/php.ini\n<\/code><\/pre>\n<p><strong>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0438 \u2014 \u0432 <code>\/etc\/php\/8.3\/{cli,fpm,apache2}\/conf.d\/<\/code>.<\/strong><\/p>\n<hr \/>\n<h2>\u0422\u043e\u043d\u043a\u043e\u0441\u0442\u0438 \u0438 \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0435 \u043a\u0430\u043c\u043d\u0438<\/h2>\n<ul>\n<li><strong>PPA <code>ondrej\/php<\/code><\/strong> \u2014 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0441\u0432\u0435\u0436\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 PHP \u0434\u043b\u044f Ubuntu; \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e\u043c.<\/li>\n<li><strong><code>update-alternatives<\/code><\/strong> \u2014 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e CLI-\u0432\u0435\u0440\u0441\u0438\u044e; \u0434\u043b\u044f FPM\/Apache \u0432\u0435\u0440\u0441\u0438\u044f \u0437\u0430\u0434\u0430\u0451\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438 (<code>php8.2-fpm<\/code>) \u0438 \u043c\u043e\u0434\u0443\u043b\u0435\u043c Apache.<\/li>\n<li><strong>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e FPM-\u043f\u0443\u043b\u043e\u0432<\/strong> \u2014 \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0430\u0439\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043d\u044f\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 <code>php-fpm<\/code> \u0438 \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u0438\u0445 \u0441 NGINX\/Apache \u0447\u0435\u0440\u0435\u0437 \u0441\u043e\u043a\u0435\u0442\u044b.<\/li>\n<li><strong>\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f<\/strong> \u2014 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0441\u0442\u0430\u0432\u044f\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e; <code>php -m<\/code> \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u043e\u0434\u0443\u043b\u0438 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 CLI-\u0432\u0435\u0440\u0441\u0438\u0438.<\/li>\n<li><strong><code>gnupg-agent<\/code> \u0438 <code>python3-launchpadlib<\/code><\/strong> \u2014 \u0447\u0430\u0441\u0442\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0434\u043b\u044f <code>add-apt-repository<\/code> \u043d\u0430 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445.<\/li>\n<li><strong>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u0441\u0438\u0438<\/strong> \u2014 <code>apt purge php8.2*<\/code> \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439, \u0447\u0442\u043e \u043e\u043d\u0430 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0430\u0439\u0442\u0430\u043c\u0438.<\/li>\n<li><strong>\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438<\/strong> \u2014 \u0441\u043b\u0435\u0434\u0438\u0442\u0435 \u0437\u0430 \u0432\u0435\u0440\u0441\u0438\u044f\u043c\u0438: \u0441\u0442\u0430\u0440\u044b\u0435 \u0432\u0435\u0442\u043a\u0438 (7.x) \u0443\u0436\u0435 EOL \u0438 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u043f\u0430\u0442\u0447\u0435\u0439.<\/li>\n<\/ul>\n<hr \/>\n<h2>\u0428\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u0430<\/h2>\n<pre><code class=\"language-bash\"># \u0431\u0430\u0437\u043e\u0432\u0430\u044f\napt install php\n\n# \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f\napt install software-properties-common\nadd-apt-repository ppa:ondrej\/php\napt install php8.3\n\n# \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 CLI\nupdate-alternatives --config php\n\n# \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f\napt install php8.3-mysqli php8.3-curl php8.3-mbstring\n\n# \u043a\u043e\u043d\u0444\u0438\u0433\u0438\n\/etc\/php\/8.3\/{cli,fpm,apache2}\/php.ini\n<\/code><\/pre>\n<p><em>\u041f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043e \u043d\u0430: Ubuntu 22.04\/24.04\/26.04 + PHP 8.1\u20138.4 (PPA ondrej\/php).<\/em><br \/>\n<em>\u0414\u0430\u0442\u0430: \u0421\u0435\u043d\u0442\u044f\u0431\u0440\u044c 2026.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 PHP \u043d\u0430 Ubuntu \u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438<\/p>\n","protected":false},"author":0,"featured_media":971,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-933","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"aioseo_notices":[],"views":11,"_links":{"self":[{"href":"https:\/\/imaxis.ru\/index.php?rest_route=\/wp\/v2\/posts\/933","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/imaxis.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/imaxis.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/imaxis.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=933"}],"version-history":[{"count":2,"href":"https:\/\/imaxis.ru\/index.php?rest_route=\/wp\/v2\/posts\/933\/revisions"}],"predecessor-version":[{"id":936,"href":"https:\/\/imaxis.ru\/index.php?rest_route=\/wp\/v2\/posts\/933\/revisions\/936"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/imaxis.ru\/index.php?rest_route=\/wp\/v2\/media\/971"}],"wp:attachment":[{"href":"https:\/\/imaxis.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=933"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/imaxis.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=933"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/imaxis.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=933"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}