In linux, php can be executed using IE, but cannot be executed using commands.

Source: Internet
Author: User
In linux, php can be executed using IE, but cannot be executed using commands, ask the root user to execute the command:/usr/local/php/bin/php-f/usr/local/apache2/htdocs/test. php
Test. php permission:-rwxr-xr-x. 1 root 22 April 10 15:04 test. php

The execution result is: PHP Fatal error: Unknown: Failed opening required'/usr/local/apache2/htdocs/test. php '(include_path = '. :/usr/local/php/lib/php') in Unknown on line 0

Fatal error: Unknown: Failed opening required'/usr/local/apache2/htdocs/test. php '(include_path = '. :/usr/local/php/lib/php') in Unknown on line 0


I have been running php on linux for the first time.


Reply to discussion (solution)

Check whether the directory location of the file is correct.

Running path?
When the php command line is running, the initial path is the path of the running, not the path of the php file. all the relative paths in it are calculated based on this initial path.

This file/usr/local/apache2/htdocs/test. php is not available.
Fatal error: Unknown: Failed opening required'/usr/local/apache2/htdocs/test. php '(include_path = '. :/usr/local/php/lib/php') in Unknown on line 0

It should be caused by relative paths. please change to absolute paths.

This file/usr/local/apache2/htdocs/test. php is not available.
Fatal error: Unknown: Failed opening required'/usr/local/apache2/htdocs/test. php '(include_path = '. :/usr/local/php/lib/php') in Unknown o ......

Hello, it seems that it is not caused by relative paths. Suppose I execute a file that does not exist, for example:
[Root @ localhost htdocs] #/usr/local/php/bin/php-f/usr/local/apache2/htdocs/test322323.php
Cocould not open input file:/usr/local/apache2/htdocs/test322323.php
The prompt is cocould not open input file. This indicates that the file is found.

Running path?
When the php command line is running, the initial path is the path of the running, not the path of the php file. all the relative paths in it are calculated based on this initial path.

Hi, I don't know much about it. can you explain it in detail. Thank you.

[Root @ localhost htdocs] #/usr/local/php/bin/php4-f/usr/local/apache2/htdocs/test. php
-Bash:/usr/local/php/bin/php4: the file or directory does not exist.

Similarly, I changed php to php4, prompting "no file or directory", indicating that php can also be found.

Linux does not understand, windows command line is like this

Assume that there is an include ../bbb. php statement in aaa. php.
C: \ abc> php d: \ xxx \ aaa. php
At this time, the program will look for c: \ bbb. php, and the error cannot be found, because bbb. php exists in the directory d: \.

Make full use of _ DIR _ and _ FILE __

What is the permission? All your errors are include. it must be a path problem.

Resolved. The reason is the same as that on the following webpage.
Http://www.cnblogs.com/zcy_soft/archive/2012/12/27/2835757.html

Solution:
It's a complicated problem. Fortunately, I don't know what to do. I don't study this ...... Pass
When I met, I was so depressed that google would be better in two or three days.

Resolved. The reason is the same as that on the following webpage.
Http://www.cnblogs.com/zcy_soft/archive/2012/12/27/2835757.html
This is the reason. In fact, I want to say that the landlord still hasn't explained the details of the problem. your problem is not the same as what we guess, and it is difficult to find the cause.

It turns out to be a php code problem.
But you didn't ask what the main program is.
Take it for granted.

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.