Javascript debugger
Website design
↑
This section holds common questions about the way to install PHP. PHP is available for almost any OS (except maybe for MacOS before OSX), and almost any web server.
To install PHP, follow the instructions in Part II, “Installation and Configuration”.
5.1. | Why shouldn't I use Apache2 with a threaded MPM in a production environment? |
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, feet of clay are introduced into PHP's system. If you feel you have to use a threaded MPM, look at a FastCGI configuration where PHP is running in its own memory space. And finally, this warning against using a threaded MPM is not as strong for Windows systems because most libraries on that platform tend to be threadsafe. | |
5.2. |
Unix/Windows: Where should my |
By default on Unix it should be in --with-config-file-path=/etc
And then you would copy --with-config-file-scan-dir=PATH
On Windows the default path for the See also the chapter about the configuration file. | |
5.3. | 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 (ereg() 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 | |
5.4. | 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 # Extra Modules And add: AddType application/x-httpd-php3 .php3 # for PHP 3 ... to the global properties, or to the properties of the VirtualDomain you want to have PHP support added to. | |
5.5. | Unix: I installed PHP 3 using RPMS, but it doesn't compile with the database support I need! What's going on here? |
Due to the way PHP 3 built, it is not easy to build a complete flexible PHP RPM. This issue is addressed in PHP 4. For PHP 3, we currently suggest you use the mechanism described in the INSTALL.REDHAT file in the PHP distribution. If you insist on using an RPM version of PHP 3, read on... The RPM packagers are setting up the RPMS to install without database support to simplify installations and because RPMS use /usr/ instead of the standard /usr/local/ directory for files. You need to tell the RPM spec file which databases to support and the location of the top-level of your database server. This example will explain the process of adding support for the popular MySQL database server, using the mod installation for Apache. Of course all of this information can be adjusted for any database server that PHP supports. We will assume you installed MySQL and Apache completely with RPMS for this example as well.
Make sure you restart Apache, and you now have PHP 3 with MySQL support
using RPM's. Note that it is probably much easier to just build
from the distribution tarball of PHP 3 and follow the instructions in
| |
5.6. | 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. | |
5.7. | 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. | |
5.8. | 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
( | |
5.9. | Some operating systems: I have installed PHP without errors, but when I try to start apache I get undefined symbol errors: [mybox:user /src/php4] root# apachectl configtest |
This has actually nothing to do with PHP, but with the MySQL
client libraries. Some need | |
5.10. | Windows: I have installed PHP, but when I to access a PHP script file via my browser, I get the error: cgi error: |
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 ( 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:
| |
5.11. | Windows: I've followed all the instructions, but still can't get PHP and IIS to work together! |
Make sure any user who needs to run a PHP script has the rights
to run | |
5.12. |
When running PHP as CGI with IIS, PWS, OmniHTTPD or Xitami,
I get the following error: |
You must set the
cgi.force_redirect directive to
Because the default is | |
5.13. |
How do I know if my |
To be sure your
If | |
5.14. |
How do I add my PHP directory to the |
On Windows NT, 2000, XP and 2003:
On Windows 98/Me you need to edit the
Note:
Be sure to reboot after following the steps above to ensure that the
The PHP manual used to promote the copying of files into the Windows
system directory, this is because this directory
( | |
5.15. |
How do I make the |
There are several ways of doing this. If you are using Apache, read
their installation specific instructions (Apache 1, Apache 2), otherwise you must
set the On Windows NT, 2000, XP and 2003:
On Windows 98/Me you need to edit the
| |
5.16. | 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 # PHP 4
This solution doesn't work for Apache 1 as PHP module doesn't catch
| |
5.17. | 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: <LimitExcept GET POST> |