473,396 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

echo for large string?

When I run these two lines from my SSH term $out is printed fine to
STDOUT. When I run it from a web browser nothing is printed out? I have
many php cgi scripts, so I am stumbled as to why this one is not
working?

The only thing I can think of is $out is a large string, around 50kb?

$out = shell_exec ( $executable);
echo $out;

Thanks

Jul 17 '05 #1
7 2814
el*************@yahoo.com wrote:
When I run these two lines from my SSH term $out is printed fine to
STDOUT. When I run it from a web browser nothing is printed out? I have
many php cgi scripts, so I am stumbled as to why this one is not
working?

The only thing I can think of is $out is a large string, around 50kb?
50Kb is nothing. Couldn't find it in the manual, but I am pretty sure
the sky is your limit.
$out = shell_exec ( $executable);
echo $out;


Are you supressing errormessages?

Check that the web-server account has execute rights.
If you are running selinux, try turn it off (or setenforce permissive),
and check the logs while testing.
/Bent
Jul 17 '05 #2
Basically I am trying to execute a perl script from a php script. I got
it to work by chmoding my perl script from 700 to 704 . But now I get
"permission denied errors" whenver my perl script tries to append/write
to a file?

Is this a perl or php configuration problem? The perl script runs fine
when called from any website. How can I change the script so when it is
called from php it has permissions to write to files?

Thanks!

Jul 17 '05 #3
On 8 May 2005 09:34:57 -0700, el*************@yahoo.com wrote:
Basically I am trying to execute a perl script from a php script. I got
it to work by chmoding my perl script from 700 to 704 . But now I get
"permission denied errors" whenver my perl script tries to append/write
to a file?
704? Should be 755. (Better would be 750 and have the process
running the command be in the same group as the owner of the command.
Is this a perl or php configuration problem? The perl script runs fine
when called from any website. How can I change the script so when it is
called from php it has permissions to write to files?
It's not the script, it's the user running the program not having
permission to write to the directory or files.

Example User: Username Group: Groupname
Dir owned by SomeOtherUsername and Group SomeOtherGroupName with
permissions like

700

Put UserName in the SomeOtherGroupName Group and change the perms on
the group to 770. Change the perms on any file Username needs to
write to 660. (You can use 775 and 664 respectivly if you don't mind
others on your server being able to READ the files.

Thanks!


--
gburnore@databasix dot com
---------------------------------------------------------------------------
How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
DataBasix | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ 3 4 1 4 2 ݳ޳ 6 9 0 6 9 ÝÛ³
Black Helicopter Repair Svcs Division | Official Proof of Purchase
================================================== =========================
Want one? GET one! http://signup.databasix.com
================================================== =========================
Jul 17 '05 #4
How about this solution below?

$out = file ('http://www/mydomain.com/cgi-bin/my_perl_script.pl');

for ($i=0; $i< count ($out); $i++ ) { echo $out[$i]; }

Seems more portable and simpler, and it would be easy
to pass parameters to my perl scripy by adding ?param=value
to the URL.

Jul 17 '05 #5
(el*************@yahoo.com) decided we needed to hear...
How about this solution below?

$out = file ('http://www/mydomain.com/cgi-bin/my_perl_script.pl');

for ($i=0; $i< count ($out); $i++ ) { echo $out[$i]; }

Seems more portable and simpler, and it would be easy
to pass parameters to my perl scripy by adding ?param=value
to the URL.

The above doesn't do anything except echo the contents of your perl
script back to the browser - it will not be executed - you've coded
pretty much what the readfile function does.
Neither does it solve your permission issue.
--
Dave <da**@REMOVEbundook.com>
(Remove REMOVE for email address)
Jul 17 '05 #6

"Dave" <da**@REMOVEbundook.com> wrote in message
news:39************@fawlty.homelinux.net...
(el*************@yahoo.com) decided we needed to hear...
How about this solution below?

$out = file ('http://www/mydomain.com/cgi-bin/my_perl_script.pl');

for ($i=0; $i< count ($out); $i++ ) { echo $out[$i]; }

Seems more portable and simpler, and it would be easy
to pass parameters to my perl scripy by adding ?param=value
to the URL.

The above doesn't do anything except echo the contents of your perl
script back to the browser - it will not be executed - you've coded
pretty much what the readfile function does.
Neither does it solve your permission issue.


If the server he's requesting the perl file from excutes it first (looks
like a CGI script by the URL), he would get the output from the script in
the $out variable as an array.

I would also posit that instead of a for loop, he should use foreach. e.g.

foreach($line in $out) { echo $line; }

Much easier to read.
Jul 17 '05 #7
Aidan (no***********@linknet.com.au) decided we needed to hear...

"Dave" <da**@REMOVEbundook.com> wrote in message
news:39************@fawlty.homelinux.net...
(el*************@yahoo.com) decided we needed to hear...
How about this solution below?

$out = file ('http://www/mydomain.com/cgi-bin/my_perl_script.pl');

for ($i=0; $i< count ($out); $i++ ) { echo $out[$i]; }

Seems more portable and simpler, and it would be easy
to pass parameters to my perl scripy by adding ?param=value
to the URL.

The above doesn't do anything except echo the contents of your perl
script back to the browser - it will not be executed - you've coded
pretty much what the readfile function does.
Neither does it solve your permission issue.


If the server he's requesting the perl file from excutes it first (looks
like a CGI script by the URL), he would get the output from the script in
the $out variable as an array.

I would also posit that instead of a for loop, he should use foreach. e.g.

foreach($line in $out) { echo $line; }

Much easier to read.

Good point - I blame the fact I didn't realise that on me having a long
day yesterday ;)
Still might as well use readfile though, then theres no need to bother
with a loop at all.

--
Dave <da**@REMOVEbundook.com>
(Remove REMOVE for email address)
Jul 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: JS Bangs | last post by:
I started using PHP's object-oriented stuff a little while ago, which has mostly been a joy. However, I've noticed that they don't seem to echo as I would like. Eg: $this->field = 255;...
3
by: Michael Flanagan | last post by:
Of course "echo" is working, but I've got a case where php doesn't seem to be sending out the result of an "echo." I'm probably doing something wrong, but I can't see it. I've got the following...
7
by: haoren | last post by:
Can anybody help me with this problem: How can I echo a string that contain <? and <?php? For example, $str="test <? and <?php echo"; echo $str;
9
by: Domestos | last post by:
Here an unusual one... Say i am writing a few lines of code in php script as so... <?php echo '<table>'; echo '<tr>'; echo '<td> blah blah </td>'; echo '</tr>'; echo '</table>';
9
by: windandwaves | last post by:
Hi Folk My question is: echo all the time vs echo at the end - what is faster Let me explain I used to write pages like this: echo "<head> ";
4
by: weirdstuff | last post by:
Hi. I have this simple code: =========================================== ->Database query here (.. some code) $row=mysql_fetch_array($res); (...)
4
by: | last post by:
The title is maby a bit strage, I had problem coming up with a title that explain my problem. I have a variable $myvar="TEST 123" I would like to use this variable as a default value in a...
10
by: M | last post by:
Hi, Suppose you have the situation where you have say 20 blocks of text (~250 chars each) in a MySQL db that you need to display, but each has a condition to check to see whether you should...
11
by: Twayne | last post by:
Hi, Irrelevant question time, probably: Is there any advantage/reason to use one format over the other for the following two types of echo statements? 1. echo "error is " . $error; 2. ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.