i'm tring to use php function copy() but appear this error:
Warning: copy(/home/smartsch/public_html/admin/student/photos/1tt) [function.copy]:
failed to open stream: Permission denied in
/home/schoolzs/public_html/admin/student/fileupload.class on line 137
The problem is that folder photos and file inside have all permission 777.I don't understand why happen permission denied!!
Related
I keep getting these error messages when using a plug in "üsers ultra pro":
Warning: mkdir(): No such file or directory in /homepages/2/d644181673/htdocs/app646332697/wp-content/plugins/users-ultra-pro/xooclasses/xoo.userultra.customizer.php on line 227
Warning: move_uploaded_file(/homepages/2/d644181673/htdocs/app646332697/usersultramedia/custom_avatar_image/uultra_default_avatar_image_.jpg): failed to open stream: No such file or directory in /homepages/2/d644181673/htdocs/app646332697/wp-content/plugins/users-ultra-pro/xooclasses/xoo.userultra.customizer.php on line 230
Warning: move_uploaded_file(): Unable to move '/tmp/phpTloN3B' to '/homepages/2/d644181673/htdocs/app646332697/usersultramedia/custom_avatar_image/uultra_default_avatar_image_.jpg' in /homepages/2/d644181673/htdocs/app646332697/wp-content/plugins/users-ultra-pro/xooclasses/xoo.userultra.customizer.php on line 230
Warning: getimagesize(/homepages/2/d644181673/htdocs/app646332697/usersultramedia/custom_avatar_image/uultra_default_avatar_image_.jpg): failed to open stream: No such file or directory in /homepages/2/d644181673/htdocs/app646332697/wp-content/plugins/users-ultra-pro/xooclasses/xoo.userultra.customizer.php on line 234
I have checked all the permissions are set to 755 but it still won't work. Any ideas? Thanks :)
Background: I am running a multi user site on Wordpress (think pinterest) where users will be able to upload images/text.
I need help solving , what says to be a permission error in the htdocs folder, because i needed to alter them to even add folders in the first place.
This is my init.php file:
<?php
//Start Session
session_start();
//Include Configuration
require_once('config/config.php');
//Helper Function Files
require_once('helpers/system_helper.php');
require_once('helpers/format_helper.php');
require_once('helpers/db_helper.php');
//Autoload Classes
function __autoload($class_name){
require_once('libraries/'.$class_name . '.php');
}
?>
I try to include it via `
When i run my index.php file i get this error:
Warning: require_once(../../htdocs/PHP-Wizard/helpers/system_helper.php): failed to open stream: Permission denied in /opt/lampp/htdocs/PHP-Wizard/core/init.php on line 9
Fatal error: require_once(): Failed opening required '../../htdocs/PHP-Wizard/helpers/system_helper.php' (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/PHP-Wizard/core/init.php on line 9
I tried going one folder up with ../ , but it doesn't work.
I looked around for a similar error to mine, but no luck. They all say No such file or directory in (path).
Could it be that it is the same error, or do i really need to change my permissions, if so, how can i do that?
Edit: When i use include_once('helpers/system_helper.php'); i get this error:
Warning: include_once(helpers/system_helper.php): failed to open stream: Permission denied in /opt/lampp/htdocs/PHP-Wizard/core/init.php on line 9
Warning: include_once(): Failed opening 'helpers/system_helper.php' for inclusion (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/PHP-Wizard/core/init.php on line 9
Warning: include_once(helpers/format_helper.php): failed to open stream: Permission denied in /opt/lampp/htdocs/PHP-Wizard/core/init.php on line 10
Warning: include_once(): Failed opening 'helpers/format_helper.php' for inclusion (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/PHP-Wizard/core/init.php on line 10
Warning: include_once(helpers/db_helper.php): failed to open stream: Permission denied in /opt/lampp/htdocs/PHP-Wizard/core/init.php on line 11
Warning: include_once(): Failed opening 'helpers/db_helper.php' for inclusion (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/PHP-Wizard/core/init.php on line 11
The problem was indeed the permissions, i'm guessing because i copied the folder.
I fixed it by chmod 777 on all the files in that folder, and now it works fine.
Thank you for your time attempting to help me.
I tested using relative paths and it works fine.
<?php
require_once '../test.php';
echo ' you';
Where test.php just contains echo "hello"; resulted in the expected "hello you".
I would guess your problem is with file permissions. Can you check what permissions are on your system_helper.php? It should be at least executable by the user php is running as (usually www-data). I could reproduce your error message by doing a chown root test.php and chmod 600 test.php so I would guess something like
chown www-data: system_helper.php
or
chmod g+rwx system_helper.php
should give you permission to run the script.
I am working on AWS ec2 ubuntu machine. My code is in cakephp. When I try to upload any image with crating new folder, I got following warnings.
Warning (2): mkdir(): Permission denied
[APP/Plugin/Upload/Model/Behavior/UploadBehavior.php, line 1784]
Warning (2): chmod() [function.chmod]: No such file or directory
[APP/Plugin/Upload/Model/Behavior/UploadBehavior.php, line 1785]
Warning (2):
finfo::file(/var/www/html/app/webroot/files/user/image/35/)
[finfo.file]: failed to open stream: No such file or directory
[APP/Plugin/Upload/Model/Behavior/UploadBehavior.php, line 1955]
Warning (2): mkdir() [function.mkdir]: Permission denied
[APP/Plugin/Upload/Model/Behavior/UploadBehavior.php, line 1784]
Warning (2): chmod() [function.chmod]: No such file or directory
[APP/Plugin/Upload/Model/Behavior/UploadBehavior.php, line 1785]
Warning (2):
move_uploaded_file(/var/www/html/app/webroot/files/user/image/35/1439985339.jpg)
[function.move-uploaded-file]: failed to open stream: No such file or
directory [APP/Plugin/Upload/Model/Behavior/UploadBehavior.php, line
349]
Warning (2): move_uploaded_file() [function.move-uploaded-file]:
Unable to move '/tmp/phpqvcdzp' to
'/var/www/html/app/webroot/files/user/image/35/1439985339.jpg'
[APP/Plugin/Upload/Model/Behavior/UploadBehavior.php, line 349]
and code is
protected function _mkPath(Model $model, $field, $destDir) {
if (!file_exists($destDir)) {
mkdir($destDir, $this->settings[$model->alias][$field]['mode'], true);
chmod($destDir, $this->settings[$model->alias][$field]['mode']);
}
return true;
}
following is the plugin I am using
http://github.com/josegonzalez/cakephp-upload
should I need to give 777 permission to webroot
I have been working on a project that uses codeigninter. I worked on it in Windows 7 and it was fine but after I moved this project on Ubuntu to work on it there, It gives me this error in every page/controller/method that I try to access:
Warning: require_once(/opt/lampp/htdocs/TS_Project/system/core/CodeIgniter.php): failed to open stream: Permission denied in /opt/lampp/htdocs/TS_Project/index.php on line 202
Fatal error: require_once(): Failed opening required '/opt/lampp/htdocs/TS_Project/system/core/CodeIgniter.php' (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/TS_Project/index.php on line 202
The CodeIgniter.php file does exist, the path to it is correct and I am able to read and write in it ( I can open it in a text editor and modify it freely). I tried changing the file permission to it using the chmod command but nothing happens. Why is permission denied to the CodeIgniter.php file?
You need to change the permission of your TS_Project folder to 755.
You can do that by:
sudo chmod -R 755 /opt/lampp/htdocs/TS_Project
Warning: copy(/home/beradioc/public_html/phpfreechat-1.3/src/../data/public/themes/default/sound.swf) [function.copy]: failed to open stream: Permission denied in /home/beradioc/public_html/phpfreechat-1.3/src/pfctools.php on line 179
Warning: chmod() [function.chmod]: Operation not permitted in /home/beradioc/public_html/phpfreechat-1.3/src/pfctools.php on line 180
Warning: copy(/home/beradioc/public_html/phpfreechat-1.3/src/../data/public/themes/default/smileys/emoticon_surprised.png) [function.copy]: failed to open stream: Permission denied in /home/beradioc/public_html/phpfreechat-1.3/src/pfctools.php on line 179
Warning: chmod() [function.chmod]: Operation not permitted in /home/beradioc/public_html/phpfreechat-1.3/src/pfctools.php on line 180
Warning: copy(/home/beradioc/public_html/phpfreechat-1.3/src/../data/public/themes/default/smileys/emoticon_waii.png) [function.copy]: failed to open stream: Permission denied in /home/beradioc/public_html/phpfreechat-1.3/src/pfctools.php on line 179
Warning: chmod() [function.chmod]: Operation not permitted in /home/beradioc/public_html/phpfreechat-1.3/src/pfctools.php on line 180
Warning: copy(/home/beradioc/public_html/phpfreechat-1.3/src/../data/public/themes/default/smileys/weather_sun.png) [function.copy]: failed to open stream: Permission denied in /home/beradioc/public_html/phpfreechat-1.3/src/pfctools.php on line 179
Warning: chmod() [function.chmod]: Operation not permitted in /home/beradioc/public_html/phpfreechat-1.3/src/pfctools.php on line 180
Warning: copy(/home/beradioc/public_html/phpfreechat-1.3/src/../data/public/themes/default/smileys/weather_cloudy.png) [function.copy]: failed to open stream: Permission denied in /home/beradioc/public_html/phpfreechat-1.3/src/pfctools.php on line 179
Warning: chmod() [function.chmod]: Operation not permitted in /home/beradioc/public_html/phpfreechat-1.3/src/pfctools.php on line 180
Your script does not have permissions.
If you are running on your own server, use chmod. If you're running on shared hosting, try chaning permissions anyway, but it's not granted you'll be successful.
chmod is a command for changing permissions on files and/or directories it would appear that your script does not have sufficient permissions to do so, or to copy files around. I would seriously recommend that you study up on file permission, maybe read the READMe for phpfreechat which will probably tell you what those permissions are and go from there. If you do not have ssh access or direct access to your web server, you will probably need some help from your hosting company after you find out what files ad directories need what permissions.
a quick look at phpfreechat's page states:
Give the web server's write permissions to “phpfreechat-x.x/data/public” and “phpfreechat-x.x/data/private” directories.
If you are using FTP:
CHMOD 777 phpfreechat-x.x/data/private
CHMOD 777 phpfreechat-x.x/data/public
If you are using SSH:
chmod 777 phpfreechat-x.x/data/*