PHP content-type=text/html problem
Author:Eve Cole
Update Time:2009-06-02 18:06:56
The following text was written because I saw a lot of such questions on the forum recently. Please give me your advice! ! ! There are already answers on how to remove some redundant information of PHP4 in the FAQ of this site, but strictly speaking, this information is divided into two parts: one part is the message indicating that PHP is running, which is those X-POWERED-BY and the like ; Another part declares the default content format of the file text/HTML. The answers in the FAQ solve the first part of the problem (as long as you add a comment in the relevant line), but the forum is more about the latter part, and I would like to discuss this issue. The first thing to state is that this situation is likely to occur when PHP is running in CGI mode, so I guess it is mostly an error on the WIN32 platform. First of all, one of the most extreme solutions is to comment out all extension modules, that is, declare in PHP.ini that those extension modules related to databases, graphics, MAIL, etc. are not to be loaded. Some PHP.ini files are similar to the following form:
;Windows Extensions
;extension=PHP_mysql.dll
;extension=PHP_nsmail.dll
;extension=PHP_calendar.dll
;extension=PHP_dbase.dll
;extension=PHP_filepro.dll
;extension=PHP_gd.dll
;extension=PHP_dbm.dll
;extension=PHP_mssql.dll
;extension=PHP_zlib.dll
;extension=PHP_filepro.dll
;extension=PHP_imap4r2.dll
;extension=PHP_ldap.dll
;extension=PHP_crypt.dll
;extension=PHP_msql2.dll
;extension=PHP_odbc.dll
So what if these modules are needed? Brother, my solution is to dynamically load the corresponding page, that is, dl() - before, I was wondering what the use of this function is, but now, haha. . . If you have any good ideas, you can post them and share them with everyone! The second solution is to use PHP's -q parameter. According to PHP itself, it is "Suppress HTTP Header Output", which means that HTTP header output is prohibited. This will solve the problem once and for all, but any of your header() and setcookie() will be useless - hehe, your PHP will basically be scrapped. So, this is just a dirty approach. Okay, that’s all, it should be able to solve the above problems of PHP running in CGI mode. The above information is combined with the PHP part of www.faqts.com - that place is the top forum for asking questions. PHP/ZEND writers and authors of some PHP books often answer your questions. How great! ! ! Your advice is welcome!