I copy a test.php from a folder and here is it's permission:
-rw-r--r--. 1 root root 20 Jan 12 19:01 test.php
I try to run this script and it says:
Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0 Fatal error: Unknown: Failed opening required '/var/www/test/test.php' (include_path='.:/usr/share/pear:/usr/share/php') in Unknown on line 0
Then i delete this file and create a new one by vim test.php,and here is it's permission:
-rw-r--r--. 1 root root 20 Jan 12 19:01 test.php
again, i run this file and it works!
anyone knows why?
Related
In Symfony 4, I have one bug when I use:
php bin/console serve:run
[Thu Sep 27 19:11:00 2018] PHP Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
[Thu Sep 27 19:11:00 2018] PHP Fatal error: Unknown: Failed opening required 'C:\Users\user\Documents\Sites\Symfony4\vendor\symfony\web-server-bundle/Resources/router.php' (include_path='.;C:\php\pear') in Unknown on line 0
I use composer install before this command.
I am running Windows 10.
I discovered that Avast quarantined my file. And since I was using it in silent mode, I did not see the notification.
I have installed an existing laravel project but when I run "php artisan serve" command it gives me below error.
PHP Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
[Thu Jul 20 12:07:12 2017] PHP Fatal error: Unknown: Failed opening required '/Users/logicparadisemac/Sites/physicalproduct/server.php' (include_path='.:') in Unknown on line 0
I am creating an Wordpress app server on apache and I am getting an error 500 while going to the url.So, I did check the httpd/logs/error_log and the following is the error
[Sun Jan 15 22:42:54.440349 2017] [:error] [pid 767] [client
10.203.116.148:9173] PHP Warning: require_once(/var/www/html/wp-config.php): failed to open stream:
Permission denied in /var/www/html/wp-load.php on line 37 [Sun Jan 15
22:42:54.440406 2017] [:error] [pid 767] [client 10.203.116.148:9173]
PHP Fatal error: require_once(): Failed opening required
'/var/www/html/wp-config.php'
(include_path='.:/usr/share/pear:/usr/share/php') in
/var/www/html/wp-load.php on line 37
I tried changing the file permissions for Wp-config.php but no luck, is there anything else I could do.
Try changing file permissions of wp-config.php it might be given 640. Change file permission of wp-config.php or .htaccess file to 644.
Changing file permission of wp-config.php to 644 worked for me
This error comes most of the time after migration, So the solution is to change the permission of wp-config.php to 644. You can easily change permissions from FileZilla
cheek the path on wp-load.php or post it here
.
This is what I am doing in my script, trying to read files and directory outside web root
// on line number 17
echo file_get_contents("/home/admin_cs/Documents/ssh_logs/info_04102015.txt");
// on line number 34
$file = scandir("/home/admin_cs/Documents/ssh_logs/");
Errors I received
[Fri Sep 04 16:10:00 2015] [error] [client x.x.x.x] PHP Warning:
file_get_contents(/home/admin_cs/Documents/ssh_logs/info_04102015.txt):
failed to open stream: No such file or directory in
/var/www/html/virtual/Development/Admin/demo_jquery.php on line 17
[Fri Sep 04 16:10:00 2015] [error] [client x.x.x.x] PHP Warning:
scandir(/home/admin_cs/Documents/ssh_logs): failed to open dir:
Permission denied in
/var/www/html/virtual/Development/Admin/demo_jquery.php on line 34
What I attempted
[root#localhost admin_cs]# sestatus
SELinux status: disabled
[root#localhost admin_cs]# chown -R apache.apache /home/admin_cs/Documents/ssh_logs/
[root#localhost admin_cs]# chown -R apache.apache /home/admin_cs/Documents/ssh_logs/*
[root#localhost admin_cs]# chmod o+x /home/admin_cs/Documents/ssh_logs/
[root#localhost admin_cs]# chmod o+x apache.apache /home/admin_cs/Documents/ssh_logs/*
Unfortunately nothing is working, someone help me to fix, I searched and read many posts on this forums, none of them solved my issue, anything else am I missing ? Please help me.
Check how your host (or vhost) is configured in the apache conf files, there should be an option called php_admin_value open_basedir and a lot of routes to directories.
Add the routes to the directories you're trying to read.
I have a php script which I use it for uploads. Before I switched to another server, but now it doesn't. This is the PHP file:
<?php
if($_FILES["file"]["error"] > 0){
echo "There was an error processing your upload. Please try again. ";
}else{
// Save this file in the directory
move_uploaded_file('$_FILES["file"]["tmp_name"]', '"uploads/".$_FILES["file"]["name"]');
}
?>
I'm not only getting this error in error.log:
[Sun Jul 21 12:32:34 2013] [error] [client 10.127.2.10] PHP Warning:
move_uploaded_file(uploads/file.
txt): failed to open stream: Permission denied in /home/liongold/Web/upload_script.php on line 6, referer
: http://url/upload_page.html
[Sun Jul 21 12:32:34 2013] [error] [client 10.127.2.10] PHP Warning: move_uploaded_file(): Unable to mov
e '/tmp/phpa0hsMc' to 'uploads/file.txt' in /home/liongold/Web/upload_script.php on line 6, referer: h
ttp://url/upload_page.html
This may because of permission problem. directory "uploads" must have write permission for upload to that directory.
Go to your control panel and set directory permission to 777.
I hope it will solve your problem.