Tag Archives: php

Creating Server TCP listening socket 127.0.0.1:6379: bind: No error。。。 Solutions to problems encountered in startup

Creating Server TCP listening socket 127.0.0.1:6379: bind: No error。。。 Solutions to problems encountered in startup

D:\redis>redis-server.exe redis.windows.conf
[9952] 03 Jul 15:48:22.538 # Creating Server TCP listening socket 127.0.0.1:6379: bind: No error

D:\redis>redis-cli.exe
127.0.0.1:6379> shutdown
(0.51s)
not connected> exit

D:\redis>redis-server.exe redis.windows.conf
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 3.2.100 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._   /    _.-'    |     PID: 16908
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

[16908] 03 Jul 15:49:06.195 # Server started, Redis version 3.2.100
[16908] 03 Jul 15:49:06.246 * DB loaded from disk: 0.049 seconds
[16908] 03 Jul 15:49:06.246 * The server is now ready to accept connections on port 6379

How to Solve opcache error: zend_mm_heap corrupted

There are always problems with production. It seems that the memory is full, which makes it impossible to request

situation:

1. Machine clusters are built with containers
2. The request always appears 502, and it will appear after restarting PHP FPM

3. Open the error log configuration

Of course, you can’t turn off opcache directly. You will find that there is no cache. The memory is very high

Open the error log, and the log will appear in/var/log/PHP FPM/error.log

VI/etc/php-fpm.d/w8002.conf # select different conf files according to which group you want to change
Add a line at the end: catch_ workers_ output = yes

Php5.6 has been reported Zend_ mm_ Heap corrupted with standard PHP 5.6: locating the cause and “Zend”_ mm_ “Heap corrupted” looks like a memory explosion. After a turn, it’s the problem of opcache. Try to disable it, modify the configuration in php.ini and restart PHP FPM

View PHP error log

[[email protected] php-fpm]# grep zend error.log | tail -n 3
[01-Jun-2021 00:21:01] WARNING: [pool www8002] child 20812 said into stderr: "zend_mm_heap corrupted"
[01-Jun-2021 00:27:49] WARNING: [pool www8002] child 32582 said into stderr: "zend_mm_heap corrupted"
[01-Jun-2021 00:28:06] WARNING: [pool www8002] child 339 said into stderr: "zend_mm_heap corrupted"

cat php.ini | grep "opcache"
1. /etc/php.d/opcache.ini 改 "opcache.enable=0"
2. systemctl restart php-fpm

Key point: of course, you can’t turn off opcache directly. You will find that the cache memory is too high, so you can’t turn off opcache directly. Let’s start tuning opcache

; switch on
opcache.enable=1

; available memory, as appropriate, in megabytes
opcache.memory_consumption=256

Maximum number of files to cache, try to increase this value if the hit rate is less than 100%
opcache.max_accelerated_files=5000

opcache.max_accelerated_files=5000 ; Opcache will check the modification time of files within a certain period of time, here set the check time period, the default is 2, in seconds
opcache.revalidate_freq=240

The memory size of the interned string, also adjustable
opcache.interned_strings_buffer=8   

whether to fast shutdown, the speed of reclaiming memory will be increased when PHP Request Shutdown is turned on
opcache.fast_shutdown=1

Do not save file/function comments
opcache.save_comments=0

Reference Links:
1.https://stackoverflow.com/questions/2247977/what-does-zend-mm-heap-corrupted-mean
2.https://stackoverflow.com/questions/50769286/zend-mm-heap-corrupted-with-standard-php-5-6-locating-the-cause

[Solved] Request exceeded the limit of 10 internal redirects due to possible configuration error

//httpd error log error:
Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase 
the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: http://127.0.0.1/MyProject/login/userLogin

Most of the answers on the Internet are about. Htaccess, but I don’t think there’s anything wrong with local HTaccess:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond   %{REQUEST_FILENAME} !-f
    RewriteRule   ^(.*)$ index.php?_url=/$1 [QSA,L]
</IfModule>

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule  ^$ apg/public/    [L]
    RewriteRule  (.*) apg/public/$1 [L]
</IfModule>

The url is correct

http://127.0.0.1/MyProject/login/userLogin

But the page doesn’t display the right content.
Let me see where the framework needs to be changed. I still think the framework hasn’t changed.
Solutions:
Later, I checked my collection.php, and there was an array in it, and I added the name of MyProject MyProject:

 static private $ProjectsArray = array(
            'project1',
            'project2',
            'project3',
            'MyProject'
);

The problem solved! Check my localhost page again and you can visit my Project login page. The framework has been set up successfully!

Uncaught type error: cannot read property ‘MSIE’ of undefined

Error:
uncaught typeerror: cannot read property ‘MSIE’ of undefined
reason:
$. Browser method has been removed in jQuery 1.9
write a $. Browser code by yourself (recommended)
write it in the script after jQuery reference

jQuery.browser = {};
(function () {
    jQuery.browser.msie = false;
    jQuery.browser.version = 0;
    if (navigator.userAgent.match(/MSIE ([0-9]+)\./)) {
        jQuery.browser.msie = true;
        jQuery.browser.version = RegExp.$1;
    }
})();

PHP message: PHP Fatal error: Uncaught PDOException: SQLSTATE[08004] [1040] Too many connections

preface

The OJ, which was built before, suddenly made an HTTP 500 error this evening. When I opened the log, I found that the MySQL database collapsed.

Text

Then open the MySQL configuration file. The path of the configuration file is as follows

/etc/mysql/mysql.conf.d/mysqld.cnf

Max the number of links in it_ Change the connections to 1000, and then restart mysql.

404 solution for WordPress Chinese tag

One of the common problems in blogs or websites built by WordPress is that the Chinese tag link does not exist. Google Administrator Tool prompt grabs 404 errors. In particular, windows hosts often have Chinese tag link grabbing errors, and Chinese tags cannot be displayed normally. Or Chinese tags can be displayed normally, but 404 errors will appear after clicking the link, which brings great inconvenience to users and is extremely difficult It greatly reduces the friendliness of the website.

How to solve this problem?

First method:

Open WP include/ classes.php (before 3.1) or WP include/class- wp.php (after 3.1 +, hereinafter referred to as the new version) find line 154 (the new version is line 142)

$pathinfo = $_ SERVER['PATH_ INFO';

Replace with:

$pathinfo = mb_ convert_ encoding($_ SERVER['PATH_ INFO'], 'UTF-8', 'GBK');

Find line 159 (the new version is line 147)

$req_ uri = $_ SERVER['REQUEST_ URI'];

Replace with:

$req_ uri = mb_ convert_ encoding($_ SERVER['REQUEST_ URI'], 'UTF-8', 'GBK');

After my personal test, this method can be used, the new version of the statement may be different from the above, but the method is basically the same, the corresponding statement can be replaced.

Second method:

1. Found in the WP includes folder at the root of the site“ rewrite.php ”This document;

2. Back it up“ rewrite.php ”In case of error (we’d better back up the original code before changing the code);

3. Open“ rewrite.php ”We find the following code in the file:

function get_tag_permastruct()
{
   if (isset($this-&gt;tag_structure)) 
  {
    return $this-&gt;tag_structure;
  }
  if (empty($this-&gt;permalink_structure)) 
  { 
    //Change this line
    $this-&gt;tag_structure = '';
    return false;
  }
  if (empty($this-&gt;tag_base))
  $this-&gt;tag_structure = $this-&gt;front . 'tag/';
  else$this-&gt;tag_structure = $this-&gt;tag_base . '/';
  $this-&gt;tag_structure .= '%tag%';
  return $this-&gt;tag_structure;
}

4. Put some of them together

" if (empty($this-&gt;permalink_structure)) { ”

Amend to read

“ if (! empty($this-&gt;permalink_structure)) { ";

Note that there is only a “!” sign in English. After testing, this method is very effective. PS. didn’t find the code in this file directly…

The third method: the final solution to the Chinese tag 404 error is actually ISAPI_ Rewrite pseudo static rules are not well written, which leads to the failure to find the web page file. In fact, just change the rules: the previous tag pseudo static rules

RewriteRule /tag/(.*)$ /index\.php\?tag=$1

Changed rules

RewriteRule /tag/(.*)/$ /index\.php\?tag=$1

I didn’t test this method, so I can’t guarantee its availability. Please back it up before modification!

Third method:

If the above two methods are not feasible, we recommend another method: alias each tag.

Alias is another URL friendly name. It is usually lowercase and can only contain letters, numbers and hyphens.

But for blogs with more than 100 Chinese tags, this method has a huge workload. Use with caution.

This method can link English tags normally, but it works for websites with Chinese tag problems, but it doesn’t work for websites with 404 English tag links.

How to Solve SQL state [HY000]: general error 2503

SQLSTATE[HY000]: General error 2503

This error is caused by $this – & gt; query. In version 3.2.3, the query and execute methods should be called separately, otherwise an error will be reported in debug mode

After 3.2.3, the TP framework requires different method calls for read and write operations. If it is used incorrectly, an error will be reported in non debugging mode.

Read data using $this->query
Write data using $this->execute

After TP5, it is written as follows:

Read data using Db::query
Write data using Db::execute

Phpstrom reported an error when using SVN: CreateProcess error = 2, the system could not find a solution for the specified file

After phpstrom is installed, the following error will appear during SVN checkout:

Cannot load supported formats: Cannot run program “svn”: CreateProcess error=2

The reason is that SVN uses command-line tools. If there is no SVN command-line tool locally, it will lead to an error.

Solution

Re install SVN, select the installation command line and complete the installation

Change to:

Then all the way to next, the installation is successful.

Restart phpstrom, SVN can be used normally.