📄 faq.installation.html
字号:
</dl> <dl> <dt><strong> <p class="para"> Some operating systems: I have installed PHP without errors, but when I try to start apache I get undefined symbol errors: <div class="example-contents"><div class="cdata"><pre>[mybox:user /src/php4] root# apachectl configtest apachectl: /usr/local/apache/bin/httpd Undefined symbols: _compress _uncompress </pre></div></div> </p> </strong></dt> <dd><a name="faq.installation.undefinedsyms"></a> <p class="para"> This has actually nothing to do with PHP, but with the MySQL client libraries. Some need <span class="option">--with-zlib</span>, others do not. This is also covered in the MySQL FAQ. </p> </dd> </dl> <dl> <dt><strong> <p class="para"> Windows: I have installed PHP, but when I to access a PHP script file via my browser, I get the error: <div class="example-contents"><pre>cgi error: The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are: </pre></div> </p> </strong></dt> <dd><a name="faq.installation.cgierror"></a> <p class="para"> 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 (<var class="filename">php.exe</var> on Windows) and run <strong class="command">php -i</strong>. 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 <a href="function.phpinfo.html" class="function">phpinfo()</a> function) then PHP is working. </p> <p class="para"> 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: </p> <ul class="itemizedlist"> <li class="listitem"> <span class="simpara"> File permissions on your PHP script, <var class="filename">php.exe</var>, <var class="filename">php4ts.dll</var>, <var class="filename">php.ini</var> or any PHP extensions you are trying to load are such that the anonymous internet user <i>ISUR_<machinename></i> cannot access them. </span> </li> <li class="listitem"> <span class="simpara"> The script file does not exist (or possibly isn't where you think it is relative to your web root directory). Note that for IIS you can trap this error by ticking the 'check file exists' box when setting up the script mappings in the Internet Services Manager. If a script file does not exist then the server will return a 404 error instead. There is also the additional benefit that IIS will do any authentication required for you based on the NTLanMan permissions on your script file. </span> </li> </ul> </dd> </dl> <dl> <dt><strong> <p class="para"> Windows: I've followed all the instructions, but still can't get PHP and IIS to work together! </p> </strong></dt> <dd><a name="faq.installation.phpandiis"></a> <p class="para"> Make sure any user who needs to run a PHP script has the rights to run <var class="filename">php.exe</var>! IIS uses an anonymous user which is added at the time IIS is installed. This user needs rights to <var class="filename">php.exe</var>. Also, any authenticated user will also need rights to execute <var class="filename">php.exe</var>. And for IIS4 you need to tell it that PHP is a script engine. Also, you will want to read <a href="faq.installation.html#faq.installation.forceredirect" class="link">this faq</a>. </p> </dd> </dl> <dl> <dt><strong> <p class="para"> When running PHP as CGI with IIS, PWS, OmniHTTPD or Xitami, I get the following error: <i>Security Alert! PHP CGI cannot be accessed directly.</i>. </p> </strong></dt> <dd><a name="faq.installation.forceredirect"></a> <p class="para"> You must set the <a href="ini.core.html#ini.cgi.force-redirect" class="link"> cgi.force_redirect</a> directive to <i>0</i>. It defaults to <i>1</i> so be sure the directive isn't commented out (with a <i>;</i>). Like all directives, this is set in <var class="filename">php.ini</var> </p> <p class="para"> Because the default is <i>1</i>, it's critical that you're 100% sure that the correct <var class="filename">php.ini</var> file is being read. Read <a href="faq.installation.html#faq.installation.findphpini" class="link">this faq</a> for details. </p> </dd> </dl> <dl> <dt><strong> <p class="para"> How do I know if my <var class="filename">php.ini</var> is being found and read? It seems like it isn't as my changes aren't being implemented. </p> </strong></dt> <dd><a name="faq.installation.findphpini"></a> <p class="para"> To be sure your <var class="filename">php.ini</var> is being read by PHP, make a call to <a href="function.phpinfo.html" class="function">phpinfo()</a>. Near the top, there will be a listing called <i>Configuration File (php.ini)</i>. This will tell you where PHP is looking for <var class="filename">php.ini</var> and whether or not it's being read. If just a directory PATH exists, then it's not being read, and you should put your <var class="filename">php.ini</var> in that directory. If <var class="filename">php.ini</var> is included within the PATH, it is being read. </p> <p class="para"> If <var class="filename">php.ini</var> is being read and you're running PHP as a module, then be sure to restart your web server after making changes to <var class="filename">php.ini</var> </p> <p class="para"> See also <a href="function.php-ini-loaded-file.html" class="function">php_ini_loaded_file()</a>. </p> </dd> </dl> <dl> <dt><strong> <p class="para"> How do I add my PHP directory to the <var class="varname">PATH</var> on Windows? </p> </strong></dt> <dd><a name="faq.installation.addtopath"></a> <p class="para"> On Windows NT, 2000, XP and 2003: <ul class="itemizedlist"> <li class="listitem"><p class="para"> Go to Control Panel and open the System icon (Start -> Settings -> Control Panel -> System, or just Start -> Control Panel -> System for Windows XP/2003) </p></li> <li class="listitem"><p class="para"> Go to the Advanced tab </p></li> <li class="listitem"><p class="para"> Click on the 'Environment Variables' button </p></li> <li class="listitem"><p class="para"> Look into the 'System Variables' pane </p></li> <li class="listitem"><p class="para"> Find the Path entry (you may need to scroll to find it) </p></li> <li class="listitem"><p class="para"> Double click on the Path entry </p></li> <li class="listitem"><p class="para"> Enter your PHP directory at the end, including ';' before (e.g. <i>;C:\php</i>) </p></li> <li class="listitem"><p class="para"> Press OK and restart your computer </p></li> </ul> </p> <p class="para"> On Windows 98/Me you need to edit the <var class="filename">autoexec.bat</var> file: <ul class="itemizedlist"> <li class="listitem"><p class="para"> Open the Notepad (Start -> Run and enter notepad) </p></li> <li class="listitem"><p class="para"> Open the <var class="filename">C:\autoexec.bat</var> file </p></li> <li class="listitem"><p class="para"> Locate the line with PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;..... and add: <i>;C:\php</i> to the end of the line </p></li> <li class="listitem"><p class="para"> Save the file and restart your computer </p></li> </ul> </p> <blockquote><p><b class="note">Note</b>: <span class="simpara"> Be sure to reboot after following the steps above to ensure that the <var class="varname">PATH</var> changes are applied. </span> </p></blockquote> <p class="para"> The PHP manual used to promote the copying of files into the Windows system directory, this is because this directory (<var class="filename">C:\Windows</var>, <var class="filename">C:\WINNT</var>, etc.) is by default in the systems PATH. Copying files into the Windows system directory has long since been deprecated and may cause problems. </p> </dd> </dl> <dl> <dt><strong> <p class="para"> How do I make the <var class="filename">php.ini</var> file available to PHP on windows? </p> </strong></dt> <dd><a name="faq.installation.phprc"></a> <p class="para"> There are several ways of doing this. If you are using Apache, read their installation specific instructions (<a href="install.windows.apache1.html" class="link">Apache 1</a>, <a href="install.windows.apache2.html" class="link">Apache 2</a>), otherwise you must set the <var class="varname">PHPRC</var> environment variable: </p> <p class="para"> On Windows NT, 2000, XP and 2003: <ul class="itemizedlist"> <li class="listitem"><p class="para"> Go to Control Panel and open the System icon (Start -> Settings -> Control Panel -> System, or just Start -> Control Panel -> System for Windows XP/2003) </p></li> <li class="listitem"><p class="para"> Go to the Advanced tab </p></li> <li class="listitem"><p class="para"> Click on the 'Environment Variables' button </p></li> <li class="listitem"><p class="para"> Look into the 'System variables' pane </p></li> <li class="listitem"><p class="para"> Click on 'New' and enter 'PHPRC' as the variable name and the directory where <var class="filename">php.ini</var> is located as the variable value (e.g. <i>C:\php</i>) </p></li> <li class="listitem"><p class="para"> Press OK and restart your computer </p></li> </ul> </p> <p class="para"> On Windows 98/Me you need to edit the <var class="filename">autoexec.bat</var> file: <ul class="itemizedlist"> <li class="listitem"><p class="para"> Open the Notepad (Start -> Run and enter notepad) </p></li> <li class="listitem"><p class="para"> Open the <var class="filename">C:\autoexec.bat</var> file </p></li> <li class="listitem"><p class="para"> Add a new line to the end of the file: <i>set PHPRC=C:\php</i> (replace <i>C:\php</i> with the directory where <var class="filename">php.ini</var> is located). Please note that the path cannot contain spaces. For instance, if you have installed PHP in <var class="filename">C:\Program Files\PHP</var>, you would enter <var class="filename">C:\PROGRA~1\PHP</var> instead. </p></li> <li class="listitem"><p class="para"> Save the file and restart your computer </p></li> </ul> </p> </dd> </dl> <dl> <dt><strong> <p class="para"> Is it possible to use Apache content negotiation (MultiViews option) with PHP? </p> </strong></dt> <dd><a name="faq.installation.apache.multiviews"></a> <p class="para"> 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 <i>AddType application/x-httpd-php .php</i> with: <div class="example-contents"><div class="cdata"><pre># PHP 4AddHandler php-script phpAddType text/html php# PHP 5AddHandler php5-script phpAddType text/html php</pre></div> </div> This solution doesn't work for Apache 1 as PHP module doesn't catch <i>php-script</i>. </p> </dd> </dl> <dl> <dt><strong> <p class="para"> Is PHP limited to process GET and POST request methods only? </p> </strong></dt> <dd><a name="faq.installation.requestmethods"></a> <p class="para"> No, it is possible to handle any request method, e.g. CONNECT. Proper response status can be sent with <a href="function.header.html" class="function">header()</a>. If only GET and POST methods should be handled, it can be achieved with this Apache configuration: <div class="example-contents"><div class="cdata"><pre><LimitExcept GET POST>Deny from all</LimitExcept></pre></div> </div> </p> </dd> </dl> </div> </div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="faq.databases.html">Database issues</a></div> <div class="next" style="text-align: right; float: right;"><a href="faq.build.html">Build Problems</a></div> <div class="up"><a href="faq.html">FAQ</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -