Permission Denied Executing Shell Command
I am getting following error when executing shell command from PHP, where PHP/Apache is running as "nobody".
du: '/home/example/mail': Permission denied
du: cannot access '/home/example/mail/example.com/demo/': Permission denied.
View Complete Forum Thread with Replies
Related Forum Messages:
Executing A Shell Command
I try to use the backtick "`" to exacute a shell command from a PHP script. However, `touch file`; doesn't make the file. Neather does exec(), system(), etc. They all work when is used a different command, such as pwd, or ls. So what's a brotha gotta do to creat a file?
View Replies !
Permission Denied!
Hi, I'm writing a script to edit my website with, but I'm having a permissions problem with the fopen command. Is there any way to get around this? How else would I write changes to a file?
View Replies !
Permission Denied WHY?
I wrote this script and executed on my server, with php 4.1.2 <?php $fp = fopen('test.txt', 'w'); fwrite($fp, "Bla bla"); fclose($fp); ?> it returns this message: Warning: fopen("test.txt", "w") - Permission denied in file.php4 on line 3 I've tried to change file permissions, change to fopen('test.txt', 'w+b') and other modes. But it doesn´t work.
View Replies !
FTP Permission Denied
I can't use the ftp_get function(). It always throw permission denied error. Is the problems come from security restriction in my hosting? I try to chmod my folder to become 777 , but it always go back to 666 again. Is it with 666, its not possible to do that?
View Replies !
Permission Denied
I upload a file thru a php form the error "failed to open stream: Permission denied" comes up. And everytime that this error occurs, I'll change the permission mode of the destination directory to 777 thru my ftp program, and the uploading of files will work again. I do not want that each time that I upload a file I will have to set the file permission of the destination directory again and again. I have tried using the chmod in my php file, but I am not permitted to use it - "Warning: chmod() [function.chmod]: Operation not permitted "
View Replies !
Executing A Remote Script (unix Shell)
I would like to add a button on a PHP page which allows to execute a script on a remote machine (without a web server on it...) using login and password to access it. I've tryed to use a "system" and "rsh", but with the rsh I can't access with password.
View Replies !
File Permission Denied
using this statement: move_uploaded_file($_FILES['upload_picture']['tmp_name'], $_FILES['upload_picture']['name']); to process the uploaded file all the directories are already set to 777... ie, from child directory till up to it's parent directory.. still permission denied.. wonder why you guys had it working and mine still doesn't.
View Replies !
Move_uploaded_file Permission Denied
I am moving a site to a new server, I have been testing it and one of the pages uses move_uploaded_file, but I get a Permission denied. The directory I am moving it to is chomd of 755, if I change it to 777 it does upload but the owner is www-data, but I then can't download it using a FTP client (which I have to do) as it's the wrong owner, so I have to leave the chomd as 755, but this point to being a server config problem, any ideas? the errors I am getting is
View Replies !
Mkdir Permission Denied
I am creating my own web site and am having difficulty making directories. I alway get the 'Permission denied' error when I try to create directories in 'c:inetpub...' or '//localhost/...' Mkdir works fine if I dont try to make folders in inetpub...for instance 'c:photos...' And for a time I thought i would just create the folders for uploaded images in 'c:photos'. But when I try to show these images on the web page using <img src....> the images wont show. So I really have to create the image folders under inetpub... I have set web sharing for inetpub to include the folder where my php web pages are stored ( which incidentally are also under inetpub) but that doesnt work. Its either I find a way to show images outside inetpub or find a way to create folders in inetpub...
View Replies !
Fopen() Permission Denied
I have created the file lhcount.data with the content the number 1 in it. This file is in the same directory (public_html) as the following index.php file that contains the following code: <?php echo("count"); $fh = fopen('lhcount.data','r+'); result is: count Warning: fopen(lhcount.data): failed to open stream: Permission denied in /home/abc/public_html/index.php The permissions are: public_html directory rwxrwx- - - lhcount.data rwxrwxr- - index.php rw-r- -r- - phpadmin() shows the following: safe_mode is off open_basedir has no value set I'm at a loss. I have used this with success at another web host.
View Replies !
Permission Denied In Socket_connect
I created a AF_UNIX socket and specify a file path /tmp/unix.str. However, whenever PHP tries to connect, I always got permission denied error. My PHP file has root access. Any idea? The server is a C program that creates a Unix socket.
View Replies !
Permission Denied On Move_uploaded_file()
I've run into a problem that a lot of other people seem have run into but I haven't been able to find the resolution so I'm hoping someone can help. I'm getting the following two error messages when I try to use the move_uploaded_file() method to upload hongkim.jpg: Warning: move_uploaded_file(hongkim.jpg): failed to open stream: Permission denied in /home/kccdenve/public_html/EM/new/upload2.php on line 10 Warning: move_uploaded_file(): Unable to move '/var/tmp/phpCvzSP9' to 'hongkim.jpg' in /home/kccdenve/public_html/EM/new/upload2.php on line 10 The code on the upload page is as below: Code:
View Replies !
Permission Denied - Fopen
What can cause the PHP code fopen("filename","a") to fail with permission denied message as below? ------------------ Warning: fopen(filename): failed to open stream: Permission denied in /home/lookout/u2/kmei/www/test1.php on line 14 ------------------ I write a short PHP code that works fine on my own apache server, but it doesn't work after I upload it to the university server. Note that 'chmod 777 filename' works as expected.
View Replies !
CURL :: Permission Denied
curl_setopt($ch, CURLOPT_USERAGENT, "RBot/0.1 (+http://www.xyz.com)"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $url = "http://www.xyz.com/about-us.php"; curl_setopt($ch, CURLOPT_URL, $url); $input = curl_exec($ch); if (curl_errno($ch)) { echo curl_errno($ch) . ' ' print curl_error($ch); } else { curl_close($ch);
View Replies !
Executing Multiple Shell Commands Via One Exec()-call
I wrote a PHP shell script under Linux which puts all existing [E]PS-Files within a directory into a list and should then start a single Ghostview window for each file. Sounds simple, but it's not: The following code provides for about half of the functionality I wanted: ==============code starts $bla = array(); foreach ($filelist as $file) { $bla[] = fopen("./trash/".$file.".tmp", "w"); exec ("gv ".$file." &", $bla); } ===============code ends Here, all files are opened one after another. The next file opens only after closing the current one. Actually I don't know whether the redirection of the output towards .tmp-files complies with the intended purpose of the redirection. The PHP manual states that when starting programs in background, the output would have to be redirected to a stream or file, otherwise PHP would continue to run until the respective program is terminated (which I really wouldn't care about at all, if it did so...). Then I thought about writing the line I would type manually for opening all ps-files ('gv bla1.ps & ; gv bla2.ps&; ...') into a string and then executing that string: ===============code starts $command=""; $bla = fopen("./trash/tmp", "w"); foreach ($filelist as $i => $file) { if ($i < count($filelist) - 1) { $command = $command."gv $file & ; "; } else { $command = $command."gv $file &"; } } exec ($command, $bla); ===============code ends sadly I get an error message from the shell: ================ error message starts sh: -c: line 1: syntax error near unexpected token `;' sh: -c: line 1: `gv uges_Boden.ps & ; gv ux_Boden.ps & ; gv uy_Boden.ps &' ================ error message ends
View Replies !
File Upload Permission Denied In ...
I've tried to write a script to upload files. I'm using redhat and php3. I'm receiving the followind error: Warning: Unable to create '/usr/local/apache/htdocs/rex/admin/test/html40.zip': Permission denied in /usr/local/apache/htdocs/rex/admin/test/test.php3 on line 40 What rights should i set ? I've tried all the combinations for owners and rights URL but it doesn't work....
View Replies !
Ajax Permission Denied Problem
while using ajax script in some servers, permission denied problem is coming. But for some servers , its working. It became very problem for me. Due to this problem, one site which i am doing, stopped its launching.
View Replies !
Permission Denied With Rename() Funcion
i am trying to rename a file using PHP i have the script as per below rename("/home/user/public_html/test.htm", /home/user/public_html/testOLD.htm"); when i run it i get an error Permission denied in the browser - why is this ?
View Replies !
Fopen Permission Denied Error
I have this script in which I make a function call to fopen(). It works on the localhost(windows) but when I upload it, to the remote server(Linux), I get an permission denied error. I chmod the folder to 777 and the script still fails. Aparently, I'm able to to copy files to the folder, as well as delete files from it but the fopen() call fails. This is the actual function call. fopen("../foo/foobar.php","w"); there is already a file there by that name, but that shouldn't make a difference. I even chmod the file "foobar.php" to 777 and still doesn't work.
View Replies !
Warning: Unlink(): Permission Denied In
Source Code like this: <?PHP If($MyFile != "none") { copy($MyFile,"c:/MyWeb/file"); unlink("C:/MyWeb/temp/$MyFile");} else { echo"You didn't upload any file";}?> The doc root: doc_root ="C:MyWeb" Upload temporary dirctory: upload_tmp_dir = C:/MyWeb/temp
View Replies !
Rename() Getting Permission Denied Error
I'm having an interesting problem with some file upload issues. I am uploading photos into a directory w/ 777 permissions and right after the photo is uploaded into the directory, I user the chmod command to set the permissions of the uploaded photo to 777 as well. Then I try to use the rename command to change the name of the photo and I get a permission denied error. Code:
View Replies !
Permission Denied On Uploaded Files
I am writing a file that allows users to create a page and add images blah. Anyways, i'm getting some permission errors? The files upload fine but I can't get rid of them :confused: I get a permission denied error. I believed the permissions are set to 644? I have it set so a user can upload more than one file. they upload one and it uploads and then goes back to the form retaining their information. Anyways, my code moves their file from the tmp folder to ANOTHER temp folder I assign to them when they first visit the form. Could that be causing my problem? Here is a little bit of my code. $baseimgdir="blah/blah/blah"; ((its retrieved from database but its an example)) $file_name=$_FILES['file_name']['name']; $tmpfile=$_FILES['file_name']['tmp_name']; $temp_fold=$_POST['temp_fold']; if (!is_dir($baseimgdir.$temp_fold)) { mkdir($baseimgdir.$temp_fold,0777); } if (!is_dir($baseimgdir.$temp_fold)) { echo "IT FAILED"; } else { $suc=@copy($tmpfile,$baseimgdir.$temp_fold."/".$file_name); if ($suc) { echo "GOOD JOB"; } else { echo "FAILED"; } }
View Replies !
File Upload - Permission Denied
I'm running into problems with a simple file upload. The error message indicates that it is a permission problem, but all the paths involved in this are set to 777 permissions. Boiled down to its essence the code is this: Code:
View Replies !
Flock() Permission Denied Error
when using flock() I get a permission denied error: Warning: fopen("<filename>", "r+") - Permission denied in <pathtofile> on line 7 $fileToOpen=substr($PHP_SELF, strrpos($PHP_SELF,"/")+1); $fileHandle=fopen($fileToOpen, 'r+') or die($php_erormsg); flock($fileHandle,LOCK_EX | LOCK_NB); $fileString=fread($fileHandle, filesize($fileToOpen)) or die($php_erormsg); // ,, // procesing of filecontents // ,, rewind($fileHandle);
View Replies !
Permission Denied :: Chmod For Folders
What IS the correct cmod for folders when you want to use php to create more folders inside them anyway: PHP Code: //make sure all is lowercase $username_l = strtolower($username); $folder = strtolower($username{0}); // set up ftp connection $conn_id = ftp_connect($ftp_server); $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // check connection if ((!$conn_id) || (!$login_result)) { echo "FTP connection has failed!"; exit; } //create folder if (!file_exists("users/$folder/$username_l")) { Â Â Â Â mkdir("users/$folder/$username_l"); Â Â Â Â chmod("users/$folder/$username_l", 0777); } // close the FTP stream ftp_close($conn_id);
View Replies !
Running As Root, Yet Permission Denied
They have a server here that runs PHP as root (which is probably bad). I wrote a test script that tries to create a text file. echo "<B>I'm running as user: " . $_ENV['USER'] . "</B><BR/><BR/>"; //open the file echo "<B>Opening file text.txt for writing:</B>"; $fp = fopen('text.txt',w); echo "<BR/>"; if(!$fp){ echo "<B>UNABLE TO CREATE THE FILE!</B>"; exit; } I get a permission denied error. The directory is CHMOD 755.
View Replies !
Delete Files On Win2k - Permission Denied
I'm trying to delete local files within a php-script running on win2k (I'm loggend in as administrator, the script is not meant to run in a web-environment but only from commandline). the problem is I get a "permission denied" when I try to delete the file with unlink($file) or try to move it with ($oldpath.$file,$newpath.$file). since I'm administrator there shouldn't be problems with win2k's file-permissions, the files I'm trying to delete are full accessible for everyone. the php manual says that "unlink" probably won't work on windows but doesn't say how to delete files then?
View Replies !
[function.copy] Failed (Permission Denied)
Warning: copy(g:mp) [function.copy]: failed to create stream: Permission denied I get an error message like that. I was trying to make an upload script. I'm using windows (2000) so chmod wouldn't help. Where should i get started to fix this problem?
View Replies !
Failed To Open Stream: Permission Denied
I recently had to restart my apache server and ever since then, no scripts that create or upload files to the server are working. I keep getting failed to open stream: Permission denied when trying to create a file or failed to open stream: No such file or directory when trying to upload files when running the scripts. Yes I have checked the most obvious, the folder permissions and they are set to 777 and the owner and group is also correct. I am wondering if there are any settings in my php.ini that may be causing my scripts to fail? Or an apache setting that may have gotten reset?
View Replies !
Rename, Unlink : Permission Denied XPpro, Apache, PHP 4.3.3
I've tried everything seen on Internet, but nothing works: I'm trying to move a file from a dir to a subdir (WinXP Pro, Apache, PHP 4.3.3) Here is the code: chmod($XMLPath, 0777); chmod($XMLPath.$file, 0777); chmod($XMLPath.$successpath, 0777); if (!rename($XMLPath.$file, $XMLPath.$successpath.$file)) //move file in success path if(!rename($XMLPath.$file, $XMLPath."file.old")){ if (copy($XMLPath.$file, $XMLPath.$successpath.$file)) unlink($XMLPath.$file); } both Rename and unlink give me Permission Denied error. The file isn't in read only mode, and the copy works fine (so the path are right...)
View Replies !
Session_start Throwing Stupid Permission Denied Errors.
I have written many php scripts that use sessions. All of my scripts work great. Today i came to work to find that all my scripts were throwing stupid permission denied errors. Nothing was changed on the server, as i am the only one who has control of the server. Specifically, session_start is giving me a lot of errors. Code:
View Replies !
Permission Denied Error When Trying To Delete Folders On Windows
I'm trying to delete a folder from my php script using rmdir, but I keep getting permission denied errors. Creating folders and creating and deleting files within them works perfectly OK, but I can't delete the folders. I'm using Apache on WinXP and have tried using various solutions I've found in various messages, but nothing works. I've tried setting partial and Full Control permissions for the Apache user, the Apache group, the IUSR_(machine name), everyone and even turned on the web sharing write permissions at every level from the folder itself right up to the top level on the partition. All the files in the folder have been deleted before the rmdir, so I don't think that's the problem. PHP Code:
View Replies !
Permission Denied Trying To Include() World-readable File
include('./include/constants.inc.php'); Warning: main(./include/constants.inc.php) [function.main]: failed to open stream: Permission denied in /var/www/html/tools/app/index.php on line 43 The file "constants.inc.php" has permissions of 0774, it's world readable. I am at a loss. Even increased all the way to 0777, to no avail, still get "Permission denied".
View Replies !
Running Shell Command Within Php
According to the manual for PHP, I should be able to run a shell command within php. I'm trying to copy some php files from one location to another one using exec() but fail. Code: ( text )
View Replies !
How Can I Run Shell Command Without Getting Return?
I want to call any shell command from php script using shell_exec(). The problem is that the next line of the php script would not be run until a few minutes after running the shell command. I found the shell command couldn't be run at background mode. It seemed that the shell_exec() function waits a return from the command. Because the command doesn't return, the shell_exec() waits until timeout reached. Using the '&' at the end of the command doesn't work expected. So I want to know how can I run any non-background mode shell command from php script without waiting return. I'll look forward to any answer.
View Replies !
WYSIWYG Editor File Upload With Permission Denied Error
i am using an WYSIWYG editor (spaw2) in my application. the text matter is being POSTed properly, but i am not able to upload any files using filemanager(audio/video/zip), delete/rename any manually saved files. also i am not able to create new subdirectories using the filemanager. i am getting the error that "PERMISSION DENIED" my httpd service is running with user/group as apache/apache uid=48 and the ownership of the htdocs is also with apache:apache with permissions 0777 the OS i am using is fedora core 6. I even tried the same using another editor (FCKeditor), but still it gives the same problem.
View Replies !
Warning: Ftp_mkdir() [function.ftp-mkdir]: Store: Permission Denied
I'm trying to have PHP make directories in another site via the use of the FTP functions. However, when I try to do so, I get the following errors: Warning: ftp_mkdir() [function.ftp-mkdir]: store: Permission denied in /home/dir.php on line 85 Warning: ftp_chdir() [function.ftp-chdir]: store: No such file or directory in /home/dir.php on line 86 But I don't understand why I wouldn't have permission because if I open an ftp client and login with the same information, I can make all the folders I want. And even the folder I'm trying to write into right now is CHMOD 777. Any possible reason why it isn't working?
View Replies !
Formatting Output Of `ls -l` Shell Command
As in the topic, I use www to execute shell command, in this case 'ls -l' and i get output like: total 8 drwx------ 11 lecichy staff 4096 Oct 15 18:18 Maildir drwx---r-x 3 lecichy staff 4096 Oct 13 19:28 public_html etc. but what If i would want to print to www only some columns. e.g. only filename and size like; dir contains Maildir size: 4096 public_html size 4096 or any other combinations, the point is if anyone has any ideas how to split the output of this command to variables on which i can easily operate? And maybe its possible to achieve it in the other way. What I mean is selecting filenames and so on as a regular strings from a specific line of text?
View Replies !
PHP Parsing Shell Command Results
I am running a shell command via a php started ssh connection to a mail server. I need to grab the data the shell command displays and then load them into variables or an array ... Can anyone give me ideas on how to do this ... Note: I posted this on alt.php.sql ... so this is a cross post...
View Replies !
Capturing Output From GPG Command In Shell...
I have finally sorted out that it was permissions that were preventing me from running the gpg commands I was trying to run and I can now run them. The problem is that I am having real trouble capturing the output from the commands I am running. Just to be clear; $output = shell_exec("ls -l"); echo $output; does echo to the browser what one would expect ( a long string containing the results of the command). Unfortunately, when I run this command: $output = shell_exec("/usr/local/bin/gpg --homedir /usr/home/manager/.gnupg -b test.xml"); and then I echo $output I get nothing out of the variable - I'm stumped. The command does work - I have run it on the server from the command line and it does sign the document by creating a detached signature (as I want it to do). Am I missing something?
View Replies !
Shell_exec() Command - Linux's Shell
I've came up with an issue when trying to work on Linux's shell using PHP it seems to work when I issue the following commands, shell_exec("iptables -h");, shell_exec("ls"); and shell_exec("ifconfig"); however when I'm trying to do something like this, shell_exec("iptables -L") or shell_exec("iptables restart"); it doesnt seem to work.
View Replies !
ProgressBar For A Shell Exec Command
I am executing a shell command through php $command = "some mathematical calculations": $output = exec($command); The $output takes approximately 10 - 40 sec for its execution every time. I wanted to show a progress bar proportionate to the time of execution. Code:
View Replies !
Upload Script: Failed To Open Stream: Permission Denied In Windows NT
i've put an upload script on my site, hosted on a Windows NT Version 5.0 server. When i try to upload something i get an error: copy(files/file.txt): failed to open stream: Permission denied in d:sitesmatita.bewebsiteuploaded.php on line 20 Could not copy The problem is that i am not able to change the permissions, since it's a windows server. CHMOD is not supportes, CACLS neither. Is there a way out, or is it up to the server admin to install some 'permission system'?
View Replies !
Warning: Pg_query() Query Failed: ERROR: Directories: Permission Denied
I've ran into a wierd problem with my script, and i'm quite dumfounded. I'm doing a PHP interface to create directories into a filebank. The idea is that the directories are virtual, they don't truly exist in the server. The directory names are saved into a PostgreSQL table, in quite simple fashion. The wierd problem is that i get the following error message when i try add the directory name into the database: Warning: pg_query() query failed: ERROR: directories: Permission denied. in /var/www/html/okartek/inc/class_psql.php on line 50 The sql is done by a class, called by this function: PHP Code:
View Replies !
|