In Linux, PHP executes exec PHP version 5.4.
The PHP code is as follows:
Root users use php test. php on the server terminal
The output result is as follows, which is correct.
[root@localhost htdocs]# php test.phparray(1) { [0]=> string(4) "root"}
But enter the http://192.168.x.x/test.php in the browser
The output is empty.
I feel that it is a permission issue on the linux server, but I don't know which permission issue.
The user name for running httpd is apache.
Reply to discussion (solution)Whoami display login name
The viewer accesses the website anonymously (that is, without a name), so it is correct to display it as null.
Whoami display login name
The viewer accesses the website anonymously (that is, without a name), so it is correct to display it as null.
Change to exec ('date', $ r);. I think it is a permission issue. Disable_functions in php. ini does not have a disabled function. Output the error and you will know if the permission is incorrect.
Output the error and you will know if the permission is incorrect.
In apache access. log, only get requests exist.
There is no error in apache error. log.
Output the error and you will know if the permission is incorrect.
In apache access. log, only get requests exist.
There is no error in apache error. log.
Please open the php error output
Output the error and you will know if the permission is incorrect.
In apache access. log, only get requests exist.
There is no error in apache error. log.
Please open the php error output
Is error output display_errors in php. ini?
If yes, display_errors is already on
No errors
Then you can give chmod 777
Both whoami and date can output results in the browser.
I have tested it in linux. I think you are more inclined to select the latter for the remaining two characters and permissions...
No errors
Then you can give chmod 777
Both whoami and date can output results in the browser.
I have tested it in linux. I think you are more inclined to select the latter for the remaining two characters and permissions...
Can I change test. php to 777? It is useless after the change, no matter whether I change the ownership of test. php to apache or root.
-Rwxrwxrwx. 1 root 38 Jul 10 16:14 test. php
No errors
Then you can give chmod 777
Both whoami and date can output results in the browser.
I have tested it in linux. I think you are more inclined to select the latter for the remaining two characters and permissions...
Can I change test. php to 777? It is useless after the change, no matter whether I change the ownership of test. php to apache or root.
-Rwxrwxrwx. 1 root 38 Jul 10 16:14 test. php
What about directory permissions? I can't think of any other things. what kind of Linux do you test? everything is fine in Ubuntu... Tested, everything works.
My environment is:
Centos 1, 6.5
Python 5.4
In Apache 2.4
The user name (group) for executing Apache httpd is not a logged-on apache: apache
Nginx
Python 5.3
No output