Many people are proficient in learning computer. However, you still meet many problems of PHP in practice. As follows, there are 10 FAQ and Answers of PHP. Much hope they can help you.
1. Why is "APACHE. EXE: cannot determine the local host name."?
A: Because the Apache of the Windows version does not specify a ServerName by default, an error occurs in running. The solution is to modify the 'httpd.conf:' in the conf directory under the Apache installation. First, you can search for ServerName and then remove the prefix #. Change the value after ServerName to your own Settings. Like localhost.
2. On Windows NT/9x, why does "Can't connect to MySQL server on 'localhost' <10061>" appear?
A: MySQL, although small, is different from a normal file database. It's an application server. So before using a client program such as MySQL, you must start the MySQL server. The way is to run mysqld.exe or mysqld-shareware.exe under the bin directory of MySQL. Run whichever file has a problem.
3. Why does the original program appear Notice or Undefined variable with full screen after the upgrade of PHP?
A: This is a warning because the variable is undefined. For cases where Parse Error appears error, and error_reporting(0) cannot be turned off. You can open php.ini and find error_reporting at the bottom. Change to error_reporting = E_ALL & ~E_NOTICE. If you want to turn off any error messages. Just open php.ini and find display_errors. Set display_errors = Off, and no further errors will be prompted.
4. Why does the SESSION function of PHP4 always report path errors in WINDOWS?
A: This may be a BUG in PHP4.0. Hope it will be solved thoroughly in later version. For now, the solution is to set the path that saves sessions to the current path (only in this way, no errors are reported). The method is to modify php.ini to set the value of ession. Save_path to./.
5.Using Apache, how to deal with the messy code on the home page?
A: One is to change AddDefaultCharset ISO-8859-1 to AddDefaultCharset off.
6. How to install MYSQL as an automatic service under WIN2K?
A: MYSQL can easily be installed as an auto-start service on WINDOWS NT 4. But things go wrong sometimes in WINDOWS 2000. After a search, the problem was finally discovered. When you install mysqld-shareware --install, you will add an item to the WINDOWS service. But the execution file for this is mysqld.exe, not mysqld-shareware.exe. So the solution is to copy mysqld-shareware.exe to mysqld.exe. Restart WINDOWS 2000 and everything is OK.
7. How do you keep the program running instead of stopping after 30 seconds?
A: set_time_limit (60)// Maximum running time of one minute.
set_time_limit (0)// Run until the program ends itself, or stop manually.
8. How to contact MySQL database remotely?
A: There is a host field in the table of mysql for adding users, which is changed to '%'. Or specify the IP address that allows the connection. Then it can be called remotely.
9. Cannot pass variables between pages?
A: Get, Post, and Session are automatically closed in the latest version of PHP. So you need to get the submitted variables from the previous page. To use the $_GET ['foo'], $_POST ['foo'], $_SESSION ['foo'] to get. You can also change the automatic global variable to open (php.ini to register_globals = On). To consider the compatibility, it is better to force individuals to familiarize themselves with the new notation.
10. Win32 Mail can't send e-mails, what should I do?
A: PHP's best solution for sending email is to use a socket to send it directly to the other email server. Try to avoid forwarding servers.
The above are ten common PHP questions that many people will encounter. So remember to save, and more practice more analysis in your work.