Tag Archives: linux

Causes and solutions of WordPress media library pictures not showing or showing errors

Recently, I am developing a WordPress Theme – wait theme, but in the process of development, a wonderful problem suddenly appears, the media library pictures are not displayed!! Always show the small circle in loading, and upload images always fail. After struggling for two or three days, I finally found out the problem and quickly wrote it down….

describe

Recently, I am developing a WordPress Theme – wait theme, but in the process of development, a wonderful problem suddenly appears, the media library pictures are not displayed!! Always show the small circle in loading, and upload images always fail. The details are shown in the figure below:

The selection list mode is normal

attempt

After finding this problem, the other work of theme development can only be temporarily stopped and focused on solving this problem.

First go to the Internet search, the results found that the results are the same, what folder permissions, file coding problems, plug-in settings and so on.

However, this is a local test system. No plug-ins are installed and there is no permission problem. The coding format is utf8 without BOM.

It is found that a few netizens have the same problem as me, but no one below gives a solution…..

After the search on the Internet is fruitless, we can only find a solution by ourselves.

explore

First of all, I suspect that my topic function has the same name as the function of WP. So open it upload.php , compare the functions one by one with the functions written by yourself, and find that there is no duplicate name problem, so this option is excluded.

Then check the admin file, no suspicious situation is found.

In the browser debugging window, check the loading and debugging of CSS and JS, and no exception is found.

Finally, there is no way to open the code window, line by line to view the code, also did not find anything suspicious.

It took me two or three days to go back and forth in this way. Until this afternoon, I found the root of the problem~~~~

problem

When looking at the code again this afternoon, I suddenly found such a statement:

The problem lies in this sentence!!!!

Look at the explanation of HTML Declaration on w3school

≪! DOCTYPE & gt; declaration must be the first line of an HTML document, before the & lt; HTML & gt; tag.

≪! DOCTYPE & gt; declaration is not an HTML tag; it is an instruction to the web browser about which HTML version the page is written with.

In HTML 4.01, the & lt;! DOCTYPE & gt; declaration references DTD because HTML 4.01 is based on SGML. DTD specifies the rules of markup language, so that the browser can present the content correctly.

HTML5 is not based on SGML, so there is no need to reference DTD.

Tip: always add a & lt;! DOCTYPE & gt; declaration to an HTML document so that the browser knows the document type.

≪! DOCTYPE & gt; declaration must be the first line of an HTML document, before the & lt; HTML & gt; tag! ≪! DOCTYPE & gt; declaration must be the first line of an HTML document, before the & lt; HTML & gt; tag! ≪! DOCTYPE & gt; declaration must be the first line of an HTML document, before the & lt; HTML & gt; tag!

Three important words~~

Therefore, as long as the above obnoxious sentence is removed, this problem can be solved ~ ~
by removing it

solve

Looking for the source code, I found that there was a reference in my admin file:

At that time, I thought that this sentence would be in the main body of the web page, so I wrote it. But today, I found that no matter where I put it, it will always appear in the first line of the web page!!! WTF!!!

Only by deleting it and writing the CSS code to the file, can the problem be solved successfully~~~~

summary

1. Don’t blindly believe in things on the Internet, do it yourself is the king

2. Debugging a bug starts with the source code.

3. When it comes to problems, be calm and don’t be impatient~~

4. Do it yourself~~~

prospect

Wait theme will be released soon, please look forward to it~~~

Reprint English blogs with source

Reprint English blogs with source

Reprint English blogs with source

Three important words~~


Welcome to my website:

Other English Blogs

++>

Causes and solutions of WordPress media library pictures not showing or showing errors

Solve the problem of 404 Not Found error in nginx accessing dynamic interface

Problem description

We design a set of recruitment back transfer system, and use ant design Vue and jfinal framework at the front and back end respectively. You want to deploy the project to the server, but external access always reports 404 not found

Solutions

The error is: the dynamic interface can not be found, but I don’t know whether there is a problem in the project or after nginx agent.
Therefore, it is necessary to test the interface of the project itself and the interface after nginx proxy.

First, test the interface in the project

Enter the command: curl on the Ubuntu side http://localhost :port/xxx/xxx

Here my interface is. curl http://localhost:20294/sys/login

Results of operation:

It shows that there is no problem with the interface in my project.

Test the interface after nginx proxy again

Then input the command in Ubuntu

curl http://localhost:8080/api/user/login

Running result:

the prompt here is that the interface cannot be found, which indicates that the problem lies in the proxy server nginx, so we need to modify the configuration file of nginx.

According to the suggestions of other blogs, I added a slash to this place in nginx configuration

after restarting the server, it still can’t work.

Complete solution

When I didn’t know what to do, I suddenly found that there were two nginx in my server ····
I was wondering if it was because there were two nginx, and the modified configuration file was not the nginx I started. So I replaced all nginx configuration files with my original configuration files, and then restarted. Still not

Worried about the two nginxs, I deleted all nginxs in the server. Delete steps (run the following steps in turn:

ps aux|grep nginx  #View nginx processes
kill -9 process number #Kill the nginx queried in the previous step (process number is in the second column)
find/-name nginx #Find the nginx file address
rm -rf xxx #Delete all nginx files

Finally, use weget to install the new nginx, and then install it according to the original installation steps. After modifying the configuration file, run curl to access the dynamic interface. All of a sudden, it’s OK!

The following is my nginx configuration file:

user root;
#user  nobody;
worker_processes  4;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    log_format main '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    server_names_hash_bucket_size 128;
    client_header_buffer_size 32k;
    underscores_in_headers on;
    large_client_header_buffers 4 32k;
    client_max_body_size 50m;
    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    tcp_nopush          on;
    fastcgi_connect_timeout 300;
    fastcgi_send_timeout    300;
    fastcgi_read_timeout    300;
    fastcgi_buffer_size     64k;
    fastcgi_buffers     4   64k;
    fastcgi_busy_buffers_size 128k;
    fastcgi_temp_file_write_size 256k;
    tcp_nodelay         on;

    #gzip  on;


    ######################################################
    #############     Sparrow configuration address    ###########
    ######################################################
    server {
        listen       8080;
        server_name  somename;

        location /api/ {
            proxy_pass http://0.0.0.0:20294/; #Mapping to the local port.
            proxy_redirect off;
            proxy_set_header Host $http_host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-Proto https;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            client_max_body_size 200m;
            proxy_connect_timeout 600;
            proxy_read_timeout 600;
        }
        
        location/{
            root /root/project-template/config/static;
            try_files $uri $uri/ @router;
            index index.html;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-Proto https;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            client_max_body_size 200m;
            proxy_connect_timeout 600;
            proxy_read_timeout 600;
        }

        location @router {
            rewrite ^.*$ /index.html last;
        }
    }
}

note: when configuring the dynamic access API, remember to add a slash at the end

So far, the problem has been solved perfectly.

Error resolution in composer 2 install or update


Linux Version: CentOS 7.9,PHP 7.2
Error: You are using Composer 2, which some of your plugins seem to be incompatible with. Make sure you update your plugins or report a plugin-issue to ask them to support Composer 2.
Cause Version conflict
Solution.https://stackoverflow.com/questions/64597051/how-to-downgrade-or-install-a-specific-version-of-composer-on-windows
Run Command composer self-update --1 Rollback to v1

Error report when installing arpspoof in Kali

“21040;” 32479;”228411;” sources. (GROANS)

root :$35; cd /
root :/’35; cd etc
root :/etc’35; cd apt
root :/etc/apt’35; vi sources.

“25509;” 30528;”281553deb;” http://www.bing.com/searc….tin-round+rock+texas Kali-rolling main non-free contrib 25110deb http://mirrors.ustc.edu.cn/kali Kali-rolling main non-free contrib -28982;”Esc,”:wq”20445;”23384;”368644;”

When configuring ROS distributed / Error report solution and command requirements encountered in the process of master-slave computer

    Error: SSH: connect to host * * port 22: network is unreachable
    cause: network is disconnected
    solution: restart virtual machine or manually connect or command to restart network connection

    sudo service network-manager restart
    

      Error: Unit network.service Not found.
      reason: wrong command

        Error: ROS error: the window cannot be opened remotely qxcbconnection: could not connect to display
        qxcbconnection: could not connect to display
        reason: the graphical window cannot be opened remotely

          Error: under Ubuntu 16.04, the terminal input sudo The problem of sudo: unable to resolve host Ubuntu: connection timed out occurs
          cause: this problem is caused by the inconsistency between the host name (localhost) in hosts and the host name in the “etc” folder of the system disk.
          Solution: set hosts to be consistent

            Requirements: view the SSH connection of Linux
            command:

            ps aux | grep sshd
            

              Requirements: use the service command to start the SSH service. The command execution is as follows.
              Command:

              service sshd start
              

                Requirement: how to view the Pi of the host connected through SSH in Ubuntu
                command:

                who
                

                  Requirements: how to modify user password in Ubuntu
                  command:

                  usrname@usrname-laptoppasswd:~$passwd usrname
                  

                Setting up automatic networking alias for Mac Terminal

                Set up automatic networking alias for @Mac terminal
                #= alias for connect wifi.
                alias lsnt=‘networksetup -listallhardwareports’ # list network device
                alias lswf=’/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport scan’ # scan wifi, and show list
                alias onwf=‘networksetup -setairportpower en0 on’
                alias offwf=‘networksetup -setairportpower en0 off’
                alias lkwf=‘networksetup -setairportnetwork en0’
                #- alias lk413=‘networksetup -setairportnetwork en0 HUAWEI-xxx passwd’
                alias lk413=‘lkwf HUAWEI-xxx passwd’
                alias lsbb=‘lsbb(){ lswf | grep pi | cut -c 23-32 | grep “$1” ;}; lsbb’ # scan BB wifi, and show list
                alias lkbb=‘lkbb(){ lkwf “$1” passwd ; }; lkbb’
                alias lkb=‘lkb(){ lkwf lsbb "$1" passwd ; }; lkb’

                The solution to frequently pop up “cannot find a valid baseurl for repo” error prompt box in CentOS 6.7

                The situation is: CentOS 6.7 server cannot connect to the external network normally, and can only be used in the internal network. The “cannot find a valid baseurl for repo” error box pops up frequently. Here’s a screenshot:

                As the system is running normally, it does not need to be updated. Therefore, by adjusting the system settings and setting the system to “never check for updates” and “never update”, this error box will not appear in the system. As shown in the figure below:

                Linux learning experience sharing

                1. What’s the use of learning Linux?

                Learning Linux well will let you break the limitation of windows, come and go freely in the open source world, there are a lot of free software for you to use, especially the students of computer department,.
                If you only use Linux as the only tool to make a living, you can choose the direction mainly in the operation and maintenance, system level software development and other fields. Linux occupies the vast majority of the server market, such as the Internet industry, front-end web development, back-end web servers, databases, storage devices are basically running on Linux, so you have to fight with Linux to do software development Although I think Linux brings you a different world view. There is no good or bad technology, the key is to see how you understand it.

                2. I think there are many English words in Linux. Is it difficult to learn them?

                Many people may think that there are many English words and documents in Linux. Is it difficult for us to learn them, but these commands are just abbreviations of English words, such as LS – list, CD – change directory, PWD – print working directory, CP – copy, MV – move, RM – remove these commands are abbreviations of English words, as long as you understand the meaning (understand), this shoe command will be very simple.
                Therefore, don’t be afraid of English. English, as the most widely circulated language in the world, always has its value. It is also necessary to study and further study. Why not learn English together while learning Linux?If you have such an idea, then I’m sure you can learn Linux well.

                3. I want to learn Linux, but I’m too busy with my work. I can learn less every day, and then Bala

                Linux is a skill that makes a lot of things. In fact, it doesn’t require you to spend a lot of time learning it, but requires you to keep on and accumulate it. So, for office workers, it is the key to be good at using fragmented time. As long as you take out half an hour every day and persist in learning for a year, there will be a breakthrough!
                Finally, there is the saying: “if you want to learn, nothing is an excuse. If you don’t want to learn, everything is an excuse.”

                4. Some people say that “learning Linux is going in laughing and coming out crying”. Is that right?

                Those who say that everything (skills) is easy to get started and difficult to learn later are all excuses for not learning well. Linux is just a basic computer skill. It has no requirements for learners’ background, knowledge structure and age. As long as they make unremitting progress, there is nothing they can’t learn. Of course, in learning there will always be bottlenecks, this time we need to self-regulation, adhere to. There are a lot of things to remember in learning Linux. If you are too lazy to recite, study and understand the command options of Linux, you will find it difficult to learn. Or that sentence, down-to-earth, there will always be harvest.

                5. My qualifications are average and I don’t have any foundation. Generally, I have to study Linux in non working hours. How long can I pass RHCE?

                It varies from person to person how long they have passed the certification. According to past experience, most people spend 1 or 2 hours a day studying hard for 2 to 4 months, so they should be able to pass the RHCE. I personally don’t agree with the method of storming RHCE half a month, because the certificate is secondary to learning Linux, and the main thing is to improve my working ability. Certification like this can be used as a phased goal for you to learn Linux, but it is not the main purpose of your study.

                6. I want to teach myself Linux. What’s a good textbook to recommend.
                When it comes to teaching materials, there are quite a lot of Linux teaching materials on the market. If you really want to recommend them, you can recommend many books. Next, I mainly recommend a book that I think is more suitable for beginners: This is how to learn Linux written by Liu Trent.
                This book was started in 2015, and is still in the process of being written. It is a relatively new book. Compared with the Linux books on the market a few years ago, it is more suitable for the current environment, so as to improve the efficiency Redhat7 is a teaching system. Compared with other books, you can learn a lot of useful things. For a classmate with zero basis in Linux, the knowledge of this book is certainly enough, and what you have learned can be used in work It’s OK in the RHCE exam. The main points and difficulties of Linux system management are all covered in it. It’s easy to learn in order, and you don’t have to worry about the fracture of the knowledge layer.

                7. I want to learn Linux, but I have no patience. How can I persist?

                I don’t think this is a case. Many beginners will ask this question. In fact, what I want to say is that patience should be cultivated slowly. One of the most important things in learning Linux is interest. Generally speaking, people who want to learn Linux are interested in Linux or have what they want. In addition, a good learning environment and a good example will naturally lead to patience If you keep learning, you will be in touch with Linux every day. You can turn books whenever you have time. Therefore, interest is the best teacher. Although this sentence is vulgar, it’s quite right.

                8. I want to learn Linux. Can I completely study by myself without taking any training courses?

                You can download a free copy of “this is how to learn Linux” http://www.linuxprobe.com/book Take a look at it by self-study, but I don’t recommend not to apply for classes at all. In fact, Linux is a simple thing: you will use it after you learn it. For example, when you take exams and use them in your work, you will be short of learning by yourself at the beginning, which will directly affect your study time and greatly increase the cost of study. Therefore, when you first get started, you still need a Linux teacher to guide you to get started;
                when you get started, you need a Linux teacher to help you get started Secondly, in fact, there are certain rules in learning Linux. We can call it the knowledge architecture of Linux. If you just look at the content in the textbook without the teacher’s summary and explanation, it’s easy to forget after learning. If you follow the teacher to learn Linux at the beginning, you can establish the correct knowledge architecture of Linux. On the contrary, if you don’t set up a good structure at the beginning, even if you teach yourself to the intermediate level, you may find it difficult to learn in the face of some unfamiliar problems, and your interest in learning will weaken, leading to giving up in the end. In addition, if it’s class learning, you can find like-minded partners to study together in a class, which is also a kind of promotion for your own learning.

                Generally speaking, they can learn by themselves, but they are difficult and easy to take detours. Knowledge on the Internet is scattered, and there are mistakes and loopholes. If there is a teacher’s advice, on the one hand, it can help you to summarize in time, on the other hand, it can also play a role in urging you to learn.

                Ubuntu “a user name is not in the sudoer folder. It will be reported. ” Solutions for

                If the user name was not created when the system was installed, this problem occurs when using the sudo command.

                Solution: input

                su
                

                Enter the root password. If you have not set the root password before, please visit the URL settings.
                http://blog.csdn.net/baidu_ 27280587/article/details/53285620

                After entering the successful root environment, enter

                gedit /etc/sudoer
                

                After opening the file, find the

                root	ALL=(ALL:ALL) ALL
                

                In this line, add the same line below it, and change root to your user name. Save and close the file, and then use the sudo command, no more errors will be reported.

                Solution to the error $’\ R’: command not found when executing shell script under Linux

                This error is caused by the different coding of windows system and Linux system. The carriage return in windows is , while that in Linux is , so carriage return in scripts written remotely with shell is not recognized by Linux system, but it can not be seen when editing with vim.
                Solution: add - B , that is, VIM - B file name , when editing the script file with VIM, so that the open file is "binary mode", you can see the extra things, and the display is ^ m , delete it, save it and run it.

                Opensuse12.3 installation of VirtualBox error resolution

                At the beginning, you will be prompted what to install DKMS, and then you will see the error as shown in the figure after downloading and installing, that is

                sincerefly@linux-eq1f:~/Downloads/iso$ sudo rpm -Uivh dkms-2.2.0.3-1.noarch.rpm
                root's password:
                Ready...                          ################################# [100%]
                        package dkms-2.2.0.3-1.noarch is already installed
                sincerefly@linux-eq1f:~/Downloads/iso$ sudo /etc/init.d/vboxdrv setup
                Stopping VirtualBox kernel modules                                                                            done
                Uninstalling old VirtualBox DKMS kernel modules                                                               done
                Trying to register the VirtualBox kernel modules using DKMSError! echo
                Your kernel headers for kernel 3.7.10-1.16-desktop cannot be found at
                /lib/modules/3.7.10-1.16-desktop/build or /lib/modules/3.7.10-1.16-desktop/source.
                                                                                                                              failed
                  (Failed, trying without DKMS)
                Recompiling VirtualBox kernel modules                                                                         failed
                

                I don’t know what’s the reason. It’s not good to worry about virtual machines. One is to learn from CentOS. The other is to do experiments. It’s not safe in the physical system, but it’s OK. There’s Baidu. If there is a problem, it needs to be solved

                Search for

                   sudo apt-get install dkms build-essential linux-headers-$(uname -r)
                   sudo /etc/init.d/vboxdrv setup

                It’s just a Debian command

                I see such a sentence in it

                The reason is that the corresponding package for the corresponding kernel is missing. Although I have executed the install command for kernel-devel before, the corresponding kernel-devel for the uek kernel is not installed, the correct one should be kernel-uek-devel.

                That “kernel devel installation command” misled me for a long time, suddenly woke up, it was the package.

                This is easy to do. Use zypper search kernel devel to search, and it is

                After the installation, run it again

                sudo /etc/init.d/vboxdrv setup

                success!

                Then my VB can run.