Fix a PHP configuration fault

Source: Internet
Author: User

Fault symptom:

In Windows Server 2003 + iis6.0 environment, the previously configured php5.0.4 can work normally. However, on the same machine, the exec () function cannot be correctly executed in IIS for codes running normally under apache2.2.8 + php5.2.5. For example, for the exec ('cd', $ arr, $ RET) Statement, the execution result of the $ arr array should be the Windows path where the PHP file containing the statement is implemented, the result is the "C:/Windows" folder. Other external EXE programs cannot be correctly executed.

Diagnosis:

In the IIS configuration, the ISAPI extension is enabled.
Windows/system32/cmd.exe has been added with IUSR _... Account permissions.
The external exe program to be executed has been copied to the Windows/system32 folder, and IUSR _... Account permissions.
The folder where the website is located, which has been assigned to IUSR _... Account permissions.

It is suspected that the PHP version is too low or the permission is insufficient.

(1) upgrade php5.0.4 to 5.2.5.
The global PATH variable configuration in Windows points to the php5.2.5 folder. Copy the php. ini file of php5.2.5 to the Windows folder. The. php ing of the website directs to php5isapi. dll in the php5.2.5 folder. After IIS is restarted, open the website. A prompt box is displayed, prompting you to enter the user name and password. after entering the Administrator account and password for Windows, you still cannot open the website.
Add the read and execute permissions of the user account to the folder where the website is located. After this operation is performed, the account and password request dialog box is no longer displayed. You can open the website's lower-level page (this step is crucial ). However, the Homepage cannot be opened because the database connection is called on the homepage. The PHP page for testing the exec () function is displayed, and the result is still incorrect.
At this time, it is suspected that the php5.0.4 file that has already worked conflicts with 5.2.5. Sure enough, all the. DLL files in the original 5.0.4, including the. DLL files in the php5.0.4 folder and php5.0.4/EXT, are copied here in the Windows/system32 folder! (Note: This is not a must. It is done by following the instructions of some "tutorials. However, since it has been copied here, it may already work .) As a result, the IIS and Apache services are closed, and all the DLL files in php5.2.5 are copied here ). Restart the machine-start the machine because Windows re-loads the latest. dll file. In this case, PHP is upgraded to version 5.2.5.

After the machine is started, the error "no input file specified" is reported. It seems that there is a door. Because the error message has changed, the preceding configuration is in effect. Search for the cause of the error message on the Internet, and prompt "no input file specified" message appears in iis isapi mode. You only need to set doc_root =… in PHP. ini ...... Comment it out. "As prompted, in PHP. ini, doc_root = ...... Add a semicolon before the statement, comment out the statement, and then restart IIS. All done!

Note: doc_root = ...... The statement is usually "doc_root =" in PHP. ini, that is, the value is null. However, because my PHP. ini file is copied from the PHP folder that works with Apache, Apache may assign a value when installing Apache. In fact, the effect of setting this value to null should be the same as that of the comment. This is not the key, but an episode.

Conclusion:

The problem is solved. However, it cannot be determined that the user account permission is added to the folder where the website is located, or the problem is solved by upgrading PHP. In short, it must have been solved by one of the above two operations, but it cannot be determined which one is? It should not be because two operations work at the same time. I don't think so. There is no reason.

Another benefit is that many problems in windows are caused by permission configuration. Therefore, we recommend that you do not add or remove folder permissions to external system administrators, as a result, the security of the system is reduced and unexpected faults occur. Note that the configuration system should also keep a record and test the impact of the configuration result on the system in a timely manner. Do not find out which configuration is caused by a system exception someday.

Zhang Qing (mesh)
From mesh horizon: http://blog.why100000.com
Why 100,000 computer learning networks: http://www.why100000.com

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.