Failed to remove directory when using php cache:clear - php

When using composer install or cache:clear it will fail.
Failed to remove directory "/vagrant/download-server/var/cache/..8bS": rmdir(/vagrant/download-server/var/cache/..8bS): Text file busy
Previously when this error came up i could change from using a shared vm folder to direcly deploying
into the machine via phpstorm and this would fix it.
So i guess it has something to do with writing/reading speed.
Other than deploying directly into the vm. I also updated Vbox but this did not help.

Related

Unable to create Laravel project in PhpStorm

I am trying to create a new Laravel project in PhpStorm using the below steps.
Chosen option "Download composer from composer.org".
In the package list i have selected laravel/laravel with default version.
Create project.
After loading all the files it displays a short message in the bottom right corner of the IDE "Failed to run composer create-project" and I am unable to see that first page that comes when we run server.
I have also tried it using terminal by going into xampp/htdocs in VSCode and then running the below command
composer new laravel/installer
Changed current directory to /Users/abhishekabhishek/.composer
But it gives me the following error
The "https://repo.packagist.org/packages.json" file could not be downloaded: failed to open stream: Operation timed out
Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info
I have no idea what is going on. Can anyone please help me resolve this issue. I am running this on Mac, there is nothing that I came across that can resolve this problem.
Step 1:
Download composer
Step 2:
Download the Laravel installer using Composer.
composer global require laravel/installer
Step 3:
laravel new blog
Step 4:
php artisan serve
This command will start a development server at http://localhost:8000
Tips:
After installing Laravel, you may need to configure some permissions. Directories within the storage and the bootstrap/cache directories should be writable by your web server or Laravel will not run.
sudo chmod 777 -Rf /folder/bootstrapdirectoryorcachedirectory
You dont need any VSCode or PHP Storm to do that.

laravel failed to open stream fatal error when running php artisan serve command

i had recently installed laravel in windows through composer made a new project named project in my xamp's htdocs folder then run "php artisan serve" comand in cmd but it is giving me error "failed to open stream" here is screenshot here I ran "php artisan serve" comand error is shown in above image I also tried to search my problem on stack overflow but couldn't find any solution that can suit my problem
Most files are missing because you have not successfully installed Laravel.
Go to C:\xampp\htdocs\project> and type composer update --no-scripts or composer install
Since you are using xampp, once all the necessary files and packages are downloaded to your project you should be able to access your site through localhost without running php artisan serve by visiting
http://localhost/project/public
NB:Just ensure xampp is running
please go through the documentation first
https://laravel.com/docs/5.4#installation
you did not installed laravel projects correctly. you did not have vendor files. First you have to run :
composer install
dont need php artisan serve in xampp ... just go to
localhost/your_project/public
hope it helps !!!

Symfony 3.3 built-in server error

I'm developping an app under windows 10 + wamp + php 7 + Symfony 3.3
I'm trying to use the built-in server :
php bin/console server:run
[OK] Server listening on http://127.0.0.1:8000
// Quit the server with CONTROL-C.
And when I go to http://localhost:8000/app_dev.php/ or http://127.0.0.1:8000/app_dev.php
I get this error :
Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
Fatal error: Unknown: Failed opening required 'C:\wamp\www\myproject\vendor\symfony\symfony\src\Symfony\Bundle\WebServerBundle/Resources/router.php' (include_path='.;C:\php\pear') in Unknown on line 0
Same error under every routes. My routes are correct and works fine outside of the built-in server...
Can you help me with this issue please ?
I had same problem,
Solved by :
Delete symfony folder in vendor
composer update
If you have antivirus (like Avast) disable it before launching web
server
php bin/console server:run
I got the same error, even when installing via composer.
It turns out that for whatever reason when composer downloaded the project, the required file listed in the error you get (vendor\symfony\symfony\src\Symfony\Bundle\WebServerBundle/Resources/router.php) was not included...
To fix this, I manually added it from https://github.com/symfony/web-server-bundle/blob/master/Resources/router.php and then my symfony app worked as expected.
I had to restart my computer in order to actually add the file because somehow I was locked out of adding it even as admin in Windows after launching the php server.
UPDATE:
Even better than manually adding the file, I just deleted the symfony folder from the vendor folder in the project and reran composer update. the router.php file is indeed downloaded. Sometimes when running bin/console server:run it gets deleted. Not sure why.
It happened to me when upgrading from Symfony 3.1 to Symfony 3.4.
The reason was that I had left the development server running when I executed the command:
composer update
The solution:
Delete the contents of vendor folder
Execute composer update
Install the new Symfony development server bundle (follow the instructions)
Execute the server for development in a new port
php bin/console server:start localhost:3421
I had this problem too : it was AVAST that blocked the "router.php" file.
I went into avast -> protection -> quarantine, and put an exception of the router.php file
And then everything worked again
I get the same error and I solve this issue by installing the project with composer
composer create-project symfony/framework-standard-edition my_project_name

Laravel on Shared Hosting unable to find path to files

I was able to run my Laravel 5.3 application very well on my local machine. But when I upload it to the shared hosting, I have the following error.
InvalidArgumentException in FileViewFinder.php line 137:View [welcome] not found.
I also observed that while on the online server, the application is looking for the files in the path they are on my local machine
I only have a shared hosting and so cannot run PHP Artisan commands. I have tried to
php artisan cache:clear
and
php artisan config:cache
and yet the problem persists.
I have even manually deleted all the files in storage/framework/views but the problem persists.
My local machine is a MAC OS with XAMPP with PHP 7 and my shared hosting is a CentOS Linus server with PHP 5.6.
It sounds like you need to clear the auto loader cache by running the following command on the server
composer dump-auto -o
Once the command has completed it will update the vendor autoload paths and the application should work correctly.
Try adding this in your web route file
Route::get('/updateapp', function()
{
exec('composer dump-autoload');
echo 'composer dump-autoload complete';
});

Laravel 5.0 - Shared Hosting - Artisan not working as it should

I actually wanted to follow up on this question, but I guess It's better to start a new question.
I installed a fresh copy of my own laravel(5.0), and I tried running php artisan route:list, which works.
Now I have downloaded the compressed repository of a project I want to deploy on a shared hosting enviorment, but when I run php artisan route:list nothing happens.(No error message, nothing). Using this method for hosting the application
The actual problem is php artisan migrate, which also outputs nothing!
Is there a good method for troubleshooting this ?
Could you provide me we some points of failure that I can check ?
Worth mentioning:
I'm no Laravel developer and I have limited time reading up on it.
As LittleFinger suggested, it's possible that artisan is not actually yet installed. When deploying from a repo, Laravel's packages of which the entire framework core is composed, are not included. You should run composer install to install the packages. If you don't have composer installed that can be difficult on shared hosting, but it's usually possible to install it.
You will need to run composer install before you run composer update. Running composer update is not required, unless you want to update to the newest versions of your packages which are allowed by the rules in your composer.json file. This should be done with care in a production environment as new versions of packages could break your app.
Once you've installed the packages, you'll need to set your environment variables (database credentials etc.) by copying the .env.example file to .env and editing it. Once you've done this you'll be able to run php artisan key:generate to generate an encryption key.
After this, your app should work (assuming you've pointed a domain to the /public directory).
I am facing the same issue when I try to run
php artisan migrate or php artisan cache:clear
nothing happen just a blank screen no success no error see the screenshot
after debugging I found a message in error_log in root directory which says.
Fatal Error: Allowed Memory Size
after increasing the memory php artisan commands works fine

Categories