From tboyden at supercoups.com Thu Mar 13 19:58:48 2008 From: tboyden at supercoups.com (Timothy Boyden) Date: Thu, 13 Mar 2008 19:58:48 -0400 Subject: [Bostonphptalk] Shell_exec file copy problem Message-ID: Hi list, Hoping someone can help me out. I'm writing a quick and dirty script for internal, non-public use to search a file system and copy some files based on a text file of job numbers. I pretty much have the script 99% there, but for some reason when I go to execute a shell command to copy the files, the files don't copy. The shell command errors, but the errors the shell command produces don't get returned to the shell_exec command. If I run the command on the command line, the file copies fine. The code is a bit long to post here, so I'll post a link if someone is willing to take a look and give their opinion: http://boyden.us/codelisting.txt. Please excuse the rough code, I didn't throw in any error checking, and it probably doesn't comply with best practices, as I said I needed something pretty quick to solve some manual processes. My system specs are: Solaris 8 Apache 2 PHP 5.2.1 TIA for your help! -Tim -------------- next part -------------- An HTML attachment was scrubbed... URL: From fshaw at runestones.com Thu Mar 13 20:12:07 2008 From: fshaw at runestones.com (Frank Shaw) Date: Thu, 13 Mar 2008 20:12:07 -0400 Subject: [Bostonphptalk] Shell_exec file copy problem In-Reply-To: Message-ID: <04b201c88568$0b3f9b30$6401a8c0@lpfrank> Could it be a file permission issue? Do you have permission to do a excuete command from a PHP script ? Frank H. Shaw _____ From: bostonphptalk-bounces at bostonphp.org [mailto:bostonphptalk-bounces at bostonphp.org] On Behalf Of Timothy Boyden Sent: Thursday, March 13, 2008 7:59 PM To: bostonphptalk at bostonphp.org Subject: [Bostonphptalk] Shell_exec file copy problem Hi list, Hoping someone can help me out. I'm writing a quick and dirty script for internal, non-public use to search a file system and copy some files based on a text file of job numbers. I pretty much have the script 99% there, but for some reason when I go to execute a shell command to copy the files, the files don't copy. The shell command errors, but the errors the shell command produces don't get returned to the shell_exec command. If I run the command on the command line, the file copies fine. The code is a bit long to post here, so I'll post a link if someone is willing to take a look and give their opinion: http://boyden.us/codelisting.txt. Please excuse the rough code, I didn't throw in any error checking, and it probably doesn't comply with best practices, as I said I needed something pretty quick to solve some manual processes. My system specs are: Solaris 8 Apache 2 PHP 5.2.1 TIA for your help! -Tim -------------- next part -------------- An HTML attachment was scrubbed... URL: From tboyden at supercoups.com Thu Mar 13 20:15:57 2008 From: tboyden at supercoups.com (Timothy Boyden) Date: Thu, 13 Mar 2008 20:15:57 -0400 Subject: [Bostonphptalk] Shell_exec file copy problem In-Reply-To: <04b201c88568$0b3f9b30$6401a8c0@lpfrank> References: <04b201c88568$0b3f9b30$6401a8c0@lpfrank> Message-ID: Yeah, the shell_exec (using `shell command` in my code) works for my other shell command to find the files using the Solaris Find command. It's just the shell copy command that doesn't work. -Tim ________________________________ From: bostonphptalk-bounces at bostonphp.org [mailto:bostonphptalk-bounces at bostonphp.org] On Behalf Of Frank Shaw Sent: Thursday, March 13, 2008 8:12 PM To: bostonphptalk at bostonphp.org Subject: Re: [Bostonphptalk] Shell_exec file copy problem Could it be a file permission issue? Do you have permission to do a excuete command from a PHP script ? Frank H. Shaw ________________________________ From: bostonphptalk-bounces at bostonphp.org [mailto:bostonphptalk-bounces at bostonphp.org] On Behalf Of Timothy Boyden Sent: Thursday, March 13, 2008 7:59 PM To: bostonphptalk at bostonphp.org Subject: [Bostonphptalk] Shell_exec file copy problem Hi list, Hoping someone can help me out. I'm writing a quick and dirty script for internal, non-public use to search a file system and copy some files based on a text file of job numbers. I pretty much have the script 99% there, but for some reason when I go to execute a shell command to copy the files, the files don't copy. The shell command errors, but the errors the shell command produces don't get returned to the shell_exec command. If I run the command on the command line, the file copies fine. The code is a bit long to post here, so I'll post a link if someone is willing to take a look and give their opinion: http://boyden.us/codelisting.txt. Please excuse the rough code, I didn't throw in any error checking, and it probably doesn't comply with best practices, as I said I needed something pretty quick to solve some manual processes. My system specs are: Solaris 8 Apache 2 PHP 5.2.1 TIA for your help! -Tim -------------- next part -------------- An HTML attachment was scrubbed... URL: From johnston.joshua at gmail.com Thu Mar 13 21:26:33 2008 From: johnston.joshua at gmail.com (Joshua Johnston) Date: Thu, 13 Mar 2008 21:26:33 -0400 Subject: [Bostonphptalk] Shell_exec file copy problem In-Reply-To: References: Message-ID: <12de48da0803131826y5181b081qf32b84d19d446808@mail.gmail.com> Tim, First thing I would do is remove the backtick operators and use exec() instead. Using exec() you can pass an array as the second parameter that will be filled with the output generated by the command execution. Then you can check for errors. Quick example: Next I assume the problem is that the user that the webserver is running as doesn't have the proper permissions to perform the operations you are requesting. This is probably why it works by hand but the script does not. On Thu, Mar 13, 2008 at 7:58 PM, Timothy Boyden wrote: > > > Hi list, > > Hoping someone can help me out. I'm writing a quick and dirty script for > internal, non-public use to search a file system and copy some files based > on a text file of job numbers. I pretty much have the script 99% there, but > for some reason when I go to execute a shell command to copy the files, the > files don't copy. The shell command errors, but the errors the shell command > produces don't get returned to the shell_exec command. If I run the command > on the command line, the file copies fine. The code is a bit long to post > here, so I'll post a link if someone is willing to take a look and give > their opinion: http://boyden.us/codelisting.txt. Please excuse the rough > code, I didn't throw in any error checking, and it probably doesn't comply > with best practices, as I said I needed something pretty quick to solve some > manual processes. > > My system specs are: > > Solaris 8 > Apache 2 > PHP 5.2.1 > > TIA for your help! > > -Tim > > > > > _______________________________________________ > Bostonphptalk mailing list > Bostonphptalk at bostonphp.org > http://seven.pairlist.net/mailman/listinfo/bostonphptalk > > From bob at rsi.com Thu Mar 13 22:22:45 2008 From: bob at rsi.com (Bob Gorman) Date: Thu, 13 Mar 2008 22:22:45 -0400 Subject: [Bostonphptalk] Shell_exec file copy problem In-Reply-To: References: Message-ID: <47D9E175.8030406@rsi.com> On 03/13/2008 07:58 PM, Timothy Boyden wrote: > copy some files ... I go to execute a shell Have you tried the copy() function in php? http://us3.php.net/copy You can also use php to traverse directories and find files, if you like. From tboyden at supercoups.com Fri Mar 14 11:52:31 2008 From: tboyden at supercoups.com (Timothy Boyden) Date: Fri, 14 Mar 2008 11:52:31 -0400 Subject: [Bostonphptalk] Shell_exec file copy problem In-Reply-To: <12de48da0803131826y5181b081qf32b84d19d446808@mail.gmail.com> References: <12de48da0803131826y5181b081qf32b84d19d446808@mail.gmail.com> Message-ID: Thank you all for your suggestions. None of them worked, but they did help me fix some other issues I encountered on the way to the solution. To get the files to copy, I added a -exec cp command to the end of my shell command to copy the file at the same time it finds it. This does slow the script a little bit as it has to wait for the copy to complete for each file, but it gets the job done. I did manage to use Josh's exec() example to do a check if the $output array contained files or not as an error checking step. The $returnVal though always returned 0 regardless if it found and copied a file or not, so I wasn't able to take advantage of that aspect of his example. Thanks again, Tim -----Original Message----- From: bostonphptalk-bounces at bostonphp.org [mailto:bostonphptalk-bounces at bostonphp.org] On Behalf Of Joshua Johnston Sent: Thursday, March 13, 2008 9:27 PM To: bostonphptalk at bostonphp.org Subject: Re: [Bostonphptalk] Shell_exec file copy problem Tim, First thing I would do is remove the backtick operators and use exec() instead. Using exec() you can pass an array as the second parameter that will be filled with the output generated by the command execution. Then you can check for errors. Quick example: Next I assume the problem is that the user that the webserver is running as doesn't have the proper permissions to perform the operations you are requesting. This is probably why it works by hand but the script does not. On Thu, Mar 13, 2008 at 7:58 PM, Timothy Boyden wrote: > > > Hi list, > > Hoping someone can help me out. I'm writing a quick and dirty script > for internal, non-public use to search a file system and copy some > files based on a text file of job numbers. I pretty much have the > script 99% there, but for some reason when I go to execute a shell > command to copy the files, the files don't copy. The shell command > errors, but the errors the shell command produces don't get returned > to the shell_exec command. If I run the command on the command line, > the file copies fine. The code is a bit long to post here, so I'll > post a link if someone is willing to take a look and give their > opinion: http://boyden.us/codelisting.txt. Please excuse the rough > code, I didn't throw in any error checking, and it probably doesn't > comply with best practices, as I said I needed something pretty quick to solve some manual processes. > > My system specs are: > > Solaris 8 > Apache 2 > PHP 5.2.1 > > TIA for your help! > > -Tim > > > > > _______________________________________________ > Bostonphptalk mailing list > Bostonphptalk at bostonphp.org > http://seven.pairlist.net/mailman/listinfo/bostonphptalk > > _______________________________________________ Bostonphptalk mailing list Bostonphptalk at bostonphp.org http://seven.pairlist.net/mailman/listinfo/bostonphptalk From ken at secdat.com Mon Mar 24 08:48:27 2008 From: ken at secdat.com (Kenneth Downs) Date: Mon, 24 Mar 2008 08:48:27 -0400 Subject: [Bostonphptalk] [ANNOUNCE] Andromeda demo (finally) available Message-ID: <47E7A31B.1040104@secdat.com> Well, we've (finally) got a fully functional public demo of Andromeda out there: http://www.andromeda-project.org/demo It is the start of a basic accounting system, with about a dozen tables populated with test data. Feel free to insert, delete, etc. The entire app has only 5 source files, and you can view them right after logging in. The largest of course is the bookkeep.dd.yaml file, the heart of the whole thing. -- Kenneth Downs Secure Data Software, Inc. www.secdat.com www.andromeda-project.org 631-689-7200 Fax: 631-689-0527 cell: 631-379-0010