{"id":1368,"date":"2023-12-20T18:00:21","date_gmt":"2023-12-20T18:00:21","guid":{"rendered":"https:\/\/www.devopssupport.in\/blog\/?p=1368"},"modified":"2023-12-28T16:15:06","modified_gmt":"2023-12-28T16:15:06","slug":"laravel-error-php-artisan-serve-command-php-is-not-recognized","status":"publish","type":"post","link":"https:\/\/www.devopssupport.in\/blog\/laravel-error-php-artisan-serve-command-php-is-not-recognized\/","title":{"rendered":"Laravel Error &#8220;php artisan serve&#8221; Command: &#8216;php&#8217; is not recognized"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.devopssupport.in\/blog\/wp-content\/uploads\/2023\/12\/image-15-1024x133.png\" alt=\"\" class=\"wp-image-1369\" width=\"877\" height=\"114\" srcset=\"https:\/\/www.devopssupport.in\/blog\/wp-content\/uploads\/2023\/12\/image-15-1024x133.png 1024w, https:\/\/www.devopssupport.in\/blog\/wp-content\/uploads\/2023\/12\/image-15-300x39.png 300w, https:\/\/www.devopssupport.in\/blog\/wp-content\/uploads\/2023\/12\/image-15-768x99.png 768w, https:\/\/www.devopssupport.in\/blog\/wp-content\/uploads\/2023\/12\/image-15-850x110.png 850w, https:\/\/www.devopssupport.in\/blog\/wp-content\/uploads\/2023\/12\/image-15.png 1436w\" sizes=\"auto, (max-width: 877px) 100vw, 877px\" \/><\/figure>\n\n\n\n<p><strong><br>Title: Troubleshooting &#8220;php artisan serve&#8221; Command: &#8216;php&#8217; is not recognized<\/strong><\/p>\n\n\n\n<p><strong>Introduction:<\/strong> Running into the error &#8220;The term &#8216;php&#8217; is not recognized as the name of a cmdlet, function, script file, or operable program&#8221; when trying to use the <code>php artisan serve<\/code> command in Laravel can be frustrating. This issue is commonly encountered on Windows systems, and it is typically due to the PHP executable not being recognized in the system environment.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php : The term 'php' is not recognized as the name of a cmdlet, function, script file, or operable program.\nCheck the spelling of the name, or if a path was included, verify that the path is correct and try again.\nAt line:1 char:1\n+ php artisan serve\n+ ~~~\n    + CategoryInfo          : ObjectNotFound: (php:String) &#91;], CommandNotFoundException\n    + FullyQualifiedErrorId : CommandNotFoundException\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>PHP not in the System PATH:<\/strong>\n<ul class=\"wp-block-list\">\n<li>The PHP executable is not added to the system&#8217;s PATH variable, preventing the command prompt from recognizing the &#8216;php&#8217; command.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p><strong>Solution:<\/strong><\/p>\n\n\n\n<p><strong>Option 1: Add PHP to the System PATH<\/strong><\/p>\n\n\n\n<p><strong>Step 1: Find PHP Installation Directory<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Locate the directory where PHP is installed. Common paths include <code>C:\\xampp\\php<\/code> or <code>C:\\wamp\\bin\\php\\phpx.x.x<\/code>.<\/li>\n<\/ul>\n\n\n\n<p><strong>Step 2: Add PHP to the System PATH<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Right-click on &#8220;This PC&#8221; or &#8220;Computer&#8221; on your desktop or in File Explorer.<\/li>\n\n\n\n<li>Select &#8220;Properties.&#8221;<\/li>\n\n\n\n<li>Click on &#8220;Advanced system settings&#8221; on the left.<\/li>\n\n\n\n<li>Click the &#8220;Environment Variables&#8221; button.<\/li>\n\n\n\n<li>In the &#8220;System variables&#8221; section, select the &#8220;Path&#8221; variable, then click &#8220;Edit.&#8221;<\/li>\n\n\n\n<li>Click &#8220;New&#8221; and add the path to the PHP executable (e.g., <code>C:\\xampp\\php<\/code>).<\/li>\n<\/ul>\n\n\n\n<p><strong>Step 3: Open a New Command Prompt<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Close any existing command prompt windows and open a new one to apply the changes.<\/li>\n<\/ul>\n\n\n\n<p><strong>Step 4: Retry the Artisan Command<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Run <code>php artisan serve<\/code> again in the command prompt.<\/li>\n<\/ul>\n\n\n\n<p><strong>Option 2: Use the PHP Executable Directly<\/strong><\/p>\n\n\n\n<p><strong>Step 1: Use Full Path to PHP Executable<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Run the <code>php artisan serve<\/code> command with the full path to the PHP executable:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>\"C:\\xampp\\php\\php.exe\" artisan serve\n<\/code><\/pre>\n\n\n\n<p>Replace <code>\"C:\\xampp\\php\\php.exe\"<\/code> with the actual path to your PHP executable.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>After this you still getting the same error then check your composer. If there is no composer then install composer<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">More topics:<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>1<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/how-to-download-and-installer-php-and-how-to-add-path-in-apace-and-vhost\/\">How to download and installer php and How to add path in apace and vhost<\/a><\/td><\/tr><tr><td>2<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/how-to-make-a-partition-in-windows-11-from-c-drive\/\">How to make a partition in Windows 11 from C drive<\/a><\/td><\/tr><tr><td>3<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/how-to-do-file-level-commenting\/\">How to do file-level commenting<\/a><\/td><\/tr><tr><td>4<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/uncaught-error-syntax-error-unrecognized-expression\/\">Uncaught Error: Syntax error, unrecognized expression: #<\/a><\/td><\/tr><tr><td>5<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/error-argument-1-passed-to-app-uploadquoterequestfiletestonly-must-be-as-instance-of-illuminatehttprequest\/\">Error: Argument 1 passed to App\\\u2026\\UploadQuoteRequestFileTestOnly() must be as instance of Illuminate\\Http\\Request<\/a><\/td><\/tr><tr><td>6<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/list-of-my-blogs-of-oct\/\">List of My Blogs of Oct<\/a><\/td><\/tr><tr><td>7<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/responsive-layout-using-media-queries\/\">Responsive Layout using Media Queries<\/a><\/td><\/tr><tr><td>8<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/flutter-error-fix-this-issue-by-adding-compilesdkversion-33\/\">Flutter Error: Fix this issue by adding \u2026compileSdkVersion 33<\/a><\/td><\/tr><tr><td>9<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/flutter-sdk-version-solving-failed\/\">Flutter: SDK Version solving failed<\/a><\/td><\/tr><tr><td>10<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/flutter-project-creating-issue-is-not-a-valid-dart-package-name\/\">Flutter Project Creating issue (is not a valid Dart package name)<\/a><\/td><\/tr><tr><td>11<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/flutter-please-correct-the-pubspec-yaml-file-at-users-pubspec-yaml\/\">Flutter: Please correct the pubspec.yaml file at :\\Users\\\u2026\\pubspec.yaml<\/a><\/td><\/tr><tr><td>12<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/wp-admin\/post.php?post=1256&amp;action=edit\">Error: MainActivity.java is not on the classpath of project app, only syntax errors are reported<\/a><\/td><\/tr><tr><td>13<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/showing-error-on-phpmyadmin-no-space-left-on-device\/\">showing Error on phpMyAdmin \u201cNo space left on device\u201d<\/a><\/td><\/tr><tr><td>14<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/how-to-use-various-types-of-comments\/\">How to use various types of comments<\/a><\/td><\/tr><tr><td>15<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/error-http-500-internal-serverilluminatehttpresourcesjsonresource-not-found\/\">Error: HTTP 500&nbsp;Internal Server\u201dIlluminate\\Http\\Resources\\Json\\Resource\u201d not found<\/a><\/td><\/tr><tr><td>16<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/error-call-to-undefined-function-str_slug\/\">Error: Call to undefined function str_slug()<\/a><\/td><\/tr><tr><td>17<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/write-of-2225-bytes-failed-with-errno28-no-space-left-on-device\/\">write of 2225 bytes failed with errno=28 no space left on device<\/a><\/td><\/tr><tr><td>18<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/wp-admin\/post.php?post=651&amp;action=edit\">What is use of @yield @extend @section in Laravel<\/a><\/td><\/tr><tr><td>19<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/resolving-fatalerror-trait-illuminatefoundationauthauthenticatesusers-not-found\/\">Resolving FatalError: Trait \u201cIlluminate\\Foundation\\Auth\\AuthenticatesUsers\u201d not found<\/a><\/td><\/tr><tr><td>20<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/error-object-of-class-guzzlehttppsr7response-could-not-be-converted-to-stringerror\/\">Error: \u201cObject of class GuzzleHttp\\Psr7\\Response could not be converted to string\u201dError:<\/a><\/td><\/tr><tr><td>21<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/wp-admin\/post.php?post=565&amp;action=edit\">401 Unauthorized response<\/a><\/td><\/tr><tr><td>22<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/resolving-laravel-passport-and-guzzlehttp-version-conflict\/\">Resolving Laravel Passport and GuzzleHTTP Version Conflict<\/a><\/td><\/tr><tr><td>23<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/managing-outdated-dependencies-in-laravel-with-composer\/\">Managing Outdated Dependencies in Laravel with Composer<\/a><\/td><\/tr><tr><td>24<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/resolving-composer-dependency-conflict-laravel-passport-and-guzzlehttp\/\">Resolving Composer Dependency Conflict: Laravel Passport and GuzzleHTTP<\/a><\/td><\/tr><tr><td>25<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/resolving-phpunit-dependency-conflict-php-version-mismatch\/\">Resolving PHPUnit Dependency Conflict: PHP Version Mismatch<\/a><\/td><\/tr><tr><td>26<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/updating-laravel-trustproxies-middleware-after-framework-version-upgrade\/\">Updating Laravel TrustProxies Middleware after Framework Version Upgrade<\/a><\/td><\/tr><tr><td>27<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/troubleshooting-laravel-laravel-emergency-unable-to-create-configured-logger-using-emergency-logger\/\">Troubleshooting Laravel: \u201claravel.EMERGENCY: Unable to create configured logger. Using emergency logger.\u201d<\/a><\/td><\/tr><tr><td>28<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/resolving-sqlstate42s22-column-not-found-1054-unknown-column-provider-in-field\/\">Resolving SQLSTATE[42S22]: Column not found: 1054 Unknown column \u2018provider\u2019 in \u2018field\u2019<\/a><\/td><\/tr><tr><td>29<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/error-in-order-to-use-the-authroutes-method-please-install-the-laravel-ui-package\/\">Error: In order to use the Auth::routes() method, please install the laravel\/ui package<\/a><\/td><\/tr><tr><td>30<\/td><td><a href=\"https:\/\/www.devopssupport.in\/blog\/resolving-sqlstate42s22-error-in-laravel-passport-upgrade\/\">Resolving SQLSTATE[42S22] Error in Laravel Passport Upgrade<\/a><\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Title: Troubleshooting &#8220;php artisan serve&#8221; Command: &#8216;php&#8217; is not recognized Introduction: Running into the error &#8220;The term &#8216;php&#8217; is not recognized as the name of a cmdlet,&#8230; <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1368","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/posts\/1368","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/comments?post=1368"}],"version-history":[{"count":3,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/posts\/1368\/revisions"}],"predecessor-version":[{"id":1418,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/posts\/1368\/revisions\/1418"}],"wp:attachment":[{"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/media?parent=1368"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/categories?post=1368"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopssupport.in\/blog\/wp-json\/wp\/v2\/tags?post=1368"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}