Can exec-php system functions call simple commands and cannot execute the octave script?

Source: Internet
Author: User
Problem Description: Ave is a GNU open-source scientific computing software compatible with matlab syntax. I wrote a piece of Ave script, specifying octave as the interpreter at the beginning #! Usrbinoctave can directly execute this script under the command line to generate the image I want. Use. octavedemo... problem description:

Ave is a GNU open-source scientific computing software compatible with matlab syntax. I wrote a piece of Ave script, specifying octave as the interpreter at the beginning#!/usr/bin/octave
Execute this script directly under the command line to generate the image I want. Ready for use./octavedemo.m arg1 arg2...

But now I want to use php system functions such as shell_exec () to execute this command, but it cannot take effect.
To test whether it is a permission issue, I tried to use shell_exec () to execute simple ls-l and other commands, which can be successful:

$test = shell_exec("ls -l");echo $test;

Js can receive and print the results on the console, so it should not be a problem with the system function execution permission.

So I would like to ask what kind of situation may lead?
Is it too long to generate images slowly? I have set max_excution_time to 600 in php. ini. it should be enough;
Or is the image too big to generate, unlike simple text?

Thanks for your experience!

Update (resolved ):

Originally, I created a new demonstrate directory under the default html directory of apache, and put php and other files in this directory. then I just entered this directory, the chmod 777 operation is performed on all files in it.
Now I tried to grant the 777 permission to the demonstrate directory, and the problem was solved. It should be because you cannot generate files in this directory because you do not grant the read and write permissions to this directory.
Facts have proved that it is still necessary to think clearly about the logic of each step to avoid wasting time. thank you!

Reply content: Problem description:

Ave is a GNU open-source scientific computing software compatible with matlab syntax. I wrote a piece of Ave script, specifying octave as the interpreter at the beginning#!/usr/bin/octave
Execute this script directly under the command line to generate the image I want. Ready for use./octavedemo.m arg1 arg2...

But now I want to use php system functions such as shell_exec () to execute this command, but it cannot take effect.
To test whether it is a permission issue, I tried to use shell_exec () to execute simple ls-l and other commands, which can be successful:

$test = shell_exec("ls -l");echo $test;

Js can receive and print the results on the console, so it should not be a problem with the system function execution permission.

So I would like to ask what kind of situation may lead?
Is it too long to generate images slowly? I have set max_excution_time to 600 in php. ini. it should be enough;
Or is the image too big to generate, unlike simple text?

Thanks for your experience!

Update (resolved ):

Originally, I created a new demonstrate directory under the default html directory of apache, and put php and other files in this directory. then I just entered this directory, the chmod 777 operation is performed on all files in it.
Now I tried to grant the 777 permission to the demonstrate directory, and the problem was solved. It should be because you cannot generate files in this directory because you do not grant the read and write permissions to this directory.
Facts have proved that it is still necessary to think clearly about the logic of each step to avoid wasting time. thank you!

Php shell_exec adopts the web user permission ~ Are you sure you have the execution permission for your script?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.