Could not open input file php windows

When trying to create a new laravel project, The following error appears on the CLI:

Could not open input file: artisan

Script php artisan clear-compiled handling the post-install-cmd event returned with an error

I am using the latest version of XAMPP v3.2.1 with PHP 5.5.15 and with mcrypt enabled (made sure of that by issuing the command php -m). And I am running windows 8.1

Community's user avatar

asked Oct 4, 2014 at 13:29

wessodesigner's user avatar

wessodesignerwessodesigner

4,5053 gold badges16 silver badges9 bronze badges

8

You need to first create Laravel project and if you already have one you need to go to this project dir using cd command in terminal for example cd myproject.

Now you will be able to run any artisan commands, for example running php artisan will display you list of available commands.

answered Oct 4, 2014 at 14:13

Marcin Nabiałek's user avatar

Marcin NabiałekMarcin Nabiałek

110k42 gold badges258 silver badges291 bronze badges

5

You cannot use php artisan if you are not inside a laravel project folder.

That is why it says 'Could not open input file - artisan'.

answered Nov 12, 2015 at 2:42

Yevgeniy Afanasyev's user avatar

3

If you project is at /home/forge/laravel-project/

You can properly execute your artisan like this

php /home/forge/laravel-project/artisan ...

answered Nov 17, 2016 at 15:11

code-8's user avatar

1

Most probably you are not in the right directory!

LinusGeffarth's user avatar

LinusGeffarth

27.4k29 gold badges120 silver badges174 bronze badges

answered Nov 4, 2019 at 11:43

zaffar's user avatar

zaffarzaffar

6996 silver badges14 bronze badges

0

I just needed to make artisan executable.

chmod +x artisan

…and it works without the php prefix then.

answered Jun 25, 2015 at 13:25

Kevin Carmody's user avatar

Kevin CarmodyKevin Carmody

2,3112 gold badges23 silver badges23 bronze badges

Make Sure your current directory is your project-name

for example your project name is demo and location is f:/demo

f:demo> php artisan serve

answered May 16, 2021 at 8:22

Happy Patel's user avatar

Happy PatelHappy Patel

2,3231 gold badge16 silver badges26 bronze badges

First, be sure to be in the laravel project folder or else the terminal won’t be able to locate the artisan file in the project directory and any subsequent request you pulled to start a server would be rejected.

Demo

Let’s say our laravel project name is blog and located in C:\laravel
We then have: C:\laravel\blog

Where to open terminal

Navigate to the C:\laravel\blog directory and open the command window (terminal). Input the code below:

Laravel terminal code to start server

php artisan serve --host 127.0.0.1

answered Feb 9, 2018 at 3:31

John Zenith's user avatar

John ZenithJohn Zenith

4725 silver badges10 bronze badges

First create the project from the following link to create larave 7 project: Create Project

Now you need to enter your project folder using the following command:

cd myproject

Now try to run artisan command, such as, php artisan.

Or it may happen if you didn’t install compose. So if you didn’t install composer then run composer install and try again artisan command.

answered Jun 11, 2020 at 11:45

Md Riadul Islam's user avatar

If it is your first install of laravel then create another directory/folder inside the laravel directory and then move to that empty folder and create another project using the command below:

composer create-project --prefer-dist laravel/laravel blog

This will create a new project named «blog», then go back to parent laravel directory and now you can run this command:

php artisan serve

You will receive the return such as:

laravel deployment server started: http://localhost:8000

See attached image
enter image description here

answered Dec 29, 2017 at 10:02

A.Aleem11's user avatar

A.Aleem11A.Aleem11

1,85417 silver badges12 bronze badges

I checked out an existing Laravel project, which did not have this script. Even a find / -name 'artisan' produced no results. The solution turned out to be simple, if a bit weird:

curl -L 'https://raw.githubusercontent.com/laravel/laravel/v4.2.11/artisan' > artisan

You probably want to choose a tagged version that matches your installed version of Laravel.

answered Oct 12, 2015 at 20:41

DavidM's user avatar

DavidMDavidM

1,4171 gold badge13 silver badges16 bronze badges

If you’re running your Laravel project in Vagrant and have just SSH-ed into the virtual machine, don’t forget to cd /vagrant before you try running artisan commands!

answered Jul 11, 2017 at 15:37

TeeJay's user avatar

TeeJayTeeJay

1,5933 gold badges21 silver badges33 bronze badges

After struggling with this issue, I found out that you need to find where artisan resides by running sudo find / -name artisan,
and from there run the command php artisan ....

answered Apr 26, 2018 at 7:02

soBusted's user avatar

soBustedsoBusted

1973 silver badges18 bronze badges

This error happens because you didn’t install composer on your project.

run composer install command in your project path.

answered Mar 10, 2020 at 10:27

Ali Lashini's user avatar

Ali LashiniAli Lashini

4271 gold badge5 silver badges17 bronze badges

You need to first create Laravel project and if you already have one you need to go to this project dir using cd command in terminal for example cd myproject.

Example : C:\xampp new\htdocs\project laravel\LaravelProject>php artisan serve

Now you will be able to run any artisan commands, for example running php artisan will display you list of available commands.

enter image description here

answered Sep 21, 2020 at 4:48

Aslam Khan's user avatar

Aslam KhanAslam Khan

3822 silver badges2 bronze badges

Mainly this may happen because your Laravel project opens on the wrong path. Just open the folder again in your code editor. That’s what happened to me when I got the same error.

answered May 17, 2022 at 8:35

Ravindu Abeywardane's user avatar

1

None of the solution worked for me. You can use these commands for solving the issue:

Remove bootstrap/cache/config.php file then:

composer dumpautoload
composer update

Remove vendor folder then:

composer install

If still not solved, your last option maybe to create new Laravel project:
With new folder:

composer create-project --force laravel/laravel my-joyful-project

Without new folder:

composer create-project --force laravel/laravel .

It should solve the issue. If still no, make sure you do not have older laravel version. And lastly, make sure that it is Laravel project you are working on, not Silverstripe. They are both using composer and have similar configuration files. Easy to mess up or maybe not :)

answered Dec 12, 2022 at 12:03

Elmar's user avatar

ElmarElmar

2,35324 silver badges23 bronze badges

I had the same issue. I have fixed it by doing the following steps:

  1. removed vendor folder rm -Rf vendor
  2. tried to install the composer packages again: composer install --no-dev
  3. ran the required php artisan command again

Worked!

answered Dec 20, 2022 at 12:10

Ramin's user avatar

RaminRamin

3512 silver badges7 bronze badges

After installing composer, you need to create the project:

composer create-project laravel/laravel /path/to/tour/project

You can see the documentation, for your php version the lastest Laravel you can install is 5.0.

Now days here is the lastest version and require > php7.0. Here is the documentation.

answered Oct 29, 2018 at 20:03

Talan's user avatar

TalanTalan

812 silver badges6 bronze badges

What did the trick for me was to do cd src from my project directoy, and then use the php artisan command, since my artisan file was in the src folder. Here is my project structure:

project
|__ config
|__ src
    |__ app
    |__ ..
    |__ artisan  // hello there!
    |__ ...
|__ ...

answered Feb 1, 2019 at 10:36

Aleksandar's user avatar

AleksandarAleksandar

3,6381 gold badge39 silver badges43 bronze badges

if you re in say my-project/app/somefolder run in terminal cd .. two times to get in my-project/ folder

answered Jul 14, 2020 at 13:11

CodeToLife's user avatar

CodeToLifeCodeToLife

3,7262 gold badges41 silver badges29 bronze badges

Another thing to note that if you have a symbolic link from a non public location which hosts your project code to say public_html — running php artisan in the symbolic link location (public_html) will result in this error.
You seem to need to be in the actual project directory for php artisan to work.

answered Feb 4, 2021 at 6:46

SupaMonkey's user avatar

SupaMonkeySupaMonkey

8862 gold badges10 silver badges25 bronze badges

For those people that are having the same error on cPanel terminal specifically.

Now you need to enter into your project root or public_html folder in the terminal using the following command:

cd public_html

Now you will be able to run any artisan commands.

php artisan config:clear

enter image description here

answered Feb 17, 2022 at 10:53

Edwinfad's user avatar

EdwinfadEdwinfad

5156 silver badges14 bronze badges

Based on my experience, you must check if the artisan file is in your project folder. I had the same error, and when I check the artisan, it was not present. You can easily copy any artisan file from any existing or already working project and paste it into your new project.

Or you may download it here: artisan file

answered Oct 5, 2022 at 8:22

iAmBorgy's user avatar

In my case, I was trying to run artisan with wrong user.
ex: the project was belonging to fooo user but I was baaar user when I run the command.
Simply changing the user or run with other user fix the problem.

Change to other user

sudo su - fooo
# then run the command
php artisan ...

Run with other user

sudo su - fooo php artisan ...

answered May 11 at 6:14

Anji's user avatar

AnjiAnji

5172 silver badges10 bronze badges

I have the same issue. I am also in the laravel project directory. what works for me is just change the permission of the artisan file.

For linux

chmod 777 artisan

For windows

  • use the file property

answered Mar 22, 2021 at 11:19

Pranay kumar's user avatar

Pranay kumarPranay kumar

1,9934 gold badges22 silver badges51 bronze badges

When trying to create a new laravel project, The following error appears on the CLI:

Could not open input file: artisan

Script php artisan clear-compiled handling the post-install-cmd event returned with an error

I am using the latest version of XAMPP v3.2.1 with PHP 5.5.15 and with mcrypt enabled (made sure of that by issuing the command php -m). And I am running windows 8.1

Community's user avatar

asked Oct 4, 2014 at 13:29

wessodesigner's user avatar

wessodesignerwessodesigner

4,5053 gold badges16 silver badges9 bronze badges

8

You need to first create Laravel project and if you already have one you need to go to this project dir using cd command in terminal for example cd myproject.

Now you will be able to run any artisan commands, for example running php artisan will display you list of available commands.

answered Oct 4, 2014 at 14:13

Marcin Nabiałek's user avatar

Marcin NabiałekMarcin Nabiałek

110k42 gold badges258 silver badges291 bronze badges

5

You cannot use php artisan if you are not inside a laravel project folder.

That is why it says 'Could not open input file - artisan'.

answered Nov 12, 2015 at 2:42

Yevgeniy Afanasyev's user avatar

3

If you project is at /home/forge/laravel-project/

You can properly execute your artisan like this

php /home/forge/laravel-project/artisan ...

answered Nov 17, 2016 at 15:11

code-8's user avatar

1

Most probably you are not in the right directory!

LinusGeffarth's user avatar

LinusGeffarth

27.4k29 gold badges120 silver badges174 bronze badges

answered Nov 4, 2019 at 11:43

zaffar's user avatar

zaffarzaffar

6996 silver badges14 bronze badges

0

I just needed to make artisan executable.

chmod +x artisan

…and it works without the php prefix then.

answered Jun 25, 2015 at 13:25

Kevin Carmody's user avatar

Kevin CarmodyKevin Carmody

2,3112 gold badges23 silver badges23 bronze badges

Make Sure your current directory is your project-name

for example your project name is demo and location is f:/demo

f:demo> php artisan serve

answered May 16, 2021 at 8:22

Happy Patel's user avatar

Happy PatelHappy Patel

2,3231 gold badge16 silver badges26 bronze badges

First, be sure to be in the laravel project folder or else the terminal won’t be able to locate the artisan file in the project directory and any subsequent request you pulled to start a server would be rejected.

Demo

Let’s say our laravel project name is blog and located in C:\laravel
We then have: C:\laravel\blog

Where to open terminal

Navigate to the C:\laravel\blog directory and open the command window (terminal). Input the code below:

Laravel terminal code to start server

php artisan serve --host 127.0.0.1

answered Feb 9, 2018 at 3:31

John Zenith's user avatar

John ZenithJohn Zenith

4725 silver badges10 bronze badges

First create the project from the following link to create larave 7 project: Create Project

Now you need to enter your project folder using the following command:

cd myproject

Now try to run artisan command, such as, php artisan.

Or it may happen if you didn’t install compose. So if you didn’t install composer then run composer install and try again artisan command.

answered Jun 11, 2020 at 11:45

Md Riadul Islam's user avatar

If it is your first install of laravel then create another directory/folder inside the laravel directory and then move to that empty folder and create another project using the command below:

composer create-project --prefer-dist laravel/laravel blog

This will create a new project named «blog», then go back to parent laravel directory and now you can run this command:

php artisan serve

You will receive the return such as:

laravel deployment server started: http://localhost:8000

See attached image
enter image description here

answered Dec 29, 2017 at 10:02

A.Aleem11's user avatar

A.Aleem11A.Aleem11

1,85417 silver badges12 bronze badges

I checked out an existing Laravel project, which did not have this script. Even a find / -name 'artisan' produced no results. The solution turned out to be simple, if a bit weird:

curl -L 'https://raw.githubusercontent.com/laravel/laravel/v4.2.11/artisan' > artisan

You probably want to choose a tagged version that matches your installed version of Laravel.

answered Oct 12, 2015 at 20:41

DavidM's user avatar

DavidMDavidM

1,4171 gold badge13 silver badges16 bronze badges

If you’re running your Laravel project in Vagrant and have just SSH-ed into the virtual machine, don’t forget to cd /vagrant before you try running artisan commands!

answered Jul 11, 2017 at 15:37

TeeJay's user avatar

TeeJayTeeJay

1,5933 gold badges21 silver badges33 bronze badges

After struggling with this issue, I found out that you need to find where artisan resides by running sudo find / -name artisan,
and from there run the command php artisan ....

answered Apr 26, 2018 at 7:02

soBusted's user avatar

soBustedsoBusted

1973 silver badges18 bronze badges

This error happens because you didn’t install composer on your project.

run composer install command in your project path.

answered Mar 10, 2020 at 10:27

Ali Lashini's user avatar

Ali LashiniAli Lashini

4271 gold badge5 silver badges17 bronze badges

You need to first create Laravel project and if you already have one you need to go to this project dir using cd command in terminal for example cd myproject.

Example : C:\xampp new\htdocs\project laravel\LaravelProject>php artisan serve

Now you will be able to run any artisan commands, for example running php artisan will display you list of available commands.

enter image description here

answered Sep 21, 2020 at 4:48

Aslam Khan's user avatar

Aslam KhanAslam Khan

3822 silver badges2 bronze badges

Mainly this may happen because your Laravel project opens on the wrong path. Just open the folder again in your code editor. That’s what happened to me when I got the same error.

answered May 17, 2022 at 8:35

Ravindu Abeywardane's user avatar

1

None of the solution worked for me. You can use these commands for solving the issue:

Remove bootstrap/cache/config.php file then:

composer dumpautoload
composer update

Remove vendor folder then:

composer install

If still not solved, your last option maybe to create new Laravel project:
With new folder:

composer create-project --force laravel/laravel my-joyful-project

Without new folder:

composer create-project --force laravel/laravel .

It should solve the issue. If still no, make sure you do not have older laravel version. And lastly, make sure that it is Laravel project you are working on, not Silverstripe. They are both using composer and have similar configuration files. Easy to mess up or maybe not :)

answered Dec 12, 2022 at 12:03

Elmar's user avatar

ElmarElmar

2,35324 silver badges23 bronze badges

I had the same issue. I have fixed it by doing the following steps:

  1. removed vendor folder rm -Rf vendor
  2. tried to install the composer packages again: composer install --no-dev
  3. ran the required php artisan command again

Worked!

answered Dec 20, 2022 at 12:10

Ramin's user avatar

RaminRamin

3512 silver badges7 bronze badges

After installing composer, you need to create the project:

composer create-project laravel/laravel /path/to/tour/project

You can see the documentation, for your php version the lastest Laravel you can install is 5.0.

Now days here is the lastest version and require > php7.0. Here is the documentation.

answered Oct 29, 2018 at 20:03

Talan's user avatar

TalanTalan

812 silver badges6 bronze badges

What did the trick for me was to do cd src from my project directoy, and then use the php artisan command, since my artisan file was in the src folder. Here is my project structure:

project
|__ config
|__ src
    |__ app
    |__ ..
    |__ artisan  // hello there!
    |__ ...
|__ ...

answered Feb 1, 2019 at 10:36

Aleksandar's user avatar

AleksandarAleksandar

3,6381 gold badge39 silver badges43 bronze badges

if you re in say my-project/app/somefolder run in terminal cd .. two times to get in my-project/ folder

answered Jul 14, 2020 at 13:11

CodeToLife's user avatar

CodeToLifeCodeToLife

3,7262 gold badges41 silver badges29 bronze badges

Another thing to note that if you have a symbolic link from a non public location which hosts your project code to say public_html — running php artisan in the symbolic link location (public_html) will result in this error.
You seem to need to be in the actual project directory for php artisan to work.

answered Feb 4, 2021 at 6:46

SupaMonkey's user avatar

SupaMonkeySupaMonkey

8862 gold badges10 silver badges25 bronze badges

For those people that are having the same error on cPanel terminal specifically.

Now you need to enter into your project root or public_html folder in the terminal using the following command:

cd public_html

Now you will be able to run any artisan commands.

php artisan config:clear

enter image description here

answered Feb 17, 2022 at 10:53

Edwinfad's user avatar

EdwinfadEdwinfad

5156 silver badges14 bronze badges

Based on my experience, you must check if the artisan file is in your project folder. I had the same error, and when I check the artisan, it was not present. You can easily copy any artisan file from any existing or already working project and paste it into your new project.

Or you may download it here: artisan file

answered Oct 5, 2022 at 8:22

iAmBorgy's user avatar

In my case, I was trying to run artisan with wrong user.
ex: the project was belonging to fooo user but I was baaar user when I run the command.
Simply changing the user or run with other user fix the problem.

Change to other user

sudo su - fooo
# then run the command
php artisan ...

Run with other user

sudo su - fooo php artisan ...

answered May 11 at 6:14

Anji's user avatar

AnjiAnji

5172 silver badges10 bronze badges

I have the same issue. I am also in the laravel project directory. what works for me is just change the permission of the artisan file.

For linux

chmod 777 artisan

For windows

  • use the file property

answered Mar 22, 2021 at 11:19

Pranay kumar's user avatar

Pranay kumarPranay kumar

1,9934 gold badges22 silver badges51 bronze badges

I have installed Magento 2.2.5 on my localhost windows system. I use the wamp server.
I am unable to run any PHP command and getting the error Could not open input file: C:\wamp64\www\magento2

I got this

C:\wamp64\bin\php\php7.0.32>php  C:\wamp64\www\magento2 cache:flush
Could not open input file: C:\wamp64\www\magento2

I gave all permissions on the magento2 folder using system property still it doesn’t work.
Please suggest me a way out.

Msquare's user avatar

Msquare

7,9656 gold badges24 silver badges59 bronze badges

asked Jan 13, 2019 at 7:41

Magento Learner's user avatar

Magento LearnerMagento Learner

3851 gold badge5 silver badges17 bronze badges

Finally, It works for me.
I just add my PHP installation file path in the system user variable path. Closing and opening cmd and all of the commands work perfectly.
My PHP installation path is C:\wamp64\bin\php\php7.0.32.

Msquare's user avatar

Msquare

7,9656 gold badges24 silver badges59 bronze badges

answered Jan 13, 2019 at 16:39

Magento Learner's user avatar

Magento LearnerMagento Learner

3851 gold badge5 silver badges17 bronze badges

I think you are running and using the command in the wrong way that’s why you are getting the error.

Do this instead:

  • First, open cmd go to C:\wamp64\www\magento2 ( I suppose this is your magento2 installation directory)
  • From there, run the following commands below and check if you still get the errors you get before
    • php bin/magento cache:flush

Msquare's user avatar

Msquare

7,9656 gold badges24 silver badges59 bronze badges

answered Jan 13, 2019 at 9:49

fmsthird's user avatar

2

Could not open input file artisan is an error message that mostly occurs when PHP cannot find the “artisan” file or the file does not have the executable permissions. We investigated the causes of this error message in PHP, and we’ll teach you why you’re seeing the error and how you can fix it.Could Not Open Input File Artisan

Using the information that you’ll learn in later sections of our article, you’ll learn more about Laravel and add to your debugging skill sets. To get started, launch your computer, and let’s look for your “artisan” file after explaining why PHP can not find it.

Contents

  • Why Can PHP not Open the “Artisan” File?
    • – You’re Not in the Laravel Project Folder
    • – Your “Artisan” File Is Missing or Deleted
    • – The “Artisan” File Does Not Have Executable Permissions
    • – You Have a Configuration Issue With Your Laravel
  • How Can PHP Open the “Artisan” File?
    • – Run Artisan in Your Laravel Project Folder
    • – Restore the “Artisan” File Into Your Project Directory
    • – Assign the “Artisan” File Executable Permissions
    • – Troubleshoot Your Laravel Installation
  • Conclusion

Why Can PHP not Open the “Artisan” File?

PHP cannot open the “artisan” file because of the following:

  • You’re not in the Laravel project folder
  • Your “artisan” file is missing or deleted
  • The “artisan” file does not have executable permissions
  • You have a configuration issue with your Laravel

– You’re Not in the Laravel Project Folder

A common reason why PHP could not find the “artisan” file is that the file is not in your current working directory. This can happen if you navigate to a subdirectory of your Laravel application or another directory that does not contain the “artisan” file.

For example, if you have a Laravel application called “myapp”, and the “artisan” file is located in the application’s root directory. Then you navigate to the “app” subdirectory within your application using the command-line interface:

Now, within the “app” directory, you tried to run the “php artisan serve” command. But you got the error “could not open input file: artisan” and the command will terminate. This means the “artisan” file is not in this directory, and if you think it should be there, it might be deleted.

– Your “Artisan” File Is Missing or Deleted

A deleted or missing “artisan” file can cause the “could not find input file PHP” artisan error message. Numerous instances can lead to this, some of which are listed below:PHP not Open the Artisan File

  • Accidental deletion: This can happen if you or another developer deleted the “artisan” file during the manual deletion of other files.
  • Misconfiguration during the deployment process can cause the artisan file to be missing or deleted. This can happen in Docker, leading to the “could not open input file: /var/www/html/artisan docker” error.
  • Malware: Deletion by malware is rare, but it’s a possibility.

– The “Artisan” File Does Not Have Executable Permissions

The issue for executable permissions is specific to Linux, and it’s because files must have executable permissions to run as an executable program. So, when you install the Laravel framework, the “artisan” file is created as a PHP script file.

Without executable permissions, the operating system will not allow you to execute it as a program. This results in the “could not find input file” error when you’re trying to use it on the command line.

– You Have a Configuration Issue With Your Laravel

Configuration issues can also prevent PHP or the Artisan command-line interface from locating the “artisan” file. The following are possible causes:

  • Missing or outdated dependencies: For example, if the “illuminate/console” package is missing or outdated.
  • Incompatible PHP versions: Laravel has specific requirements for the PHP version. So, if you have an incompatible PHP, you can see the error.
  • Misconfigured Laravel settings: For example, if the Laravel configuration settings for the “artisan” command are incorrect, you can see the error. This includes “app namespace”, “autoload configuration”, and environment configuration.

How Can PHP Open the “Artisan” File?

PHP can open the “artisan” file if you run “artisan” in your Laravel project folder, and if it’s deleted, you must restore it in your project directory. On Linux, you can assign the “artisan” file executable permissions, or you can troubleshoot your Laravel installation.

– Run Artisan in Your Laravel Project Folder

To solve the “could not open input file: artisan cpanel” error, ensure that you’re running “artisan” in your Laravel project folder. That’s because the “artisan” file should be located in the root directory before the “artisan” command can work.

Now, to run “artisan” in your project folder, do the following:

  1. Open your terminal or command prompt.
  2. Use the “cd” command in order to change the directory to the root directory of your Laravel application.
  3. Confirm that you’re in your root directory.
  4. Run your “artisan” command.

For example, if you realize that you’re getting the error in “project/sub-folder”, switch to “project” and run your “artisan” command. By doing this, PHP will find the “artisan” file, and you can continue with your project.

– Restore the “Artisan” File Into Your Project Directory

If you notice that the “artisan” file is missing or deleted, you can restore it to your project folder. This will allow your “artisan” command to run successfully when you call it from your command line. To restore it, use any of the following methods:

  • Restore from a backup: If you have a backup of your Laravel application, you can restore the missing “artisan” file from there.
  • Copy from a fresh Laravel installation: Download a fresh copy of Laravel and copy the “artisan” file from the root directory of the fresh installation. Afterward, paste the file into your Laravel project directory.

Once you’ve restored the “artisan” file, the Artisan command-line interface should be able to run correctly again. With this, you will not see the “could not find input file” error the next time you call the “artisan” command.

– Assign the “Artisan” File Executable Permissions

Another possible fix that’ll allow you to run the “artisan” command is to set executable file permissions on your Linux machine. This will also solve the “could not open input file: artisan supervisor” error if you’re using the Supervisor process control system.

Now, to assign executable permissions to the “artisan” file on Linux, you can use the “chmod” command detailed in the following steps:

  1. Open your terminal or command-line interface.
  2. Navigate to the root directory of your app in Laravel using the “cd” command.
  3. Type the following command to assign executable permissions to the “artisan” file: chmod +x artisan

When you run the last command above, you’ll be setting the “execute” permission for the “artisan” file. This will allow you to execute it as a command line script, and you’ll not see the “could not find input file” error.

Finally, run the “ls -l artisan” command, and if you see “rwxr” in the output, it’s a sign that you’ve set the permissions correctly.

– Troubleshoot Your Laravel Installation

Troubleshooting your Laravel installation is a last resort when all the solutions above do not work.Process of Opening Artisan File on PHP

To do this, you can use any of the following:

  • Check the Laravel and PHP versions: Ensure that you are using a compatible version of Laravel and PHP. You can run “php artisan –version” and “php –version” to display the versions of both Laravel and PHP.
  • Check for missing dependencies: Ensure that all the required dependencies for your Laravel installation are installed and up to date. You can use the “composer” install to install any missing dependencies.
  • Check Laravel configuration: You can check the configuration files in the “config” directory of your Laravel installation.
  • Reinstall Laravel: Do this as a last resort, as it will delete all existing files in your Laravel application’s directory. You can get Laravel from their GitHub repository and run “composer install ” to install php artisan.

Conclusion

This article explained why PHP could not find the “artisan” in Laravel and how you can fix it. The following are the highlights of our discussion:

  • The major cause of the “could not find input file: artisan” is when you’re running the command outside your Laravel project directory.
  • Another possible cause that’ll prevent PHP from finding the “artisan” file is accidental deletion.
  • To solve the “php artisan serve not working”, ensure that you’re running the command in your Laravel project directory.
  • If you’re on Linux and “artisan” does not work, set the “execute” permissions settings via “chmod +x artisan”.
  • If nothing else works, you can reinstall your Laravel installation if you can’t get “artisan” to work.

Congratulations on reading this far; it means a lot to us, and much more if “artisan” now works for you. Bookmark and share our article with any Laravel developer that’s facing the same issue.

  • Author
  • Recent Posts

Position is Everything

Your Go-To Resource for Learn & Build: CSS,JavaScript,HTML,PHP,C++ and MYSQL. Meet The Team

Position is Everything

I get this strange error when I try to run a php file from anywhere in the system:

Could not open input file: drush.php.

…except for its own directory. When I try invoke it from its own directory, no problem — everything works!

Is there a permissions issue here? I looked under security tab in the properties for the file, but every user was given all the permissions that are available.

So I don’t get why Windows is not able to open this file from any other directory except where it is located.

asked Jul 1, 2009 at 1:19

picardo's user avatar

1

It could be a «working directory» issue. Have you tried making a shortcut to it on the desktop, then right-click, properties, and change «start in» to the folder where the php file is?

answered Jul 1, 2009 at 1:33

Adam Brand's user avatar

Adam BrandAdam Brand

6,1272 gold badges30 silver badges40 bronze badges

2

the file drush.bat from the php folder contains:

@php.exe "%~dp0drush.php" --php="php.exe" %*

I replaced it with

@php.exe "%~dp0/PEAR/drush/drush.php" --php="php.exe" %*

the actual path to the drush.php was not directly in the php folder, it was in php/PEAR/drush

answered Aug 29, 2012 at 10:44

ovi_mihai's user avatar

Try adding the path of the PHP bin folder to your %PATH% environmental variable

Usually in C:\Program Files\PHP\bin (or C:\Program Files (x86)\PHP\bin) or C:\PHP\bin

answered Jul 1, 2009 at 3:20

Jack B Nimble's user avatar

Jack B NimbleJack B Nimble

1,5051 gold badge10 silver badges13 bronze badges

1

You must log in to answer this question.

Not the answer you’re looking for? Browse other questions tagged

.

  • Cp2102 usb driver windows 10
  • Could not obtain information about windows nt group user error code 0x5
  • Counter strike скачать на компьютер windows 10
  • Couldn t load xpcom firefox windows
  • Counter strike skachat windows 10