Common Errors on PHP + Apache servers

Source: Internet
Author: User
Tags mssql server php server blank page mysql slow query log

 

How to handle port 1.80 occupation or query server port occupation

Symptom: the OS 1048 error is reported, or the port is dedicated.

Solution: Enter netstat-ABN-> C:/port80.txt In the CMD command window and find the program PID that occupies port 80 in the cdisk port80.txt file. Write down the PID. Open the task manager, click "View"/Select column, select "PID (process identifier)", and click the "process" tab to find the PID corresponding to port 80, you can see that the program is occupied. Change the port of the program or end the process.

2. MySQL connection error or arry_fetch_row prompt

Symptom: the session or cache is not enabled.

Solution: Find PHP. ini in the Windows folder and modify the corresponding functions to save and restart the server.

3. No error is reported when running the program. Only blank pages are displayed.

Symptom: I have set up a PHP server. If a program error is not reported, only a blank page is displayed.

Solution: Enable the error reporting option in PHP. ini, display_errors = on;

4. How to solve the problem that PHP cannot connect to MSSQL during conversion

Problem description:During the conversion, "the connection between PHP and MSSQL Server database is not configured !" Error Message

Problem Analysis:This error message may only appear when the original database type is MSSQL. This is generally because PHP does not properly load the MSSQL module.

Solution:

1. If you are using a virtual space, contact the Space Provider.

2. If you have administrative permissions on the server, see the following solution:

1. If your server system is windows, open PHP. ini and find:

;extension=php_mssql.dll

Remove the semicolon and restart the web server.

If the above Code is not found, add the following code to PhP. ini, save it, and restart the Web Server:

extension=php_mssql.dll

If your server is in Linux, recompile PHP to load the MSSQL module.

2. Check whether the PHP installation root directory ext contains php_mssql.dll. If not, download php_mssql.dll of the corresponding PHP version and copy it to the directory.

3. Download the attachment, decompress it, copy ntwdblib. DLL to C:/Windows/system32/, and restart the web server.

5. Quickly repair corrupted MySQL Databases

After using MySQL for a long time, some problems may occur in the database. Most problems can be solved quickly through simple operations. The following describes two methods to quickly repair the MySQL database.

1. myisamchk

To use myisamchk, you must temporarily stop the MySQL server. For example, we want to repair the discuz database. Perform the following operations:

# Service MySQL stop (stop MySQL );

 

# Myisamchk-r/absolute path of the database file/* myi

# Service MySQL start

Myisamchk automatically checks and fixes index errors in the data table.

2. mysqlcheck

You can use mysqlcheck to perform hotfix without stopping MySQL. The procedure is as follows:

# mysqlcheck -r discuz.* 

 

Note: Do not use-F to forcibly fix myisamchk or mysqlcheck. If the-F parameter fails to be repaired, delete some data with errors to try to fix it. Therefore, do not use-F unless necessary.

6. How to modify the size limit of uploaded attachments on the server

Modify the following items in PHP. ini (Windows in C:/Windows/system32:

Post_max_size = 8 m (the maximum limit for form submission. This option does not limit the size of a single file to be uploaded, but restricts the data submitted by the entire form .)

Upload_max_filesize = 2 m (maximum size of a single file to be uploaded)

Make sure post_max_size> = upload_max_filesize, that is, the former is not smaller than the latter.

After modification, you must restart the web service.

Note: If the modification does not take effect after the Web is restarted, it may be your modified PHP. the INI file is not the file used by PHP of course. Make sure that you modify the PHP file currently in use by PHP. INI file.

7. USER % s already has more than/'max _ user_connections/'Active connections

Error No:1203

Problem Analysis:

Max_user_connections is the maximum number of MySQL user connections. The full-range statement indicates that the maximum number of connections of MySQL on the server is insufficient.

Solution:

1. Modify the value of the max_user_connections parameter in my. ini or my. CNF file in the MySQL installation directory and restart the MySQL server;

2. For VM users, contact the Space Provider to check whether the server is normal.

8. How to enable the MySQL Remote Account

There are two major steps to enable the MySQL remote login account:

1. Check whether the firewall on the server does not block port 3306.

The default port of MySQL is 3306. Make sure that the firewall does not block port 3306. Otherwise, the remote connection to MySQL cannot be established through port 3306.

If you specify another port when installing MySQL, enable the port used by MySQL in the firewall.

If you do not know how to set up a firewall on your server, contact your server administrator.

2. Added support for remote connection to mysql users and authorization.

1) first log on to MySQL with the root account

On the Windows host, click the Start Menu, run, enter "cmd", enter the console, MySQL bin directory, and then enter the following command.

On the Linux host, enter the following command in the command prompt line.

> MySQL -uroot -p123456

 

123456 is the password of the root user.

2) create a remote login user and authorize

> grant all PRIVILEGES on discuz.* to ted@'123.123.123.123' identified by '123456';

 

The preceding statement grants all permissions of the discuz database to the TED user, allows the TED user to remotely log on to the IP address 123.123.123.123, and sets the TED user password to 123456.

The following describes all the parameters one by one:

All privileges indicates that all permissions are granted to the specified user. Here, you can also replace it with a specific permission, such as select, insert, update, delete, create, and drop, separate specific permissions with commas.

Discuz. * Indicates the table to which the preceding Permission applies. discuz indicates the database, and * indicates all the tables. Therefore, we can infer that: authorize "*. * ", authorize all tables of a database to" database name. * ", authorize a table of a database as" database name. table name ".

Ted indicates the user you want to authorize. This user can be an existing user or a non-existing user.

123.123.123.123 indicates the IP address that allows remote connection. If you want to restrict the IP address, set it to "%.

123456 is the user's password.

After the preceding statement is executed, the following statement can take effect immediately.

> flush privileges;

9. How to enable MySQL slow query log

During website operation, the website may suddenly slow down. In general, it is related to the slow mysql. You can enable slow query to find the SQL statement that affects the efficiency, then take appropriate measures. The following describes how to enable slow query:

1. Enable slow Query

Find the MySQL configuration file, my. CNF (My. ini for Windows), and add the following lines under MYSQL:

long_query_time=2log-slow-queries= /usr/var/slowquery.log

The above 2 is the query time, that is, it is recorded when the execution time of an SQL statement exceeds 2 seconds, and/usr/var/slowquery. log is the location of the log record.

Then restart the MySQL service.

2. MySQL configuration file location

Windows: the configuration file for Windows is my. ini, which is usually in the MySQL installation directory or C:/windows.

Linux: the configuration file of Linux is my. CNF, which is usually in/etc.

10. Too connector connections

Error No:1040

Problem Analysis:

The number of connections exceeds the value set by MySQL. It is related to max_connections and wait_timeout. The larger the value of wait_timeout, the longer the idle waiting time for the connection, which leads to the larger number of current connections.

Solution:

1. For VM users, contact the Space Provider to optimize the configuration of the MySQL server;

2. for independent host users, contact the server administrator to optimize the configuration of the MySQL server. For details, refer:

Modify the parameters in the MySQL configuration file (My. ini in windows and my. CnF in Linux:

max_connections= 1000wait_timeout = 5

If not, you can add it on your own. After modification, restart mysql. If this error is reported frequently, perform overall server optimization.

Related Article

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.