Linux execution php, with IE can be executed, but with the command will not, ask

Source: Internet
Author: User
The root user executes the command for/usr/local/php/bin/php-f/usr/local/apache2/htdocs/test.php
test.php permissions are:-rwxr-xr-x. 1 root root 22 April 15:04 test.php

The 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


Humbly consult, I first run PHP on Linux, one day, have not done well.


Reply to discussion (solution)

See if the file directory location is correct

Run path?
When the PHP command line runs, the initial path is the path where the path is running, not the PHP file, and all the relative paths inside are calculated from the initial path.

It is clear that there is no such file/usr/local/apache2/htdocs/test.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

Should be a relative path, please change to absolute path

It is clear that there is no such file/usr/local/apache2/htdocs/test.php.
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 a relative path caused, suppose I execute a file that does not, for example:
[Root@localhost htdocs]#/usr/local/php/bin/php-f/usr/local/apache2/htdocs/test322323.php
Could not open input file:/usr/local/apache2/htdocs/test322323.php
The hint is could not open input file. This means that the file was found.

Run path?
When the PHP command line runs, the initial path is the path where the path is running, not the PHP file, and all the relative paths inside are calculated from the initial path.

Hello, do not understand, can you explain it concretely. Thank you

[Root@localhost htdocs]#/usr/local/php/bin/php4-f/usr/local/apache2/htdocs/test.php
-bash:/usr/local/php/bin/php4: No file or directory

Similarly, I changed PHP to PhP4, suggesting that "there is no file or directory", which means that PHP can also be found

Linux does not understand, Windows command line is like this

Suppose Aaa.php has an include in it. /bbb.php
c:\abc>php d:\xxx\aaa.php
At this time, the program will look for c:\bbb.php, and error can not find, because bbb.php is present in D:\ of this directory

To make the best use of __dir__ and __file__

Authority, what's the matter? Your mistakes are all include, it's definitely a path problem.

has been resolved. The reason is consistent with the reasons on the following page.
Http://www.cnblogs.com/zcy_soft/archive/2012/12/27/2835757.html

Just solve it.
Really complicated problem, fortunately I have no ignorance, do not study this ... pass
And so on, and then depressed to Google two or three days good

has been resolved. The reason is consistent with the reasons on the following page.
Http://www.cnblogs.com/zcy_soft/archive/2012/12/27/2835757.html
This reason ah, actually want to say the landlord still did not put the details of the problem, your problem and we guess is not one thing, cause bad to find the reason.

Oh, it was PHP code problem
But none of you have asked the landlord what is the program content
Take it for granted, the piecemeal.

  • Related Article

    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.