Failed to open Stream, no such file or directory - php

I recently started using the Laravel framework and i set up a little workspace for me to work in. I setup a Xubuntu client at home that runs a Apache server from which i program and host my Laravel instance from. Now recently I've run into a little bit of a problem. I was following a tutorial series and everything went fine, the next day however i run into this error http://puu.sh/nh5vQ/8ae11c52ab.png
Both from opening the /var/www/html/test/public directory in apache2 from my webbrowser or from running php artisan and actually hosting the laravel instance.
So the first thing that came to mind was permissions, but the permissions for the public folder are fine, It should be able to read or execute as any program. http://puu.sh/nh5Ho/06e061a056.png
Mostly other posts can reference to a bit of code where they specified the wrong filepath. What i find odd is that when i open my hosted instance of apache server in my webbrowser, where you can technically browse all the files in the hosted directory it is there in the list, but when i click it it pops up with that same error.
I checked if all the files that the server is trying to acces exist, and they do exist and i made no typo's.
I'm going to continue on looking and i shall post the solution as soon as i find one, though I'm hoping you guys have an idea since I've been looking for about 2 days to find a solution.
Thanks for your time

I Decided I'd have to start a new Laravel project to fix this without making a chaoticly configured project.

Related

windows 2016, php dns query fails unless first run as admin

Been trying to figure out an issue not being able to use php's dns_get_record when called in a webpage under IIS. Thru some trial an error i figured out it was a permission issue. I think I confirmed this when i temporarily added the app pool user the webpage was running under as part of the admin user group. Suddenly it started working. And surprisingly, it kept working even after i removed the app pool user from the admin group. I have 2 versions of php installed on the server. It was not working on either version. And now it works on both versions.
My guess at this point is that it wants to write to some temp/cache file and as a user it has permission to write to the file, but does not have permission to create the file. When i added it to the admin group it was able to create the file. This is purely a guess on my part.
Since i don't know the exact cause, i can't be sure it's really fixed. So would really appreciate if anyone might have a better idea of what's going on and how i can make sure it's fixed permanently.
Update1: some additional info - after removing admin rights on the app pool user, i can restart the app pool or even restart IIS through the IIS control panel and it keeps working. But, if i restart IIS using iisreset, it stops working until I give admin rights again and then run it once. I'm not sure what's different between restarting IIS in the IIS control panel, or using IISRESET, but something causes it to stop working again using iisreset.
Thanks

Laravel ONLY on Live Server Error MethodNotAllowedHttpException

I'm getting this error overnight, despite I haven't updated any file.
The website has been working perfectly fine for 3 weeks and I am suddenly
getting this error when trying to submit anything through POST method.
I'm hosting two laravel-based websites and it's happening in both of them.
Any idea would be really appreciated. Thanks in advance
As I don't know if can use that, the simplest solution would be to connect via SSH to your live server. If you don't have access to your server via SSH you probably used FTP to publish your project. While this can work (i.e. deploying on a windows machine) it can also cause tricky problems.
I had a similar problem recently on a windows machine where one cannot simply execute an artisan command on the shell.
My solution was to set up a route and added this code in the controller method
$output = new BufferedOutput;
Artisan::call('route:list', [], $output); // use route:clear instead
return dd($output->fetch());
You can try the same replacing 'route:list' with 'route:clear'.
Also maybe try to comment all other routes in your route file and try the one not working at the moment again.
If it is still failing, the problem comes from your server settings.
If this works, it has more presumably something to do with the arrangement of your routes.
It was all caused by a single quote character (') in the PDF files I was trying to upload.
insert facepalm gif

Drupal redirects again and again to the installation page after deploying to Heroku

I've made an Heroku app with latest Drupal 8.
After it, I've deployed it and configured the installation successfully.
Now I'm getting the problem where Drupal automatically redirects to the installation page when I open my application after 1-2 hours.
I feel that there's something to do with dynos.
And yes, I have a free account.
I've already tried searching a lot on google, but all the guides are outdated which are very complicated/do not make any sense.
The installation page of the Drupal should not come again and again. instead of it, the installation should be permanent.
If drupal is showing you install page that means that it didn't find the (old) database.
So either your database account data is not correct for new environment so it can't connect to database server ( sites/default/settings.php ) or something is wrong with your database (wiped out by heroku?). Check on database (with PHP MyAdmin or some similar tool maybe) to see do you have tables and data inside them.
Heroku has an ephemeral filesystem and Drupal creates/modifies some files during installation such as: "settings.php".
ephemeral file system means that all the modifications to the files/file system will be lost upon the dynos restarting.
So, as soon as Dynos do restart, the files are revert back to their original state.
Due to this, all the changes are wiped up and thus when you open the site/application, the drupal can't detect the installation and thats why it redirects to the installation page.
It all happens because the file changes do not persist if the file system is an ephemeral one.
as #ceejayoz suggested, please see this article for a possible work around by which you can fix this problem:
https://www.fomfus.com/articles/how-to-create-a-drupal-8-project-for-heroku-part-1

Class not found - PHP server config?

So I'm working from a laptop, and I'm developing a PHP application. Being allowed to work from home, I installed EasyPHP on the laptop so I can host the web application locally on the laptop and work even when not connected to the internet, and without the use for a VPN connection, and even for when I'm at work, no need to mess with FileZilla or whatever, everthing will be so much easier like that for me.
My problem is the following: from our dev server, at work, everything is good. I copied the whole code in my easyphp folder, and I make a duplicate of my database in my local MySQL server. Running the application on my work's dev server, everything is fine. But locally, I get the following error:
Fatal error: Class 'ConfigNamespace' not found in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\MyApplication\libs\config\ConfigParser.php on line 50
So my ConfigParser class calls a New ConfigNamespace() at line 50... The local server doesn't like it. The ConfigNamespace class sits next to the ConfigParser class, in the \libs\config folder. Why does t not work locally, but works on the dev server?
I am under the impression that the configuration of the servers are different, and that my local server decides to expect all the classes to be in the root folder... but it's not!
I've searched on the web but only found things regarding system classes being unreachable... nothing that really has anything to do with my problem.
Thanks,
I fixed it. It ended up being a problem with rights on the folders after all. I did give it all the rights, but windows somehow still blocked it... I changed my document root for another folder, not in program files, and now everything works!

Laravel / Nginx serving wrong site

I have tried everything.
I recently tried to deploy a new Laravel application on my Ubuntu Digital Ocean droplet. I have done this many times in the past and have done nothing out of the ordinary with this project. I'm using https://gist.github.com/jamieshepherd/50419bb148a4f43e8266 this as a template nginx configuration, which I base all of my sites off. However, this time I deployed and went to my domain, I was served another client's site. The site had no images, styles, scripts etc. - but sure enough this was the wrong site. Weirdly, I could go to /images/example.jpg and get the correct file which would be in /public/images/example.jpg - but the actual routes were being served from a completely different folder.
There is absolutely no reference to the other client in my project anywhere, I feel like it has something to do with Laravel or PHP5-FPM setting some kind of root directory to the other folder.
I have gone to /public/index.php and just echo and died a message, and this works fine. When I revert the change and let the application run it again displays the other client's application. Here's a list of other things I've tried.
Temporarily renaming the other client's folder, as expected, NewSite throws a 404 error
Temporarily disabling the other client's nginx block, NewSite continues to serve the other client's site (remember, not css/images/scripts, weirdly)
Reinstalling PHP5-FPM
Printing the document_root, everything looks normal (/web/NewSite/public)
Trying to run the site off a different port
Pulled a working Laravel application from a completely different server, put it on this server, set the domain to point to this working application, serves the other client's site
Grep'd for any references to the client site in any of the project folders just to check I wasn't going insane, confirmed I'm not insane, though after all this I'm not sure anymore
Really I'm lost, I have no idea how to debug this any more.
Site trying to deploy: http://paragon.gg
Client site view that it's servring: https://swellhunter.co.uk
Client site NGINX conf: https://gist.github.com/jamieshepherd/4ff5430ddb13ed04f22c
Edit: Update: To make matters even more bizarre. I have temporarily removed swellhunter from sites-enabled, visited paragon.gg, still serves swellhunter's index. WHAT? There is absolutely no reference to the site at all now, I've even moved the paragongg folder to a completely different place to check. How on earth is it even finding the view with no reference to go on?
Seems like an issue with Laravel rather than with nginx or with your VPS.
Since you pointed out simple PHP file is pointing out rightly.
SSH to your droplet and run you laravel app using php artisan serve.
And access your droplet on port:3000
If the problem persists you can rule out server issues and can concentrate on debugging laravel app. Maybe be there is something wrong with you laravel app itself, some unwanted changes etc. Did you verify your laravel App?
Can you paste an LS -l of the directory? Have you checked to see what you have in the Laravel app/config/app.php for url ? I just took a look at paragon.gg and put https://paragon.gg it gave me a cert error but after I accepted it the site looked fine. Is that not the result you wanted?

Categories