I'm updating a symfony2 website, afeter each update in controller or twig file I run "php app/console cache:clear", the website stop working for 5 minutes then it works again. After un very little update, I cleared the cache and the site don't want to run anymore, I have 500 Internal Server Error, there are no entry in symfony's log file, but here what I found in php log :
[Thu Sep 24 08:10:05 2015] [error] [client 1.2.3.4] FastCGI: server "/run/fcgi-bin/www.mysite.com:80.fcgi" stderr: PHP message: PHP Warning: require_once(/var/www/mysite.com/app/cache/prod/jms_diextra/doctrine/EntityManager_5602df03afff5.php): failed to open stream: No such file or directory in /var/www/mysite.com/app/cache/prod/appProdProjectContainer.php on line 279
[Thu Sep 24 08:10:05 2015] [error] [client 1.2.3.4] FastCGI: server "/run/fcgi-bin/www.mysite.com:80.fcgi" stderr: PHP message: PHP Fatal error: require_once(): Failed opening required '/var/www/mysite.com/app/cache/prod/jms_diextra/doctrine/EntityManager_5602df03afff5.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/mysite.com/app/cache/prod/appProdProjectContainer.php on line 279
It seems to be entity issue, but I'm sure I have no entity updates. I even tried to roll back by uploading all original files but no way !
I don't understand :
why do I have to wait 5 minutes after each cache:clear ?
what does the log errors means ?
Thanks very much :)
It looks like a file permission problem on your cache directory (and/or your logs directory).
Try chmod -R 777 app/cache app/logs and tell us if you still have problems.
You can also check the umask trick in http://symfony.com/doc/current/book/installation.html#checking-symfony-application-configuration-and-setup that may help in your case.
I followed the instructions in URL posted by tchap.
I don't know why cache:clear throws the bug, but I tested this and it works :
manually delele the /app/cache/prod/ folder
run :
app/console cache:warmup
Related
When I try to run my project, I am getting this error in terminal.
[Fri Mar 30 14:36:23 2018] PHP Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
[Fri Mar 30 14:36:23 2018] PHP Fatal error: Unknown: Failed opening required '/var/www/html/imporeexcel/public/server.php' (include_path='.:/usr/share/php') in Unknown on line 0
I confirmed the issue, it seems a bug in laravel 5.6.12 installer. It deletes the server.php upon the first artisan serve.
A temporary solution will be to create another project then copy that newly created server.php this will solve it.
EDIT:
If your anti-virus is avast, you need to add exception there, I have a response in GitHub that avast considers it as a threat.
I have a problem with a PHP script. The following error is being logged whenever the site is accessed:
[Fri Sep 26 11:57:56 2014] [error] [client 31.22.44.2]
PHP Fatal error: require_once(): Failed opening required
'./sites/default/modules/views/handlers/views_handler_field_markup.inc'
(include_path='.:/usr/share/php:/usr/share/pear') in
/var/www/www.xoomtalk.com/htdocs/sites/default/modules/views/includes/handlers.inc
on line 76
I have confirmed that the file referenced is present, and that www-data can access it. Permissions look fine and have not been changed as far as I am aware
What am I missing?
[Fri Sep 26 11:57:56 2014] [error] [client 31.22.44.2] PHP Fatal
error: require_once(): Failed opening required
'./sites/default/modules/views/handlers/views_handler_field_markup.inc'
(include_path='.:/usr/share/php:/usr/share/pear') in
/var/www/www.xoomtalk.com/htdocs/sites/default/modules/views/includes/handlers.inc
on line 76
Add path /var/www/www.xoomtalk.com/htdocs into your include_path
More explains:
your include_path=.:/usr/share/php:/usr/share/pear , means php script will find include file in: current_path, /usr/share/php or /usr/share/pear
when you want to require this file
./sites/default/modules/views/handlers/views_handler_field_markup.inc
all allowed path are:
(current path)
/var/www/www.xoomtalk.com/htdocs/sites/default/modules/views/includes/./sites/default/modules/views/handlers/views_handler_field_markup.inc
(/usr/share/php) /usr/share/php/./sites/default/modules/views/handlers/views_handler_field_markup.inc
(/usr/share/pear)
/usr/share/pear/sites/default/modules/views/handlers/views_handler_field_markup.inc
In these path ,php can't find the file.
in the following file:
/var/www/www.xoomtalk.com/htdocs/sites/default/modules/views/includes/handlers.inc
on line 76
Change This:
'./sites/default/modules/views/handlers/views_handler_field_markup.inc'
to THIS: '/var/www/www.xoomtalk.com/htdocs/sites/default/modules/views/handlers/views_handler_field_markup.inc'
This should do the trick.
The problem is, you're using scripts from various directories, but the "root" of the request is the cwd (current working directory) which you can check with: getcwd()
(and you're requesting the include relative to the cwd.
I managed to solve this problem, ended up being nothing to do with permissions or paths, although there was no indication of this in the Apache logs.
The problem was that the server was also running AppArmor which for some reason was blocking the Apache process from accessing the files.
AppArmor was set to complain rather than enforce mode for testing (command is aa-complain apache2) this made everything start working.
Thanks to all contributors for their suggestions.
I'm using LAMP on my local machine. I'm getting the following error in apache error log and a blank web page in browser when I hit the URL:http://localhost/smart-rebate-web/web/admin/forgot_password.php
Following is the error I got in apache error log:
[Tue Apr 15 17:10:18 2014] [error] [client 127.0.0.1] PHP Fatal error: require_once(): Failed opening required 'includes/public-application-header.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/smart-rebate-web/web/admin/forgot_password.php on line 2, referer: http://localhost/smart-rebate-web/web/admin/login.php?lout=1
For your reference I'm attaching the image of my project structure titled 'smart-rebate-web' in Netbeans editor.
and following is the sceenshot of abrwser after I hit the URL :
http://localhost/smart-rebate-web/web/admin/forgot_password.php
So can anyone please help me in resolving this issue please? Thanks in advance. If you want any further information or any code I can provide you the same. Following asre the permissons of these files if I print in terminal:
-rw-rw-r-- 1 eywa eywa 1646 Apr 14 13:05 application-header.php
-rw------- 1 eywa eywa 1006 Apr 10 18:06 public-application-header.php
You have permission issue. According to your current file permission, only file owner can read and write that file, others cannot read. When you go on browser, default www-data user tries to read that file. And it is not permitted. Make your file 644 or change file owner to www-data. ``www-data` is the apache user used while you open php files from browser. And more flexible way, use following;
require_once(dirname(__FILE__) . "/includes/public-application-header.php");
Try using
require_once('web/admin/includes/<filename>');
I'm running an Apache server on my PC with Debian 7 (well, actually Crunchbang, but it's the same thing).
I was playing with the CodeIgniter framework, and it was working all right. I completed the first tutorial, the one in which you create your first static page (this one: http://ellislab.com/codeigniter/user-guide/tutorial/static_pages.html ), and it worked perfectly.
However, as you can see on the very first step, there's a line that goes like this:
[...]
public function view($page = 'home')
[...]
I changed that line to " $page = 'about' ", to try if it could display the other page instead. That's when Hell opened its doors and released the Kraken.
Then it started to show a 404 error, so I changed the settings back again, but the error kept ocurring. I restarted Apache, restarted my PC (I don't know, sometimes it works) and finally, deleted the codeigniter files from my /var/www/ directory, and copied them again.
Now the error is different: It just displays nothing! A blank page, just that. This is what my apache errorlog says:
[Fri Feb 21 23:03:11 2014] [error] [client 127.0.0.1] PHP Warning: require_once(/var/www/system/core/CodeIgniter.php): failed to open stream: Permission denied in /var/www/index.php on line 202
[Fri Feb 21 23:03:11 2014] [error] [client 127.0.0.1] PHP Fatal error: require_once(): Failed opening required '/var/www/system/core/CodeIgniter.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/index.php on line 202
It sounds like the permissions are set incorrectly on your server.
Check what group Apache runs in (I think Debian by default uses www-data), and make sure you set the group owner and read permissions.
# chown www-data:www-data -R /var/www
# chmod g+r -R /var/www
If the above doesn't work, try setting permissions to 777 just to see if the problem lies elsewhere. I couldn't imagine what else could cause that error, though.
Anyone know exaclty what's going wrong, I'm running Ubuntu (server) and have apache 2.2.14-5 and php 5.3.2-1 installed. When accessing the test.php file I get a HTTP 500 error. Here's what I get in my error.log
[Thu Oct 27 16:15:41 2011] [error] [client myip] PHP Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0
[Thu Oct 27 16:15:41 2011] [error] [client myip] PHP Fatal error: Unknown: Failed opening required '/blob/public_html/phpass-0.3/test.php' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0
Anyone know how to setup PHPass?
EDIT: Made a much simpler test: http://pastebin.com/TWq3C9Km, produced the same errors as above.
EDIT2: I have narrowed down what causes these errors to the following lines of code:
if(is_readable('/dev/urandom') && ($fh = #fopen('/dev/urandom', 'rb'))) {
$output = fread($fh, $count);
fclose($fh);
}
EDIT3: Turns out I can't read error messages, whats actually happening is PHP can't read the file itself. A quick sudo chmod -R 777 phpass-0.3 temporarily fixes that, but here must be a better way.
That error message usually indicates file permission problems as already pointed out. Global read/write/execute permissions are certainly not required, but make sure to give Apache read access to the files. For example:
chmod 755 phpass-0.3
chmod 644 phpass-0.3/*.php