Laravel Cache - file_put_contents file not found - php

I have this really strange error that I'm struggling to figure out.
I have a command that will cache the homepage. If I run cache:clear then command:updateCaches
And then try and load the site it tells me
file_put_contents(/home/sites/staff.habbocreate.com/storage/framework/cache/data/80/b6/80b69166730ee957730d0770e96781dbd90ae953): failed to open stream: No such file or directory (View: /home/sites/staff.habbocreate.com/resources/views/frontend/home.blade.php)
Its like being logged out causes the error. Except, I can cache the first time without being logged in via my browser and that works no problem.
Here is HomeController.php https://pastebin.com/P1uNNWEs
I don't expect anyone to figure it out, just an idea why it might be going wrong. Any help would appreciated though.

Ok turns out it was my own stupidity causing the error.
I was running the command via terminal so when the data files were created, they were created with the users and group root.
Then when I tried to view it in the browser, the user www-data was unable to access them.

try use public word
file_put_contents(/home/sites/staff.habbocreate.com/public/storage/framework/cache/data/80/b6/80b69166730ee957730d0770e96781dbd90ae953);

Related

Linux user apache has no permission to file which it owns

So I am trying to get shell_exec to give me the response of the program, but it is not giving me any response when I put it into echo. I have tried rewriting the output variable without a input variable, and have tried to produce errors hoping the error would give me some sort of output, but still nothing. Here is the code I am having issues with
<?php
$key = $_GET['key'];
$output = shell_exec("node totp.js ".$key."");
echo "Your output is = $output";
?>
Thanks!
Edit:
I tried defining where node is /usr/bin/node and where the totp.js is /var/www/html/totp.js and it gives an error in my log: No such file or directory. I took off everything other than trying to execute node, and I get the same no such file error. When I go back to what I had to begin with, I now get an error that command is not found, which was not appearing before. Is there a way to allow PHP to roam outside of the execution folder, I.E. the htdocs/html folder?
Edit 2:
Tried changing permissions, chowning, discovered my PHP runs under the user apache, which now owns and has 755 permissions to my entire web folder, and now it recognizes the /usr/bin/node.... but it has no permissions. I have tried adding permissions in every possible way, I've tried giving it 777 although I knew I would not leave it at that, and it still has no permission to access it. I am clueless, and I guess this has become a linux issue rather than a php issue... lol - Also changing the title of the post as it is no longer a shell_exec issue, it is an issue with permissions
Edit 3: Something is royally wrong, it now gives 2 error messages. One is "No such file or directory" and the other is "Permission denied". It gives both, leading me to believe it is running on 2 seperate users/2 seperate locations. Idk what I should do, so I am going to reset my server as I have not done much, and start again. Saving the code first to see if that clears it up for me.

Laravel shows blank page (continuously loading)

After having installed Laravel 5.1 on a local desktop, I installed it on a webserver (debian 8, php 5.6.17), set the directory permissions for storage and bootstrap/cache tp 1777. All worked fine. Next I installed it on another webserver, same method, same settings, but now it only shows a coninuously loading page. Tried a re-install, with the same result
Started manual debugging and the code falters in the index.php at $kernel->terminate(.... I also changed caching and session storage to redis, which made no difference.
Have been reading through the 'blank pages' posts, and been googling on it too, without any helpfull result so far.
If I let the script die before the '$kernel->terminate(...' line it shows the page else it just shows the page loading ... Unfortunately, pagination, and sorting a.o. do not work due to the premature ending of the script.
Anyone encountered this peculiar behaviour before
Cheers,
It happens most probably due to permission issue.Try this
chmod 777 -R storage/
Storage folder existed inside the Laravel folder.If nothing works, try to give full permission to Laravel Project folder and try again.
Problem caused by NFS filesystem. It doesn't allow file locking. Solved the problem by writing sessions to memcached
For me what fixed my issue was removing some laravel comment in my blade files. Especially comments of html code on multiple lines.
It took afew days to figure it out!! Very annoying.
{{--
html code here
--}}
see:
Blade Comments in Laravel are crashing apache
Laravel - Blade comments , blade rendering causing page to crash

PHP 404 Error Message

I have begun learning PHP using an eBook. The following strange results are happening: Per the book I have created two simple PHP files. They are named phpinfo.php and hello.php. Both files show in the user root directory. Both files show when I use the ls command in my mac terminal.
When I try to run them in my browser only the first one runs. The second results in a 404 error, File Not Found. How is this possible? Could an internal file mistake cause this?
Thanks
Thank you all. It was suggested that it would be easier to delete everything including the app and start over. So I did and then downloaded MAMP. That worked.

failed to load source for

I have a php project which used to work well, yesterday it suddenly failed, from the login page i cannot actually get into the system with the right username/password. i checked it in Firebug, it said: failed to load source for the php file that's supposed to load after login.what could be wrong? anyone have any idea? Thanks.
Have you checked all your dependencies?
Is the file loaded after login still there and still containing the correct code?
Is the code that points to that script still pointing to the correct file?

Flex Builder 4, ZendAMF and Data Services - Error?

I'm trying to set up my Flex Builder 4 dev environment, up to and including PHP and the ZendFramework on a WAMP stack on my hard drive.
Everything goes swimmingly until I try to set up a data service. I point it to the php class file, it populates the various fields in the form so I know it understood it, and I press next. After a little bit of tweaking I have the ZendFramework installed and everything seems to be pointing the right way, so I'm not sure why I'm getting this error:
"Make sure that Zend Framework is installed correctly and the parameter "amf.production" is not set to true in the amf_config.ini file located in the project output folder.
Warning: include_once(C:\wamp\www\TestDrive-debug\EmployeeService.php) [function.include-once]: failed to open stream: Permission denied in C:\wamp\ZendFramework\library\Zend\Loader.php on line 146"
What could be causing a permissions error like that? It's not on the system level because I went into properties and fully opened that file up so even a basic user has full permissions - still no dice.
I'm not reeeally a PHP guy so this is a bit beyond my skillset. Has anyone encountered this problem before? I'm just following the tutorial I have here and it SHOULD work. I'm just not clear on what would be causing a permissions issue like this.
Thanks!
I resolved this problem by changing the encoding of the php file. There must be some invisible characters in the file that were screwing up the parsing. Try saving the php service file with different encoding and see if it works for you. The one that worked for me was created by eclipse. I copy pasted the code in it, saved, and boom it worked!
just had same issue and resolved same as OP, just resave file with notepad, funny deal, but it happens
inside the folder of amf_Config.ini , create a new file amf_config2.ini , copy the contents of amf_config.ini as it is into amf_config2.ini , now inside amf_config2 double quote the value of parameter webroot (webroot="xxxxx") save ur amf_config2 , open gateway.php which would be also inside the same dir , change $configfile = "$dir/amf_config.ini" to
$configfile = "$dir/amf_config2.ini" , save it and try

Categories