PHP Installation Issues _php Basics

Source: Internet
Author: User
Tags anonymous install php ini mysql client mysql in pack php script phpinfo

Installation
This section describes the most common problems in the installation process. PHP applies to almost any OS (except perhaps MacOS before OS X), and almost any Web server.
To install PHP, follow the instructions in the release version of the installation files. Windows users should also read install.txt files. There are also some help documents here. 1. Unix/windows: Where should my php.ini be? 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 use RPMS to install PHP, but Apache does not support PHP page! What to do? 4. Unix: I use RPMS to install PHP 3, but it does not have the database compiler support I need! What am I going to do? 5. Unix: I patched the Apache with the FrontPage expansion pack, and suddenly PHP stopped working. is PHP and Apache FrontPage packages incompatible? 6. Unix/windows: I installed PHP, but in the browser to see my PHP page, a blank. 7. Unix/windows: I installed PHP, but I got a server error when I looked at my PHP page in the browser. 8. Some operating systems: I installed PHP without error, but when I started Apache, I got a undefined symbol errors: [MYBOX:USER/SRC/PHP4] root# apachectl configtest APACHEC TL:/usr/local/apache/bin/httpd Undefined symbols: _compress _uncompress9. Windows: I installed PHP, but looking at my php page in my browser, I got the following error: CGI error:the specified CGI application misbehaved by not returning a complete s Et of HTTP headers. The headers it did return are:10. Windows: I strictly follow install's requirements, but I still can't get my PHP to work under IIS.
1. Unix/windows: Where should my php.ini file be placed?
It should be placed in the/usr/local/lib directory by default under UNIX. This is the <install-path>/lib of it. Many people will change it at compile time, using the--WITH-CONFIG-FILE-PATH flag. For example, you can set it this way:--with-config-file-path=/etc then you can copy the php.ini-dist from the source package to/etc/php.ini and edit it to meet your localization needs.
Windows php.ini The default path is the Windows system directory. If you are using Apache webserver, php.ini is first found in the Apaches installation directory, for example: C:\Program Files\apache Group\apache. This way you can have different php.ini corresponding to different versions of Apache (on the same machine).
Please refer to 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 has a core-dumping error. Find 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 a great help to developers in solving this problem. If you are using PHP as an Apache module, follow these steps:

Stop httpd Process
GDB httpd
Stop httpd Process
> Run-x-f/path/to/httpd.conf
Browse the URL you just made a mistake
> Run-x-f/path/to/httpd.conf
If you still have core dump, GDB will notify you now
Enter: BT
You should include BackTrace in your bug. These are going to be sent to http://bugs.php.net/.

If your script uses regular expression functions (Ereg () and friends), you should make sure that you compile PHP and Apache with the same regular expression package. This process is done automatically in PHP and Apache 1.3.x.
3. Unix: I use RPMS to install PHP, but Apache does not support PHP page! What to do?
Suppose you installed Apache and PHP (from RPM), you need to annotate or add some lines in your http.conf file: # Extra Modulesaddmodule mod_php.caddmodule Mod_php3.caddmod Ule 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 m      Odules/libperl.soand add:addtype application/x-httpd-php3. php3/* for PHP 3 */addtype application/x-httpd-php. php * for PHP 4 */... Into the global domain, or to the virtual domain where you want to support PHP.
4. I use RPMS to install PHP 3, but it does not have the database option I need to support! What am I going to do?
Because of the PHP 3 built-in support relationship, compiling a complete PHP rpm for all applications is quite difficult. In PHP 4 There is talk about this. For PHP 3, we have to recommend that you use Install.redhat (in the PHP package) to describe the mechanism. If you are sure to use the RPM version of PHP 3, read ...
The RPM Package Manager sets RPMS simple installation with no database support and because RPMS uses/usr/instead of the standard/usr/local/directory to store files. You need to tell the RPM file which database you want to support and the location of their most superior directories.
The following example will explain how to support the prevailing database MySQL in Apache mode.
Of course, all of these can be slightly modified to support other PHP-supported databases. Let's assume that you have MySQL and Apache installed, completely with RPMS.

First, remove the 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/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: The--WITH-MYSQL=/USR \%build section looks like this:./configure--prefix=/usr \--with-apxs=/usr/sbin/apxs \--with-conf Ig-file-path=/usr/lib \--enable-debug=no \--enable-safe-mode \--with-exec-dir=/usr/bin \--WITH-MYSQL=/USR \--with-system-regex
After the change is complete, repeat the Rpm:rpm-bb/usr/src/redhat/specs/mod_php3.spec as follows
Then Install the rpm rpm-ivh/usr/src/redhat/rpms/i386/mod_php3-3.0.5-2.i386.rpm reboot Apache, you've got the support of MySQL under RPM. Note that this practice is more than you get a PHP 3 tarball code, according to INSTALL. It would be much easier to REDHAT the guidelines in a step-by-step way.

5. Unix: I patched the Apache with the FrontPage expansion pack, and suddenly PHP stopped working. is PHP and Apache FrontPage packages incompatible?
No, PHP and FrontPage expansion packs are running well. The problem is that the FrontPage package modifies several Apache structure parameters, which PHP uses. After the FrontPage expansion pack is hit, recompiling php (using ' Make-clean ') will solve the problem.
6. Unix/windows: I installed PHP, but in the browser to see my PHP page, a blank.
In the browser using ' view source ' to see your script, you may find that you are seeing the source program. This means that the Web server did not send scripts to PHP to execute. There must be something wrong with the server configuration. Carefully check the server configuration for the PHP installation.
7. Unix/windows: I installed PHP, but I got a server error when I looked at my PHP page in the browser.
This is an error when the server is running PHP. To see the readable error message, at the command line, change the directory to the directory (Php.exe Windows) and run php-i. If you have any questions, the detailed error message is displayed and it tells you what to do next. If you get the full screen of HTML code (phpinfo () function Output), then PHP works fine, this error is due to server configuration, should be carefully checked.
8. Some operating systems: I installed PHP without error, but when I started Apache, I got a undefined symbol errors: [MYBOX:USER/SRC/PHP4] root# apachectl configtest APACHEC TL:/usr/local/apache/bin/httpd Undefined symbols: _compress _uncompress
This problem is not related to PHP, but to the MySQL client library. --with-zlib, some operating systems are needed, and some are not needed. The MySQL FAQ already covers this issue.
9. Windows: I installed PHP, but in the browser to see my php page, get the following error: CGI error:the specified CGI application misbehaved by not returning a complet E Set of HTTP headers. The headers it did return are:
This is that PHP does not produce any output at all. To see the readable error message, at the command line, change the directory to the directory (Php.exe Windows) and run php-i. If you have any questions, the detailed error message is displayed and it tells you what to do next. If you get the full screen of HTML code (phpinfo () function Output), then PHP works fine.
Once PHP works in command-line mode and then looks at your script, it fails, probably because of the following reasons:

Permission for your PHP script. Php.exe, Php4ts.dll, php.ini, or any PHP file you might have installed, must be accessible to anonymous Internet users isur_<machinename>.
The script file does not exist (or is not where you think it is). Note that in IIS, you can block this error by selecting the ' Check file exists ' box when you set up the script mapping directory. This way, if the script does not exist, the server returns a 404 error. There are other benefits to doing this, which is that IIS is only authorized for you.
Windows: I did exactly what install wanted, but I still couldn't get my PHP to work under IIS.
Make sure any user who wants to run PHP has the right to operate Php.exe! IIS uses anonymous Internet users, which are automatically incremented when IIS is installed. This user needs to manipulate Php.exe permissions. Also, any user who requires authorization must have access to Php.exe permissions. Under IIS4, you have to tell it that PHP is a scripting engine.  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.