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>');
Related
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
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 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.
I am getting Unable to open ... for writing: Permission denied when I try and resize an image. The code has worked fine for years but after a resent upgrade (I think ) It has stopped working. I have tried changing the permission on the folder to 777 and disabled selunix. Is there any thing that may have changed in my httpd.con file or php.ini file that will disabled a php script right?
The error message from Apache logs:
[Mon Jun 25 08:59:17 2012] [error] [client 127.0.0.1] PHP Warning: imagejpeg(): Unable to open './cache/150_112.5_be636f82ef8e7e22727c81980df16cd5.jpg' for writing: Permission denied in /var/www/html/resize_function.php on line 62, referer: http://jasonrmoore.info/list.php?dir=./
Nop, this is an unix permission issue.
Please check the permission of the permissions of ./cache folder and inner files.
i've just setup a LAMP development environment on my laptop, all works fine except for php. Apache don't process PHP code embeded inside pages, and display no error. All php package seems to be correctly installed.
Testing a simple: <?php phpinfo(); ?>, give a blank page
error log give:
[Fri Mar 02 20:30:13 2012] [error] [client 127.0.0.1] PHP Fatal error: Unknown: Failed opening required '/home/lib/utils/setDocumentRoot.php' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0
I finally solve my problem, it was due to a fix i've set in my virtualHost config (who was calling a missing file: setDocumentRoot.php), i've disabled that script and all works great.