{"id":107,"date":"2026-02-05T20:52:41","date_gmt":"2026-02-05T20:52:41","guid":{"rendered":"https:\/\/www.hokutotokisama.fr\/?p=107"},"modified":"2026-02-08T16:21:06","modified_gmt":"2026-02-08T16:21:06","slug":"installation-de-php-sur-ubuntu","status":"publish","type":"post","link":"https:\/\/www.hokutotokisama.fr\/?p=107","title":{"rendered":"Installation de PHP sur Ubuntu"},"content":{"rendered":"\n<p>Avant d&rsquo;installer PHP sur Ubuntu il faut avoir install\u00e9 Apache.<\/p>\n\n\n\n<p>Pour installer apache, le tuto se trouve <a href=\"https:\/\/www.hokutotokisama.fr\/?p=85\" data-type=\"link\" data-id=\"https:\/\/www.hokutotokisama.fr\/?p=85\">ici<\/a><\/p>\n\n\n\n<p class=\"has-x-large-font-size\"><strong>1 &#8211; V\u00e9rifier la version disponible pour php<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt list php<\/code><\/pre>\n\n\n\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;6a05ffc9b0609&quot;}\" data-wp-interactive=\"core\/image\" data-wp-key=\"6a05ffc9b0609\" class=\"wp-block-image size-full wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"388\" height=\"60\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hokutotokisama.fr\/wp-content\/uploads\/2026\/02\/Capture-decran-2026-02-05-213258.png\" alt=\"\" class=\"wp-image-108\" srcset=\"https:\/\/www.hokutotokisama.fr\/wp-content\/uploads\/2026\/02\/Capture-decran-2026-02-05-213258.png 388w, https:\/\/www.hokutotokisama.fr\/wp-content\/uploads\/2026\/02\/Capture-decran-2026-02-05-213258-300x46.png 300w\" sizes=\"auto, (max-width: 388px) 100vw, 388px\" \/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\taria-label=\"Agrandir\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.imageButtonRight\"\n\t\t\tdata-wp-style--top=\"state.imageButtonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n\n\n\n<p>Dans mon exemple et \u00e0 l&rsquo;heure o\u00f9 j\u2019\u00e9cris, la derni\u00e8re version disponible est la 8.4<\/p>\n\n\n\n<p class=\"has-x-large-font-size\"><strong>2 &#8211; Installation de php<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install php8.4 libapache2-mod-php8.4 php-common php8.4-cli php8.4-common php8.4-opcache php8.4-readline<\/code><\/pre>\n\n\n\n<p>Nb : il faut penser \u00e0 changer le num\u00e9ro de la version en fonction de la version disponible de l&rsquo;on a<\/p>\n\n\n\n<p>Nb 2 : on peux rajouter php8.4-mysql dans la liste si on veux mettre un phpmyadmin par exemple par la suite<\/p>\n\n\n\n<p class=\"has-x-large-font-size\"><strong>3 &#8211; Activation du module PHP pour Apache et redemarage de Apache<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo a2enmod php8.4\nsudo systemctl restart apache2<\/code><\/pre>\n\n\n\n<p>Nb : Attention au num\u00e9ro<\/p>\n\n\n\n<p class=\"has-x-large-font-size\"><strong>4 &#8211; Test que tout fonctionne<\/strong><\/p>\n\n\n\n<p>On cr\u00e9e un fichier phpinfo.php dans \/var\/www\/html\/phpinfo.php et on le rempli avec &lt;?php phpinfo();?&gt;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/var\/www\/html\/phpinfo.php<\/code><\/pre>\n\n\n\n<p>On lance la page sur notre navigateur<\/p>\n\n\n\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;6a05ffc9b0a52&quot;}\" data-wp-interactive=\"core\/image\" data-wp-key=\"6a05ffc9b0a52\" class=\"wp-block-image size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"758\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hokutotokisama.fr\/wp-content\/uploads\/2026\/02\/Capture-decran-2026-02-05-214221-1024x758.png\" alt=\"\" class=\"wp-image-109\" srcset=\"https:\/\/www.hokutotokisama.fr\/wp-content\/uploads\/2026\/02\/Capture-decran-2026-02-05-214221-1024x758.png 1024w, https:\/\/www.hokutotokisama.fr\/wp-content\/uploads\/2026\/02\/Capture-decran-2026-02-05-214221-300x222.png 300w, https:\/\/www.hokutotokisama.fr\/wp-content\/uploads\/2026\/02\/Capture-decran-2026-02-05-214221-768x568.png 768w, https:\/\/www.hokutotokisama.fr\/wp-content\/uploads\/2026\/02\/Capture-decran-2026-02-05-214221-1536x1137.png 1536w, https:\/\/www.hokutotokisama.fr\/wp-content\/uploads\/2026\/02\/Capture-decran-2026-02-05-214221.png 1715w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\taria-label=\"Agrandir\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.imageButtonRight\"\n\t\t\tdata-wp-style--top=\"state.imageButtonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n\n\n\n<p class=\"has-x-large-font-size\"><strong>5 &#8211; Activation de PHP FPM qui permet d\u2019acc\u00e9l\u00e9rer le serveur web. La documentation du PHP FPM se trouve <a href=\"https:\/\/www.php.net\/manual\/fr\/install.fpm.php\">ici<\/a><\/strong><\/p>\n\n\n\n<p>5.1 &#8211; D\u00e9sactiver le module de base<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo a2dismod php8.4<\/code><\/pre>\n\n\n\n<p>(Toujours attention au num\u00e9ro)<\/p>\n\n\n\n<p>5.2 &#8211; Activation du module PHP FPM<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install php8.4-fpm<\/code><\/pre>\n\n\n\n<p>(Toujours attention au num\u00e9ro)<\/p>\n\n\n\n<p>5.3 &#8211; Activation des modules proxy_fcgi et setenvif<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo a2enmod proxy_fcgi setenvif<\/code><\/pre>\n\n\n\n<p>5.4 &#8211; Activation du fichier de configuration FPM<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo a2enconf php8.4-fpm<\/code><\/pre>\n\n\n\n<p>(Toujours attention au num\u00e9ro)<\/p>\n\n\n\n<p class=\"has-x-large-font-size\"><strong>6 &#8211; Red\u00e9marrage du serveur apache et v\u00e9rification<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart apache2<\/code><\/pre>\n\n\n\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;6a05ffc9b0ddd&quot;}\" data-wp-interactive=\"core\/image\" data-wp-key=\"6a05ffc9b0ddd\" class=\"wp-block-image size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"424\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.hokutotokisama.fr\/wp-content\/uploads\/2026\/02\/Capture-decran-2026-02-05-215033-1024x424.png\" alt=\"\" class=\"wp-image-110\" srcset=\"https:\/\/www.hokutotokisama.fr\/wp-content\/uploads\/2026\/02\/Capture-decran-2026-02-05-215033-1024x424.png 1024w, https:\/\/www.hokutotokisama.fr\/wp-content\/uploads\/2026\/02\/Capture-decran-2026-02-05-215033-300x124.png 300w, https:\/\/www.hokutotokisama.fr\/wp-content\/uploads\/2026\/02\/Capture-decran-2026-02-05-215033-768x318.png 768w, https:\/\/www.hokutotokisama.fr\/wp-content\/uploads\/2026\/02\/Capture-decran-2026-02-05-215033-1536x637.png 1536w, https:\/\/www.hokutotokisama.fr\/wp-content\/uploads\/2026\/02\/Capture-decran-2026-02-05-215033.png 1783w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\taria-label=\"Agrandir\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.imageButtonRight\"\n\t\t\tdata-wp-style--top=\"state.imageButtonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n\n\n\n<p>Apache utilise d\u00e9sormais FPM<\/p>\n\n\n\n<p class=\"has-x-large-font-size\"><strong>7 &#8211; La suite<\/strong><\/p>\n\n\n\n<p>On peux, si on veux, <a href=\"https:\/\/www.hokutotokisama.fr\/?p=119\" data-type=\"link\" data-id=\"https:\/\/www.hokutotokisama.fr\/?p=119\">installer mariadb<\/a><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Avant d&rsquo;installer PHP sur Ubuntu il faut avoir install\u00e9 Apache. Pour installer apache, le tuto se trouve ici 1 &#8211; V\u00e9rifier la version disponible pour php Dans mon exemple et \u00e0 l&rsquo;heure o\u00f9 j\u2019\u00e9cris, la derni\u00e8re version disponible est la 8.4 2 &#8211; Installation de php Nb : il faut penser \u00e0 changer le num\u00e9ro [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[20,21],"class_list":["post-107","post","type-post","status-publish","format-standard","hentry","category-linux","tag-apache","tag-php"],"_links":{"self":[{"href":"https:\/\/www.hokutotokisama.fr\/index.php?rest_route=\/wp\/v2\/posts\/107","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hokutotokisama.fr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hokutotokisama.fr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hokutotokisama.fr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hokutotokisama.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=107"}],"version-history":[{"count":3,"href":"https:\/\/www.hokutotokisama.fr\/index.php?rest_route=\/wp\/v2\/posts\/107\/revisions"}],"predecessor-version":[{"id":170,"href":"https:\/\/www.hokutotokisama.fr\/index.php?rest_route=\/wp\/v2\/posts\/107\/revisions\/170"}],"wp:attachment":[{"href":"https:\/\/www.hokutotokisama.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hokutotokisama.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=107"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hokutotokisama.fr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}