Hướng dẫn dùng install com trong PHP
This section holds common questions about the way to install PHP. PHP is available for almost any OS, and almost any web server. To install PHP, follow the instructions in Installation and Configuration.
PHP is glue. It is the glue used to build cool web applications by sticking dozens of 3rd-party libraries together and making it all appear as one coherent entity through an intuitive and easy to learn language interface. The flexibility and power of PHP relies on the stability and robustness of the underlying platform. It needs a working OS, a working web server and working 3rd-party libraries to glue together. When any of these stop working PHP needs ways to identify the problems and fix them quickly. When you make the underlying framework more complex by not having completely separate execution threads, completely separate memory segments and a strong sandbox for each request to play in, further weaknesses are introduced into PHP's system. If you want to use a threaded MPM, look at a FastCGI configuration where PHP is running in its own memory space. Unix/Windows: Where should my php.ini file be located? By default on Unix it should be in /usr/local/lib which is --with-config-file-path=/etcAnd then you would copy php.ini-development from the distribution to /etc/php.ini and edit it to make any local changes you want. --with-config-file-scan-dir=PATH On Windows the default path for the php.ini file is the Windows directory. If you're using the Apache webserver, php.ini is first searched in the Apaches install directory, e.g. c:\program files\apache group\apache. This way you can have different php.ini files for different versions of Apache on the same machine. See also the chapter about the configuration file. Unix: I installed PHP, but every time I load a document, I get the message 'Document Contains No Data'! What's going on here?This probably means that PHP is having some sort of problem and is core-dumping. Look in your server error log to see if this is the case, and then try to reproduce the problem with a small test case. If you know how to use 'gdb', it is very helpful when you can provide a backtrace with your bug report to help the developers pinpoint the problem. If you are using PHP as an Apache module try something like:
If your script uses the regular expression functions (preg_match() and friends), you should make sure that you compiled PHP and Apache with the same regular expression package. This should happen automatically with PHP and Apache 1.3.x Unix: I installed PHP using RPMS, but Apache isn't processing the PHP pages! What's going on here?Assuming you installed both Apache and PHP from RPM packages, you need to uncomment or add some or all of the following lines in your httpd.conf file: # Extra Modules AddModule mod_php.c AddModule mod_perl.c # Extra Modules LoadModule php_module modules/mod_php.so LoadModule php5_module modules/libphp5.so LoadModule perl_module modules/libperl.soAnd add: AddType application/x-httpd-php .php... to the global properties, or to the properties of the VirtualDomain you want to have PHP support added to. Unix: I patched Apache with the FrontPage extensions patch, and suddenly PHP stopped working. Is PHP incompatible with the Apache FrontPage extensions? No, PHP works fine with the FrontPage extensions. The problem is that the FrontPage patch modifies several Apache structures, that PHP relies on. Recompiling PHP (using 'make clean ; make') after the FP patch is applied would solve the problem. Unix/Windows: I have installed PHP, but when I try to access a PHP script file via my browser, I get a blank screen.Do a 'view source' in the web browser and you will probably find that you can see the source code of your PHP script. This means that the web server did not send the script to PHP for interpretation. Something is wrong with the server configuration - double check the server configuration against the PHP installation instructions. Unix/Windows: I have installed PHP, but when try to access a PHP script file via my browser, I get a server 500 error.Something went wrong when the server tried to run PHP. To get to see a sensible error message, from the command line, change to the directory containing the PHP executable (php.exe on Windows) and run php -i. If PHP has any problems running, then a suitable error message will be displayed which will give you a clue as to what needs to be done next. If you get a screen full of HTML codes (the output of the phpinfo() function) then PHP is working, and your problem may be related to your server configuration which you should double check. Some operating systems: I have installed PHP without errors, but when I try to start Apache I get undefined symbol errors:[mybox:user /src/php5] root# apachectl configtest apachectl: /usr/local/apache/bin/httpd Undefined symbols: _compress _uncompress This has actually nothing to do with PHP, but with the MySQL client libraries. Some need --with-zlib, others do not. This is also covered in the MySQL FAQ. Windows: I have installed PHP, but when I try to access a PHP script file via my browser, I get the error:cgi error: The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are: This error message means that PHP failed to output anything at all. To get to see a sensible error message, from the command line, change to the directory containing the PHP executable (php.exe on Windows) and run php -i. If PHP has any problems running, then a suitable error message will be displayed which will give you a clue as to what needs to be done next. If you get a screen full of HTML codes (the output of the phpinfo() function) then PHP is working. Once PHP is working at the command line, try accessing the script via the browser again. If it still fails then it could be one of the following:
Make sure any user who needs to run a PHP script has the rights to run php.exe! IIS uses an anonymous user which is added at the time IIS is installed. This user needs rights to php.exe. Also, any authenticated user will also need rights to execute php.exe. And for IIS4 you need to tell it that PHP is a script engine. Also, you will want to read this faq. When running PHP as CGI with IIS, PWS, OmniHTTPD or Xitami, I get the following error:Security Alert! PHP CGI
cannot be accessed directly. . You must set the cgi.force_redirect directive to Because the default is To be sure your php.ini is being read by PHP, make a call to
phpinfo(). Near the top, there will be a listing called If php.ini is being read and you're running PHP as a module, then be sure to restart your web server after making changes to php.ini See also php_ini_loaded_file(). How do I add my PHP directory to the PATH on Windows?On Windows:
How do I make the php.ini file available to PHP on windows? There are several ways of doing this. If you are using Apache, refer to the Apache documentation, otherwise you must set the PHPRC environment variable. Is it possible to use Apache content negotiation (MultiViews option) with PHP? If links to PHP files include extension, everything works perfect. This FAQ is only for the case when links to PHP files don't include extension and you want to use content negotiation to choose PHP files from URL with no extension. In this case, replace the line AddHandler php5-script php AddType text/html phpThis solution doesn't work for Apache 1 as PHP module doesn't catch php-script .
Is PHP limited to process GET and POST request methods only? No, it is possible to handle any request method, e.g. CONNECT. Proper response status can be sent with header(). If only GET and POST methods should be handled, it can be achieved with this Apache configuration:
per dot fikse at ipj dot no ¶ 17 years ago
emzeperx at emzeper dot hu ¶ 16 years ago
jimo at mail dot azhsv dot com ¶ 18 years ago
nigel dot salt at hotmail dot com ¶ 18 years ago
ssaxena at nriol dot com ¶ 12 years ago
john dot calder at manukau dot ac dot nz ¶ 14 years ago
charleslynch at xybersoftware dot com ¶ 14 years ago
JUSTANOTHERUSER ¶ 17 years ago
knutw at sparhell dot no ¶ 15 years ago
scott at chaisson dot net ¶ 14 years ago
Meiki67 skipthis at geemail ¶ 15 years ago
jeff_graham at datacenterservices dot net ¶ 18 years ago
Curtis ¶ 15 years ago
peter dot mosinskisNOSPAM at csuci dot edu ¶ 19 years ago
christianfelix at laszlo dot com ¶ 15 years ago
monroe at peoplego dot com ¶ 20 years ago
joerg at fenin dot de ¶ 14 years ago
Anonymous ¶ 15 years ago
barry dot fagin at usafa dot af dot mil ¶ 17 years ago
|