cannot execute copy comment but can do echo


 
Thread Tools Search this Thread
Top Forums Web Development cannot execute copy comment but can do echo
# 1  
Old 08-17-2012
cannot execute copy comment but can do echo

I have set the sh file to chmod 755
i only able to print the output but cannot execute the copy why?

Below is the code for sh file

Code:
echo "Hello"
cp hello.sh helloworld.sh


Below is my code for php.

Code:
<html>
<head>
</head>
<body>
<?php echo '<p>Hello</>'; ?>
<?php shell_exec('sh /home/user/hello.sh'); ?>
</body>
</html>

# 2  
Old 08-17-2012
It will execute in whatever current directory the web server happens to be using, not your home directory.

And the web server probably doesn't have permission to modify your home directory anyway. Try putting a copy in /tmp/, the web server should be able to write there.
This User Gave Thanks to Corona688 For This Post:
# 3  
Old 08-17-2012
i have configure the apache to execute in my home directory. if i want to execute in home directory, is there anyway to modify my permission for home? is it using chmod 755 also?
# 4  
Old 08-17-2012
Quote:
Originally Posted by zhengkoon8
i have configure the apache to execute in my home directory.
What exactly did you do to do so?
Quote:
if i want to execute in home directory, is there anyway to modify my permission for home?
To allow apache to write to it:

Code:
chown :apache /home/myusername
chmod g+rwx /home/myusername

This User Gave Thanks to Corona688 For This Post:
# 5  
Old 08-17-2012
ok. thanks. i think tmp should be fine to me. thanks ya.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

One Line Command how to use pipe statements to execute and comment on multiple possible outcomes

Hello Forum, I'm looking to expand the following command: INACTIVE_KERNELS=$(python -mplatform | grep -qi red && rpm -qa | grep '^kernel-' |grep -vE `uname -r` | paste -sd \; || echo "Not Red Hat Server") Currently this command will check if my server is RedHat server using the grep -qi... (6 Replies)
Discussion started by: greavette
6 Replies

2. Shell Programming and Scripting

Shell script to copy a file from one server to anther server and execute the binary

Hi , Is there any script to copy a files (weblogic bianary + silent.xml ) from one server (linux) to another servers and then execute the copy file. We want to copy a file on multiple servers and run the installation. Thanks (1 Reply)
Discussion started by: Nawrajesh
1 Replies

3. Shell Programming and Scripting

With that logic this echoes "echo". Question about echo!

echo `echo ` doesn't echoes anything. And it's logic. But echo `echo `echo ` ` does echoes "echo". What's the logic of it? the `echo `echo ` inside of the whole (first) echo, echoes nothing, so the first echo have to echo nothing but echoes "echo" (too much echoing :P):o (2 Replies)
Discussion started by: hakermania
2 Replies

4. Shell Programming and Scripting

Need to echo a text where a (.) is added to the end of line during on-going copy or ftp

Hello All, I would like to create a script to echo a text where a (.) dot is added every 2 seconds to the end of this text (with a limit of 10 dots) as long as a file copy or ftp is ongoing and once the copy is finished it adds "done" to the end of this text line. please see the below example: ... (6 Replies)
Discussion started by: Dendany83
6 Replies

5. UNIX for Dummies Questions & Answers

How to correctly use an echo inside an echo?

Bit of a weird one i suppose, i want to use an echo inside an echo... For example... i have a script that i want to use to take users input and create another script. Inside this script it creates it also needs to use echos... echo "echo "hello"" >$file echo "echo "goodbye"" >$file ... (3 Replies)
Discussion started by: mokachoka
3 Replies

6. Shell Programming and Scripting

Difference between using "echo" builtin and /bin/echo

So in my shell i execute: { while true; do echo string; sleep 1; done } | read line This waits one second and returns. But { while true; do /bin/echo string; sleep 1; done } | read line continues to run, and doesn't stop until i kill it explicitly. I have tried this in bash as well as zsh,... (2 Replies)
Discussion started by: ulidtko
2 Replies

7. UNIX for Dummies Questions & Answers

comment lines

Is there a command to put a comment (#) in a whole part of a shell script? (5 Replies)
Discussion started by: vero_81
5 Replies

8. Shell Programming and Scripting

How to copy and comment out

I need help with a script. Here's what I want to do. I have a file "upsrk.txt" which can be either under "/home/upsrk" OR "/home/oracle" On some systems file "upsrk.txt" may not exist, in that case I want to just exit out of the script. If the file is there, I want to check if I have the... (3 Replies)
Discussion started by: upsrk
3 Replies

9. Shell Programming and Scripting

Need to execute 2 scripts, wait, execute 2 more wait, till end of file

:cool: I need to execute a shell script to do the following: cat a file run two back ground processes using the first two values from the file wait till those background processes finish run two more background processes using the next two values from the file wait till those background... (1 Reply)
Discussion started by: halo98
1 Replies

10. UNIX for Dummies Questions & Answers

# comment

Hi guys and Gals AIX 5.1 If I had a # above several scripts would it comment out everything below it? Like this # 01 2 ** ..................................... 02 31 ......................................... # this is a script 03 12 **.......................... Would... (6 Replies)
Discussion started by: rocker40
6 Replies
Login or Register to Ask a Question