{"id":2400,"date":"2022-09-26T03:57:17","date_gmt":"2022-09-26T03:57:17","guid":{"rendered":"https:\/\/www.iseepassword.com\/blog\/how-to-check-php-version-in-linux\/"},"modified":"2023-10-10T10:49:37","modified_gmt":"2023-10-10T10:49:37","slug":"how-to-check-php-version-in-linux","status":"publish","type":"post","link":"https:\/\/www.iseepassword.com\/blog\/how-to-check-php-version-in-linux\/","title":{"rendered":"how to check php version in linux?"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_69_1 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.iseepassword.com\/blog\/how-to-check-php-version-in-linux\/#What_is_my_PHP_version_Linux\" title=\"What is my PHP version Linux?\">What is my PHP version Linux?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.iseepassword.com\/blog\/how-to-check-php-version-in-linux\/#How_do_I_check_my_PHP_version\" title=\"How do I check my PHP version?\">How do I check my PHP version?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.iseepassword.com\/blog\/how-to-check-php-version-in-linux\/#What_version_of_PHP_is_on_my_server\" title=\"What version of PHP is on my server?\">What version of PHP is on my server?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.iseepassword.com\/blog\/how-to-check-php-version-in-linux\/#Is_PHP_on_Linux\" title=\"Is PHP on Linux?\">Is PHP on Linux?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.iseepassword.com\/blog\/how-to-check-php-version-in-linux\/#How_do_I_know_if_PHP_is_installed_on_Linux\" title=\"How do I know if PHP is installed on Linux?\">How do I know if PHP is installed on Linux?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.iseepassword.com\/blog\/how-to-check-php-version-in-linux\/#Where_is_PHP_installed_in_Linux\" title=\"Where is PHP installed in Linux?\">Where is PHP installed in Linux?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.iseepassword.com\/blog\/how-to-check-php-version-in-linux\/#Whats_the_latest_version_of_PHP\" title=\"What&#8217;s the latest version of PHP?\">What&#8217;s the latest version of PHP?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.iseepassword.com\/blog\/how-to-check-php-version-in-linux\/#What_PHP_site_is_running\" title=\"What PHP site is running?\">What PHP site is running?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.iseepassword.com\/blog\/how-to-check-php-version-in-linux\/#How_do_I_update_PHP_version_on_Linux_server\" title=\"How do I update PHP version on Linux server?\">How do I update PHP version on Linux server?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.iseepassword.com\/blog\/how-to-check-php-version-in-linux\/#How_do_I_start_PHP_in_Linux\" title=\"How do I start PHP in Linux?\">How do I start PHP in Linux?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.iseepassword.com\/blog\/how-to-check-php-version-in-linux\/#How_do_I_install_the_latest_version_of_PHP_in_Linux\" title=\"How do I install the latest version of PHP in Linux?\">How do I install the latest version of PHP in Linux?<\/a><\/li><\/ul><\/nav><\/div>\n<p>To check the version of PHP installed on a Linux system, you can use the following command:<\/p>\n<p>php -v<\/p>\n<p>This will output something like:<\/p>\n<p>PHP 7.2.34 (cli) (built: Mar 24 2020 20:13:37) ( NTS )<br \/>\nCopyright (c) 1997-2018 The PHP Group<br \/>\nZend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies<\/p>\n<h2><span class=\"ez-toc-section\" id=\"What_is_my_PHP_version_Linux\"><\/span>What is my PHP version Linux?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><\/p>\n<h2><span class=\"ez-toc-section\" id=\"How_do_I_check_my_PHP_version\"><\/span>How do I check my PHP version?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The easiest way to check your PHP version is to create a file named &#8220;version.php&#8221; in your document root with the following contents: <\/p>\n<p>Save the file and then load it in a web browser. The output will show you which PHP version you are using.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"What_version_of_PHP_is_on_my_server\"><\/span>What version of PHP is on my server?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The best way to find out which version of PHP is running on your server is to create a simple PHP script, containing the following line of code:<\/p>\n<p>Save the file as &#8220;phpinfo.php&#8221; and upload it to your web server. When you visit the page in your web browser, you should see information about your PHP configuration, including the version number.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Is_PHP_on_Linux\"><\/span>Is PHP on Linux?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Yes, PHP is available for many operating systems, including Linux.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"How_do_I_know_if_PHP_is_installed_on_Linux\"><\/span>How do I know if PHP is installed on Linux?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The easiest way to determine if PHP is installed on a Linux system is to use the command line. At the command prompt, simply type &#8220;php -v&#8221; (without the quotes). If PHP is installed, you will see something similar to the following output:<\/p>\n<p>PHP 5.3.3 (cli) (built: Jul  4 2012 00:43:23)<br \/>\nCopyright (c) 1997-2010 The PHP Group<br \/>\nZend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies<\/p>\n<p>If you do not see any output or an error message, this means that PHP is not installed on your system.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Where_is_PHP_installed_in_Linux\"><\/span>Where is PHP installed in Linux?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>PHP is usually installed in \/usr\/local\/bin on Linux systems.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Whats_the_latest_version_of_PHP\"><\/span>What&#8217;s the latest version of PHP?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The latest stable version of PHP is 7.4.8.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"What_PHP_site_is_running\"><\/span>What PHP site is running?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>There is no definitive answer to this question as it depends on the specific website in question. However, some tips that may be useful include checking the website&#8217;s source code for clues, or using a tool like Wappalyzer (https:\/\/www.wappalyzer.com\/) which can often detect which CMS or framework a website is running.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"How_do_I_update_PHP_version_on_Linux_server\"><\/span>How do I update PHP version on Linux server?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>To update PHP version on Linux server, follow these steps:<\/p>\n<p>1. Login to your server via SSH as the root user.<br \/>\n2. Run the command &#8216;yum update php&#8217;. This will update PHP to the latest stable version.<br \/>\n3. If you need to upgrade to a specific PHP version, you can use the &#8216;yum install&#8217; command followed by the desired PHP version number. For example, &#8216;yum install php56w&#8217; will install PHP 5.6 on your server.<br \/>\n4. Once the installation is complete, run the command &#8216;php -v&#8217; to verify that the new PHP version is now active.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"How_do_I_start_PHP_in_Linux\"><\/span>How do I start PHP in Linux?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>In order to start PHP in Linux, you will need to install the PHP package. Once you have installed the PHP package, you will need to create a file called &#8220;php.ini&#8221; in the \/etc\/ directory. In this file, you will need to add the following lines:<\/p>\n<p>; Enable extensions extension=bz2.so extension=curl.so extension=gd.so extension=intl.so ; Enable PEAR packages include_path = &#8220;\/usr\/share\/pear&#8221; ; Change this line if you installed PHP outside of &#8220;\/usr&#8221; ;extension=mysqlnd.so ; Use mysqlnd instead of libmysqlclient (default since php 5.6)<br \/>\nAfter you have added these lines to your php.ini file, you will need to restart your web server in order for the changes to take effect.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"How_do_I_install_the_latest_version_of_PHP_in_Linux\"><\/span>How do I install the latest version of PHP in Linux?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The latest stable version of PHP can be downloaded from the php.net website (https:\/\/www.php.net\/downloads.php). <\/p>\n<p>To install PHP on a Linux system, you will need to have root access to the server. Once you have logged in as root, use the following commands to download and extract the PHP source code:<\/p>\n<p>wget https:\/\/www.php.net\/distributions\/php-7.3.5.tar.gz<br \/>\ntar -xzvf php-7.3.5.tar<br \/>\n{&#8220;@context&#8221;:&#8221;https:\/\/schema.org&#8221;,&#8221;@type&#8221;:&#8221;FAQPage&#8221;,&#8221;mainEntity&#8221;:[{&#8220;@type&#8221;:&#8221;Question&#8221;,&#8221;name&#8221;:&#8221;How do I check my PHP version?&#8221;,&#8221;acceptedAnswer&#8221;:{&#8220;@type&#8221;:&#8221;Answer&#8221;,&#8221;text&#8221;:&#8221;nnThe easiest way to check your PHP version is to create a file named &#8220;version.php&#8221; in your document root with the following contents: nnnnSave the file and then load it in a web browser. The output will show you which PHP version you are using.&#8221;}},{&#8220;@type&#8221;:&#8221;Question&#8221;,&#8221;name&#8221;:&#8221;What version of PHP is on my server?&#8221;,&#8221;acceptedAnswer&#8221;:{&#8220;@type&#8221;:&#8221;Answer&#8221;,&#8221;text&#8221;:&#8221;nnThe best way to find out which version of PHP is running on your server is to create a simple PHP script, containing the following line of code:nnnnSave the file as &#8220;phpinfo.php&#8221; and upload it to your web server. When you visit the page in your web browser, you should see information about your PHP configuration, including the version number.&#8221;}},{&#8220;@type&#8221;:&#8221;Question&#8221;,&#8221;name&#8221;:&#8221;Is PHP on Linux?&#8221;,&#8221;acceptedAnswer&#8221;:{&#8220;@type&#8221;:&#8221;Answer&#8221;,&#8221;text&#8221;:&#8221;nnYes, PHP is available for many operating systems, including Linux.&#8221;}},{&#8220;@type&#8221;:&#8221;Question&#8221;,&#8221;name&#8221;:&#8221;How do I know if PHP is installed on Linux?&#8221;,&#8221;acceptedAnswer&#8221;:{&#8220;@type&#8221;:&#8221;Answer&#8221;,&#8221;text&#8221;:&#8221;nnThe easiest way to determine if PHP is installed on a Linux system is to use the command line. At the command prompt, simply type &#8220;php -v&#8221; (without the quotes). If PHP is installed, you will see something similar to the following output:nnPHP 5.3.3 (cli) (built: Jul  4 2012 00:43:23) nCopyright (c) 1997-2010 The PHP GroupnZend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologiesn   nIf you do not see any output or an error message, this means that PHP is not installed on your system.&#8221;}},{&#8220;@type&#8221;:&#8221;Question&#8221;,&#8221;name&#8221;:&#8221;Where is PHP installed in Linux?&#8221;,&#8221;acceptedAnswer&#8221;:{&#8220;@type&#8221;:&#8221;Answer&#8221;,&#8221;text&#8221;:&#8221;nnPHP is usually installed in \/usr\/local\/bin on Linux systems.&#8221;}},{&#8220;@type&#8221;:&#8221;Question&#8221;,&#8221;name&#8221;:&#8221;What&#8217;s the latest version of PHP?&#8221;,&#8221;acceptedAnswer&#8221;:{&#8220;@type&#8221;:&#8221;Answer&#8221;,&#8221;text&#8221;:&#8221;nnThe latest stable version of PHP is 7.4.8.&#8221;}},{&#8220;@type&#8221;:&#8221;Question&#8221;,&#8221;name&#8221;:&#8221;What PHP site is running?&#8221;,&#8221;acceptedAnswer&#8221;:{&#8220;@type&#8221;:&#8221;Answer&#8221;,&#8221;text&#8221;:&#8221;nnThere is no definitive answer to this question as it depends on the specific website in question. However, some tips that may be useful include checking the website&#8217;s source code for clues, or using a tool like Wappalyzer (https:\/\/www.wappalyzer.com\/) which can often detect which CMS or framework a website is running.&#8221;}},{&#8220;@type&#8221;:&#8221;Question&#8221;,&#8221;name&#8221;:&#8221;How do I update PHP version on Linux server?&#8221;,&#8221;acceptedAnswer&#8221;:{&#8220;@type&#8221;:&#8221;Answer&#8221;,&#8221;text&#8221;:&#8221;nnTo update PHP version on Linux server, follow these steps:nn1. Login to your server via SSH as the root user.n2. Run the command &#8216;yum update php&#8217;. This will update PHP to the latest stable version.n3. If you need to upgrade to a specific PHP version, you can use the &#8216;yum install&#8217; command followed by the desired PHP version number. For example, &#8216;yum install php56w&#8217; will install PHP 5.6 on your server. n4. Once the installation is complete, run the command &#8216;php -v&#8217; to verify that the new PHP version is now active.&#8221;}},{&#8220;@type&#8221;:&#8221;Question&#8221;,&#8221;name&#8221;:&#8221;How do I start PHP in Linux?&#8221;,&#8221;acceptedAnswer&#8221;:{&#8220;@type&#8221;:&#8221;Answer&#8221;,&#8221;text&#8221;:&#8221;nnIn order to start PHP in Linux, you will need to install the PHP package. Once you have installed the PHP package, you will need to create a file called &#8220;php.ini&#8221; in the \/etc\/ directory. In this file, you will need to add the following lines:nn; Enable extensions extension=bz2.so extension=curl.so extension=gd.so extension=intl.so ; Enable PEAR packages include_path = &#8220;\/usr\/share\/pear&#8221; ; Change this line if you installed PHP outside of &#8220;\/usr&#8221; ;extension=mysqlnd.so ; Use mysqlnd instead of libmysqlclient (default since php 5.6) nAfter you have added these lines to your php.ini file, you will need to restart your web server in order for the changes to take effect.&#8221;}},{&#8220;@type&#8221;:&#8221;Question&#8221;,&#8221;name&#8221;:&#8221;How do I install the latest version of PHP in Linux?&#8221;,&#8221;acceptedAnswer&#8221;:{&#8220;@type&#8221;:&#8221;Answer&#8221;,&#8221;text&#8221;:&#8221;nnThe latest stable version of PHP can be downloaded from the php.net website (https:\/\/www.php.net\/downloads.php). nnTo install PHP on a Linux system, you will need to have root access to the server. Once you have logged in as root, use the following commands to download and extract the PHP source code:nnwget https:\/\/www.php.net\/distributions\/php-7.3.5.tar.gzntar -xzvf php-7.3.5.tar&#8221;}}]}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To check the version of PHP installed on a Linux system, you can use the following command: php -v This will output something like: PHP 7.2.34 (cli) (built: Mar 24 2020 20:13:37) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies What is my PHP version Linux? [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","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":"","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-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":"","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-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":"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":""},"mobile":{"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":""}},"footnotes":""},"categories":[51],"tags":[],"class_list":["post-2400","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.iseepassword.com\/blog\/wp-json\/wp\/v2\/posts\/2400","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.iseepassword.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.iseepassword.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.iseepassword.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.iseepassword.com\/blog\/wp-json\/wp\/v2\/comments?post=2400"}],"version-history":[{"count":1,"href":"https:\/\/www.iseepassword.com\/blog\/wp-json\/wp\/v2\/posts\/2400\/revisions"}],"predecessor-version":[{"id":11712,"href":"https:\/\/www.iseepassword.com\/blog\/wp-json\/wp\/v2\/posts\/2400\/revisions\/11712"}],"wp:attachment":[{"href":"https:\/\/www.iseepassword.com\/blog\/wp-json\/wp\/v2\/media?parent=2400"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.iseepassword.com\/blog\/wp-json\/wp\/v2\/categories?post=2400"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.iseepassword.com\/blog\/wp-json\/wp\/v2\/tags?post=2400"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}