Installation
This section will describe the most common problems during the installation process. PHP is suitable for almost any OS (except perhaps MacOS before OSX), and almost any WEB server.
To install PHP, follow the instructions in the installation file included with your distribution. Windows users should also read the install.txt file. There is also some help documentation here. 1. Unix/Windows: Where should I put my php.ini? 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 used RPMS to install PHP, but Apache does not support PHP pages! What should I do? 4. Unix: I used RPMS to install PHP 3, but it does not have the database compilation support I need! What should I do? 5. Unix: I patched Apache with the FrontPage extension pack, and suddenly PHP stopped working. Is PHP and Apache FrontPage packages incompatible? 6. Unix/Windows: I installed PHP, but when I view my PHP page in the browser, it is blank. 7. Unix/Windows: I installed PHP, but when I viewed my PHP page in the browser, I got a server 500 error. 8. Some operating systems: I installed PHP without error, 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 when I look at my PHP page in the 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:10. Windows: I strictly followed the install requirements, but I still can't get my php to work under IIS.
1. Unix/Windows: Where should my php.ini file be placed?
By default under UNIX it should be placed in the /usr/local/lib directory. This is its
The default path of php.ini under Windows is the Windows system directory. If you are using Apache webserver, php.ini will first be found in the Apache installation directory, for example: c:program filesapache groupapache. This way you can have different The php.ini corresponds to different versions of Apache (on the same machine).
Please refer to the configuration file for more details.
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 your PHP is experiencing a core-dumping error. Check your server error log files to see if this is the case. Then report the 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 in solving this problem. If you are using PHP as an Apache module, please follow the steps below:
Stop the httpd process
gdb httpd
Stop httpd process
> run -X -f /path/to/httpd.conf
Browse the URL you just made an error with
> run -X -f /path/to/httpd.conf
If you still have core dump, gdb will now notify you
Type: bt
Backtrace should be included in your bug report. These will be sent to http://bugs.php.net/
If your script uses regular expression functions (ereg() and friends), you should make sure you compile PHP and Apache using The same regular expression package. In PHP and Apache 1.3.x this process is automated.
3. Unix: I used RPMS to install PHP, but Apache does not support PHP pages! What should I do?
Assuming you installed Apache and PHP (from RPM), you need to uncomment or add some lines in your http In the .conf file:
# Extra ModulesAddModule mod_php.cAddModule mod_php3.cAddModule mod_perl.c# Extra ModulesLoadModule php_module modules/mod_php.soLoadModule php3_module modules/libphp3.so /* for PHP 3 */LoadModule php4_module modules/libphp4.so /* for PHP 4 */LoadModule perl_module modules /libperl.soAnd add:
AddType application/x-httpd-php3 .php3 /* for PHP 3 */AddType application/x-httpd-php .php /* for PHP 4 */... to the global domain, or to the PHP you want to support in the virtual domain.
4. I used RPMS to install PHP 3, but it does not support the database options I need! What should I do?
Because of the built-in support of PHP 3, compile a complete PHP that is suitable for all applications RPM is quite difficult. This is discussed in PHP 4. For PHP 3, we can only recommend that you use the mechanism described by INSTALL.REDHAT (in the PHP package).If you must use the RPM version of PHP 3, read...
RPM Package Manager Setup RPMS Simple installation, without database support and because RPMS uses /usr/ instead of the standard /usr/local/ directory storage File. You need to tell the RPM file which databases you want to support and the location of their top-level directory.
The following example will explain how to support the popular database Mysql in Apache mode.
Of course all of these can be slightly modified to support other PHP supported databases. We assume that you have MySQL and Apache installed entirely using 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.5-2.src.rpm
Edit the /usr/src/redhat/SPECS/mod_php3.spec file
Add the database support and path information you want in the %build section.
For MySQL you should add:
--with-mysql=/usr The %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, reprogram the rpm as follows:
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.i386.rpm Restart Apache, you have got support for Mysql under rpm. Note that this approach is much easier than re-obtaining a PHP 3 tarball code and following the step-by-step instructions of INSTALL.REDHAT.
5. Unix: I patched Apache with the FrontPage extension pack, and suddenly PHP stopped working. Are PHP and Apache FrontPage packages incompatible?
No, PHP and FrontPage extension packages work just fine. The problem is that the FrontPage package modifies several Apache structural parameters, and PHP uses them. After the FrontPage extension package is added, recompiling PHP (using 'make clean; make') will solve this problem.
6. Unix/Windows: I installed PHP, but when I view my PHP page in the browser, it is blank.
Use 'View Source' to view your script in the browser, you may find that what you see is 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. Double check the server configuration of your PHP installation.
7. Unix/Windows: I installed PHP, but when viewing my PHP page in the browser, I got a server 500 error.
This is a server error when running PHP. To see readable error messages, on the command line, change directories to the directory where php.exe (Windows) is located and run php -i. If there are any problems, detailed error messages will be displayed and it will tell you what to do next. What to do. If you get a screen full of HTML code (the output of the phpinfo() function), then PHP is working fine and the error is caused by the server configuration and should be checked carefully.
8. Some operating systems: I installed PHP without errors, 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 actually has nothing to do with PHP, but with the MySQL client library. --with-zlib, some operating systems require it, but some don't. The MySQL FAQ already covers this issue.
9. Windows: I installed PHP, but when I look at my PHP page in the 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 PHP producing no output at all. To see readable error messages, on the command line, change directories to the directory where php.exe (Windows) is located and run php -i. If there are any problems, detailed error messages will be displayed and it will tell you what to do next. What to do. If you get a screen full of HTML code (the output of the phpinfo() function), then PHP is working fine.
Once PHP is working in command line mode, take a look at your script. It still fails, probably because of the following reasons:
Permissions for your PHP script. php.exe, php4ts.dll, php.ini or any PHP file you may load must be accessible to the anonymous internet user ISUR_
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 checking the 'check file exists' box when setting up the script mapping directory. In this way, if the script does not exist, the server will return a 404 error. Doing this also has other benefits, that is, IIS only performs authorized operations for you.
10. Windows: I strictly followed the install requirements, but I still can’t get my php to work under IIS.
Make sure that any user who wants to run PHP has the permission to operate php.exe! IIS uses anonymous internet users, which are automatically added by the system when IIS is installed. This user needs permission to operate php.exe. Additionally, any user requiring authorization must also have permission to access php.exe.Under IIS4, you have to tell it that PHP is a script engine.