It's too early to settle the bill...

Source: Internet
Author: User
It's too early to check out. the problem ...... I found a problem, that is, it was too early to settle the bill, and the Post crashed ...... If a BUG occurs again during the test, you have to re-open a post to ask ...... & Nbsp; CSDN is very expensive ...... Now, let's get down to the truth. 1. system and shell_exec, exec are both php execution system external commands, but the same command is psaux | grephttpd-c & nbsp; I checked out too early in the command line, and the problem occurred ......
I found a problem, that is, it was too early to settle the bill, and the Post crashed ...... If a BUG occurs again during the test, you have to re-open a post to ask ......
CSDN is very expensive ......

Now, let's get down to the truth.
1. system and shell_exec, exec are both php execution system external commands, but the same command, ps aux | grep httpd-c
Why do I display 11 in the browser when I display 10 in the command line?
I have counted only nine of them, and one of them is
Root 27719 0.0 0.0 5476... s + 0.00 grep httpd.
What does this mean?
If it's grep once, it's also counted in 10 ps. So how did 11 of the browsers come from?

(Shell_exec ('PS aux | grep httpd-c') the result displayed in the browser is inconsistent with that displayed in # ps axu | grep httpd-c in linux .)
2. how to directly execute the php file in the command line?
For example, if you want to run test. php, you can directly input # php test. php in the command line to output the result without opening a browser.
After checking the information, # cp/usr/local/php/bin/php/usr/sbin installs php as a linux system command. But in this case, enter the php file path.
# Php/usr/local/apache2/htdocs/test. php can be executed in this way.
I would like to ask, where can I set the default path of the php execution file? For example, I set the default path to/usr/local/apache2/htdocs.
In this way, I do not need to enter such a long path during execution. Directly # php test. php is complete ......

------ Solution --------------------
Check out? Amount ~~
1. you cannot open an httpd process in your browser.
2. if you run the command without adding a path, the default path is the current directory. do you just need to run cd to/usr/local/apache2/htdocs and then php test. php?
------ Solution --------------------
As the saying goes, if you give money and goods, you will accept the answer.
Actually, it's okay. as long as you come to CSDN to reply to the post, the available points are all floating cloud...
If you don't have one, I will donate some.
------ Solution --------------------
To directly execute your php file under the doc, you need to set the system path variable.

Run the path command in the doc to check whether the php installation path exists.
------ Solution --------------------
1. is your apache in worker mode? So when you access it, an httpd process is added, and the process is closed after you exit. The grep command itself is grep, so grep-v grep must be added.

2. add the ban header in front of php, for example #! /Usr/local/php/bin/php is the same as shell script
Then you can directly./test. php.

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.