Install
This section will describe the most common problems during installation. PHP is suitable for almost any OS (perhaps except for MacOS before OSX), and almost any WEB server.
To install PHP, follow the instructions for installation files in the distribution. Windows users should also read the files. There are also some help documents here. 1. Unix/Windows: Where should I put mine? 2. Unix: I installed PHP, but every time I load a document, I get the following message: 'Document Contains No Data'! What's going on? 3. Unix: I installed PHP using RPMS, but Apache does not support PHP pages! What should I do? 4. Unix: I installed PHP 3 using RPMS, but it does not have the database compilation support I need! What should I do? 5. Unix: I patched Apache with the FrontPage extension package, and suddenly PHP stopped working. Is PHP and Apache FrontPage package incompatible? 6. Unix/Windows: I installed PHP, but when I looked at my PHP page in my browser, it was blank. 7. Unix/Windows: I installed PHP, but when I looked at my PHP page in the browser, I got a server 500 error. 8. Some operating systems: I did not get an error in installing PHP, but when I started Apache, I got an undefined symbol errors: [mybox:user /src/php4] root# apachectl configtest apachectl: /usr/local/apache/bin/httpd Undefined symbols: _compress _uncompress9. Windows: I installed PHP, but I looked at my PHP page in my browser and got the following error: cgi error: The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:10. Windows: I strictly follow the requirements of install, but I still can't let my php work under IIS.
1. Unix/Windows: Where should I put my files?
Under UNIX, it should be placed in the /usr/local/lib directory by default. Here is its <install-path>/lib. Many people will change it at compile time, using the --with-config-file-path flag. For example, you can set it like this: --with-config-file-path=/etc Then you can copy -dist from the source package to /etc/ and edit it to meet your localization needs.
The default path under Windows is the Windows system directory. If you are using Apache webserver, you will first be searched in the Apaches installation directory, for example: c:\program files\apache group\apache. This way you can have different versions of Apache (on the same machine).
For more details, please refer to the configuration file.
2. Unix: I installed PHP, but every time I load a document, I get the following message: 'Document Contains No Data'! What's going on?
This may be because a core-dumping error occurred in your PHP. Look for your server error log file to see if this is the case. Then report this error. If you know how to use 'gdb', you can provide a backtrace in your error report. This will be of great help to developers to solve this problem. If you are using PHP as an Apache module, please follow the steps below:
Stop the httpd process
gdb httpd
Stop the httpd process
> run -X -f /path/to/
View the URL you just made an error
> run -X -f /path/to/
If you have core dump, gdb will notify you now
Enter: bt
Backtrace should be included in your bug report. These will be sent to /
If your script uses regular expression functions (ereg() and friends), you should make sure that you use the same regular expression package for PHP and Apache. In PHP and Apache 1. This process is automatically performed.
3. Unix: I use RPMS to install PHP, but Apache does not support PHP pages! What should I do?
Suppose you have Apache and PHP installed (from RPM), you need to decomment or add some lines to your file: # Extra ModulesAddModule mod_php.cAddModule mod_php3.cAddModule mod_perl.c# Extra ModulesLoadModule php_module modules/mod_php.soLoadModule php3_module modules/ /* for PHP 3 */LoadModule php4_module modules/ /* for PHP 4 */LoadModule perl_module modules/ add: AddType application/x-httpd-php3 .php3 /* for PHP 3 */AddType application/x-httpd-php.php /* for PHP 4 */... Go to the global domain, or to the virtual domain that supports PHP.
4. I use RPMS to install PHP 3, but it does not have the database options I need to support! What should I do?
Because of the built-in support of PHP 3, it is quite difficult to compile a complete PHP RPM that can be suitable for all applications. There is something to talk about in PHP 4. For PHP 3, we have to recommend that you use the mechanism described (in the PHP package). If you must use RPM version of PHP 3, read...
RPM Package Manager sets up RPMS for simple installation without database support and because RPMS uses /usr/ instead of the standard /usr/local/ directory to store files. You need to tell the RPM files which databases you want to support and where their top directories are.
The following example will explain how to support passive database Mysql in Apache mode.
Of course all of these can be slightly modified to support other PHP-supported databases. Let's assume you have MySQL and Apache installed, which is completely installed with RPMS.
First, remove mod_php3: rpm -e mod_php3
Then get the rpm package and install it, not --recompile rpm -Uvh mod_php3-3.0.
Edit /usr/src/redhat/SPECS/mod_php3.spec file
In the %build section, add the database support you want, as well as path information.
For MySQL you should add: --with-mysql=/usr \%build section looks like: ./configure --prefix=/usr \ -with-apxs=/usr/sbin/apxs \ -with-config-file-path=/usr/lib \ -enable-debug=no \ -enable-safe-mode \ -with-exec-dir=/usr/bin \ -with-mysql=/usr \ -with-system-regex
After the changes are completed, re-compile rpm like below: rpm -bb /usr/src/redhat/SPECS/mod_php3.spec
Then install the rpm rpm -ivh /usr/src/redhat/RPMS/i386/mod_php3-3.0.5-2. Restart Apache, you have received support from Mysql under rpm. Note that this approach is much easier than if you regain a PHP 3 tarball code and follow the instructions step by step.
5. Unix: I patched Apache with the FrontPage extension package, and suddenly PHP stopped working. Is PHP and Apache FrontPage package incompatible?
No, the PHP and FrontPage extensions run very well. The problem is that the FrontPage package has modified several Apache structure parameters, and PHP needs to use them. After the FrontPage extension package is stamped, recompiling PHP (using 'make clean ; make') will solve this problem.
6. Unix/Windows: I installed PHP, but when I looked at my PHP page in my browser, it was blank.
In the browser, use 'View source files' to view your scripts, and you may find that you are seeing the source program. This means that the web server does not send the script to PHP for execution. There must be something wrong with the server configuration. Carefully check the server configuration of PHP installation.
7. Unix/Windows: I installed PHP, but when I look at my PHP page in my browser, I get a server 500 error.
This is an error occurred while the server is running PHP. In order to see readable error messages, on the command line, change the directory to the directory where (Windows) is located, and run php -i. If there are any problems, the detailed error messages will be displayed and it will tell you what to do next. If you get the full screen HTML code (output of the phpinfo() function), then PHP works fine, this error is caused by the server configuration and should be checked carefully.
8. Some operating systems: I did not make any errors in installing PHP, but when I started Apache, I got an undefined symbol errors: [mybox:user /src/php4] root# apachectl configtest apachectl: /usr/local/apache/bin/httpd Undefined symbols: _compress _uncompress
This problem is actually not related to PHP, but to the MySQL client library. --with-zlib, some operating systems require it, while others do not. MySQL FAQ has already talked about this issue.
9. Windows: I installed PHP, but when I look at my PHP page in my browser, I get the following error: cgi error: The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:
This is where PHP produces no output at all. In order to see readable error messages, on the command line, change the directory to the directory where (Windows) is located, and run php -i. If there are any problems, the detailed error messages will be displayed and it will tell you what to do next. If you get the full screen HTML code (output of the phpinfo() function), then PHP works fine.
Once PHP works in command line mode, look at your script program again, it still fails, possibly because of the following reasons:
Your PHP script permissions are licensed. , , or any PHP file you may load, it must be accessible by anonymous internet user ISUR_<machinename>.
The script file does not exist at all (or is not where you think it is.) Please note that in IIS, you can block this error by selecting the 'check file exists' box when setting the script mapping directory. In this way, if the script does not exist, the server will return a 404 error. There are other benefits to doing this, that is, IIS only does authorized operations for you.
10. Windows: I strictly follow the requirements of install, but I still can't let my php work under IIS.
Make sure that any user who wants to run PHP has permission to operate! IIS uses anonymous internet users, which is automatically added to the system when IIS is installed. This user requires permission to operate. Also, any user who needs authorization must also have access rights. Under IIS4, you want to tell it PHP is a scripting engine.