{"id":234,"date":"2025-09-17T10:45:51","date_gmt":"2025-09-17T10:45:51","guid":{"rendered":"https:\/\/linuxbase.io\/?p=234"},"modified":"2025-09-17T10:45:51","modified_gmt":"2025-09-17T10:45:51","slug":"php-version-unter-linux-prufen-alle-versionen-anzeigen","status":"publish","type":"post","link":"https:\/\/netguide.io\/linux\/de\/php-version-unter-linux-prufen-alle-versionen-anzeigen\/","title":{"rendered":"PHP-Version unter Linux pr\u00fcfen: Alle Versionen anzeigen"},"content":{"rendered":"\n<p>Ich stehe selber oft vor dem Problem: Ich habe ein Linux-System, auf dem mehrere PHP-Versionen installiert sein k\u00f6nnten, und ich will schnell herausfinden, welche gerade aktiv sind. Besonders tricky wird es, wenn man nicht nur PHP-FPM, sondern auch andere PHP-Dienste im Einsatz hat.<\/p>\n\n\n\n<p>Normalerweise nutze ich daf\u00fcr diesen Befehl:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2\"><span style=\"padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#24292e\"><\/span><span role=\"button\" style=\"color:#e1e4e8\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" aria-hidden=\"true\" readonly>systemctl list-units --type=service | grep -E 'php&#091;0-9.&#093;+-fpm'\n<\/textarea><\/pre><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\"><code><span class=\"line\"><span style=\"color: #B392F0\">systemctl<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">list-units<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">--type=service<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">|<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #B392F0\">grep<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">-E<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&#039;php&#091;0-9.&#093;+-fpm&#039;<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>Damit bekomme ich alle aktiven PHP-FPM-Services angezeigt, also zum Beispiel <code>php7.4-fpm<\/code> oder <code>php8.1-fpm<\/code>. Das ist super praktisch, wenn man mit FPM arbeitet &#8211; aber was ist, wenn PHP als CLI oder in anderen Diensten l\u00e4uft?<\/p>\n\n\n\n<p>Eine erweiterte Version, die auch andere PHP-Services findet, sieht so aus:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2\"><span style=\"padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#24292e\"><\/span><span role=\"button\" style=\"color:#e1e4e8\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" aria-hidden=\"true\" readonly>systemctl list-units --type=service | grep -E 'php&#091;0-9.&#093;+(-fpm)?'\n<\/textarea><\/pre><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\"><code><span class=\"line\"><span style=\"color: #B392F0\">systemctl<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">list-units<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">--type=service<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">|<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #B392F0\">grep<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">-E<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&#039;php&#091;0-9.&#093;+(-fpm)?&#039;<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>Das <code>(-fpm)?<\/code> sorgt daf\u00fcr, dass sowohl <code>php7.4-fpm<\/code> als auch <code>php8.1<\/code> ohne FPM angezeigt werden. So hat man auf einen Blick alle aktiven PHP-Versionen auf dem System.<\/p>\n\n\n\n<p>Wenn ihr zus\u00e4tzlich noch wissen wollt, welche PHP-Version gerade in der CLI aktiv ist, k\u00f6nnt ihr einfach folgendes ausf\u00fchren:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2\"><span style=\"padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#24292e\"><\/span><span role=\"button\" style=\"color:#e1e4e8\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" aria-hidden=\"true\" readonly>php -v\n<\/textarea><\/pre><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\"><code><span class=\"line\"><span style=\"color: #B392F0\">php<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">-v<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>Damit seht ihr die Version, die beim Befehl <code>php<\/code> aufgerufen wird &#8211; praktisch, wenn man verschiedene Versionen installiert hat.<\/p>\n\n\n\n<p>F\u00fcr mich ist diese Kombination aus <code>systemctl<\/code> + <code>php -v<\/code> der einfachste Weg, um schnell den \u00dcberblick \u00fcber PHP auf einem Server zu bekommen. Ich hoffe, der kleine Tipp hilft euch genauso wie mir!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ich stehe selber oft vor dem Problem: Ich habe ein Linux-System, auf dem mehrere PHP-Versionen installiert sein k\u00f6nnten, und ich [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":332,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[9],"tags":[],"class_list":["post-234","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"uagb_featured_image_src":{"full":["https:\/\/netguide.io\/linux\/wp-content\/uploads\/sites\/2\/2025\/09\/php.png",1920,1080,false],"thumbnail":["https:\/\/netguide.io\/linux\/wp-content\/uploads\/sites\/2\/2025\/09\/php-150x150.png",150,150,true],"medium":["https:\/\/netguide.io\/linux\/wp-content\/uploads\/sites\/2\/2025\/09\/php-300x169.png",300,169,true],"medium_large":["https:\/\/netguide.io\/linux\/wp-content\/uploads\/sites\/2\/2025\/09\/php-768x432.png",768,432,true],"large":["https:\/\/netguide.io\/linux\/wp-content\/uploads\/sites\/2\/2025\/09\/php-1024x576.png",1024,576,true],"1536x1536":["https:\/\/netguide.io\/linux\/wp-content\/uploads\/sites\/2\/2025\/09\/php-1536x864.png",1536,864,true],"2048x2048":["https:\/\/netguide.io\/linux\/wp-content\/uploads\/sites\/2\/2025\/09\/php.png",1920,1080,false]},"uagb_author_info":{"display_name":"tobias.pries","author_link":"https:\/\/netguide.io\/linux\/author\/tobias-pries\/"},"uagb_comment_info":0,"uagb_excerpt":"Ich stehe selber oft vor dem Problem: Ich habe ein Linux-System, auf dem mehrere PHP-Versionen installiert sein k\u00f6nnten, und ich [&hellip;]","_links":{"self":[{"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/posts\/234","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/comments?post=234"}],"version-history":[{"count":0,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/posts\/234\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/media\/332"}],"wp:attachment":[{"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/media?parent=234"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/categories?post=234"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/tags?post=234"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}