PHP system functions can invoke simple commands, unable to execute octave script?

Source: Internet
Author: User

Problem Description:

Octave is the GNU Open Source Scientific computing software compatible with MATLAB syntax. I wrote a octave script, specifying octave as the interpreter at the beginning#!/usr/bin/octave
Execute this script directly under the command line, it is possible to generate the picture I want. that uses./octavedemo.m arg1 arg2...

And now I want to use PHP's system functions such as Shell_exec () to execute this command, but does not take effect.
To test whether it is a permission problem, I try to execute a simple ls-l command with shell_exec (), which is successful:

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

JS is able to receive and print the results in the console, so it should not be the system function execution permissions.

So what could possibly be the cause of the question?
Does it take too long to generate pictures that are slow? I have set the Max_excution_time to 600 in php.ini, it should be enough.
Or the picture is too big, unlike the simple text, can not generate so big?

If you can provide some experience, thank you very much!

Update (Resolved):

Originally I was in the default HTML directory of Apache, create a new demonstrate directory, and then put PHP and other files in this directory, and then I just entered the directory, all the files inside the chmod 777 operation.
Now try to give the demonstrate directory 777 permissions, and then the problem is resolved. Should not give this directory permission to read and write permissions, you can not generate files inside the reason.
As it turns out, it's time to think more clearly about the logic of each step so that we don't waste any more, thanks to the people who answered!

  • 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.