Laravel & Beanstalkd - File Copy / Download Error - php

I'm using Laravel 4 and am trying out queues with Beanstalkd (running on Homestead locally)
I have a script which downloads and parses an XML file which is working fine with the sync driver but when I switch to the beanstalkd driver I get a failed to open stream: No such file or directory error on the copy() function.
Is there any configuration that I might be overlooking with file downloading via Beanstalkd? I get the same error whether I'm trying to copy() a URL or a local file so I assume it's not network related. I also tried fopen() but get the same error. It works fine however for simple tasks such as Log::info('This works.');
Thanks

I had the same problem when running Artisan tasks... the problem was with the file paths. Laravel was automatically resolving paths to the public directory but Beanstalkd & Artisan were not. Adding public_path() before '/folder/file.txt' solved the issue.

Related

Wrong path in file_put_contents using Laravel Windows

I'm new to Laravel and I have to develop on a project that already exists. But I am adding new features and I have to stage an environment to test. Thus, I chose the Cloudways platform. I upload my files using Filezilla but when I launch my website, I have the
ErrorException
file_put_contents(C:\wamp64\www\myapp\htdocs\storage\framework/sessions/l7OUJvDvv4UsvRPb7LNCIt8JNyVYRmE401P6zlKr):
failed to open stream: No such file or directory
The error is at vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:135
I think it tries to create a new file with the path given. I know that the path that Cloudways is using is the one on my local environment. But I want it to access to the path on the server. I have read lots of forums but I don't find any answers...
My Laravel version is 7.30.6 and php version is 7.4.26
I've tried to reinstall Laravel and Composer and do the route:cache and views:cache
Also, I read on forums that the config/filesystems.php as to be like this:
but it's already the case.
Try php artisan config:clear and then upload the project via Filezilla
I found the solution. Inside the folder /storage/framework/sessions/FileSessionHandler, I had to modify the value of the $path variable.

Display file from Storage path laravel

I have a file stored in storage directory in Laravel 7. The sub directory is storage/app/public/personnel-docs/nameofile.ext.
I have done php artisan storage:link and therefore, on my local which is a windows 10 machine I can access it by the following url
http://127.0.0.1:8000/storage/personnel-docs/nameofthefile.ext
But where it is hosted on a LIVE linux server, when I try the same url as follo
http://theliveurl/storage/personnel-docs/nameofthefile.ext
It returns a 404 Not found response.
I have also run php artisan storage:link on the server and the problem persists.
I have checked and confirmed that the file is present on the folder but it just does not return/display as expected.
I will appreciate any effort to resolve this.
Thank you

how to run composer install on the server cpanel

I have successfully uploaded my symfony app to the server. I have also copied the content of the web folder into the public_html folder of my website. But when I access my app via the www.domain.com I get this error
Warning: require_once(/home/domain/public_html/../app/bootstrap.php.cache): failed to open stream: No such file or directory in /home/domain/public_html/app.php on line 6
Fatal error: require_once(): Failed opening required '/home/domain/public_html/../app/bootstrap.php.cache' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/domain/public_html/app.php on line 6
After researching I found that you can run composer install on the server but my challenge is that I dont know how to run cli command on the server via ssh/cpanel.
Please who will be kind enough to show me the way. This is my first attempt on trying to host a symfony application
When you don't run an composer install your dependencies are missing and the bootstrap.cache.php isn't created. So you have to upload the file and the complete vendor folder.
But i would prefer to take a look at your SSH connection and use the correct way. Otherwise you have to upload every time your complete sources including your vendor folder which can take a lot of time.
And the next think is your path. The components from your Symfony application are normally outside of your webroot. So you have to be sure that you can access that folders outside your webroot.
In some systems you have to allow that before you can use it. Otherwise you have to upload your complete application to your public_html folder and put your domain to the web subdirectory.

How is this possible: no public folder in a running Laravel instance?

I got access to a php server on which an instance of Laravel is running. downloaded the entire folder and I now try to run the code base on my laptop. Running php artisan serve gives me an error saying:
[ErrorException]
chdir(): No such file or directory (errno 2)
This SO answer says that the public folder cannot be found, and indeed, there is no `public folder. But I have no idea how it can then function on the server it is running on.
Does anybody know what I can do to get this running? All tips are welcome!
Generally speaking, the public directory need not be in the same directory as that of your laravel installation. It only serves as the document root for your webserver. As such it can be moved elsewhere (although there's no pragmatic reason for this) on your filesystem.

Symfony Deploying Project on Distant Server ContextErrorException

I am trying to upload my project on the distant server, I simply uploaded the files on the distant server, checked the config.php, which says that all is good. I have removed the if conditions for only local access. But when i try to open the app_dev.php or app.php i keep getting this error
ContextErrorException: Warning:
file_get_contents(C:\wamp2\www\Symfony\src\Les\CouvertsBundle/Resources/views/Couverts/index.html.twig)
: failed to open stream: No such file or directory
in /homepages/26/d367595533/htdocs/Symfony/vendor/twig/twig/lib/Twig/Loader/Filesystem.php line 130
i have not found any answers to this question, maybe not looking for it properly. But could anyone explain to me why would this error is occuring? Why is symfony looking for the files with the local address?
I followed this tutorial to deploy project in production http://fr.openclassrooms.com/informatique/cours/developpez-votre-site-web-avec-le-framework-symfony2/deployer-son-site-symfony2-en-production. The steps seem pretty straight forward, but maybe i am missing something.
This is really frustrating, because my project is ready but i can't seem to put it online due to this problem.
The problem seemed to be the command php app/console cache:clear and php app/console cache:clear --env=prod didn't completely clear the cache folder.
It can happen if the user running the command hasn't the permission to delete files/folder in app/cache/ Manually removing the content of this folder can solve the issue (rm -rf app/cache/*).
Just clearing the cache manually at (projectname/app/cache) instead of the command line worked for me (version 2.8).

Categories