Some of my pages has XML tags like ‘<?xml ?>’ which are considered by PHP as short open tags ‘<? ?>’. How to disable PHP short open tags? In PHP, to disable the short open tags, you can set the variable short_open_tags = FALSE; in your php.ini. Reference: short_open_tags in php.ini
Tag: Linux
How to find out all files with replication factor 1 in HDFS?
Posted onHow to find out all files with replication factor 1 in HDFS? The hdfs dfsadmin -report shows there are blocks with replication factor 1: Missing blocks (with replication factor 1): 7 How to find them out? You can run hdfs fsck to list all files with their replication counts and grep those with replication factor
Read more
How to change the maximum uploading size for PHP with Apache on Linux?
Posted onHow to change the maximum uploading size for PHP with Apache on Linux? PHP has parameters to control the maximum uploading size. Here, we use Ubuntu 18.04 LTS default version as an example. First, open the php.ini configuration file using your favorite editor /etc/php/7.2/apache2/php.ini Then, find the following parts ; Maximum size of POST data
Read more
How to add a prefix string at the beginning of each line in Bash shell script on Linux?
Posted onHow to add a prefix string at the beginning of each line in Bash shell script on Linux? For example, assume we have a file a.txt: line 1 line 2 I want to have, pre line 1 pre line 2 You may use sed, the stream editor for filtering and transforming text: sed -e ‘s/^/pre
Read more
How to detect whether a file is being written by any other process in Linux?
Posted onHow to detect whether a file is being written by any other process in Linux? Before a program open a file to processes it, it wants to ensure no other processes are writing to it. Here, we are sure after the files are written and closed, they will not be written any more. Hence, one-time
Read more
How to make CentOS Linux to load a module automatically at boot time?
Posted onHow to make CentOS Linux to load a module, say ixgbe, automatically at boot time? I am using CentOS 7. You can create a text file <some name>.conf in the /etc/modules-load.d/ and list the modules to be loaded there, one per line. The systemd-modules-load.service daemon will read these files and load the modules. Check more
Read more
How to get the highest temperature from all sensors in a server on Linux?
Posted onIt is useful to monitor a server node’s temporary. Among all the sensors’ temperatures, the higher one may be a very important one. How to get the highest temperature from all sensors in a server on Linux? You can use this command to get the the highest temperature from all sensors in a server on
Read more
WPS’ wpp program reports “libbz2.so.1.0: cannot open shared object file” on CentOS 7
Posted onWPS’ wpp program reports “libbz2.so.1.0: cannot open shared object file” on CentOS 7 as follows: $ wpp /opt/kingsoft/wps-office/office6/wpp: error while loading shared libraries: libbz2.so.1.0: cannot open shared object file: No such file or directory The reason: wpp will tries to dynamically link ‘libbz2.so.1.0’ $ ldd /opt/kingsoft/wps-office/office6/wpp | grep libbz2 libbz2.so.1.0 => not found libbz2.so.1 =>
Read more
How to use encfs on Windows 10?
Posted onI am happy using encfs on Linux. But how to use encfs on Windows 10? I would suggest EncFS MP. It support Encfs on Windows. Features of EncFSMP: Mounts EncFS folders on Windows and OS X Can create, edit, export and change the password of EncFS folders Is 100% compatible with EncFS 1.7.4 on Linux
Read more
Killing Running Bash Script Process Itself and All Child Processes In Linux
Posted onIn Linux, how to kill a process and all its child processes? For example, a Bash script A starts B, B starts C and C calls rsync. I would like to kill A and all its child processes all together. How to do this? There are possibly many answers to this question. One of the
Read more
How to split a gzip file to several small ones on Linux?
Posted onI have a very large (e.g. 100GB) .gz file and would like to split it into smaller files like 8GB/each for storage/copying. How to split a gzip file to several small ones on Linux? You may use the tool split to split a file by sizes. An example to split a large.tgz to at most
Read more
How to get the mtime of a file on Linux?
Posted onHow to get the mtime of a file on Linux from the file’s path? You can use stat to get the file status including the mtime: %y time of last modification, human-readable %Y time of last modification, seconds since Epoch As an example, $ stat -c %y ./file 2017-06-26 13:33:06.764042064 +0800 $ stat -c %Y
Read more
How to force systemd to refresh or reloaded a changed fstab on Linux?
Posted onOn Linux, how to force systemd to refresh or reloaded a changed /etc/fstab file? To force systemd to reload the changed /etc/fstab file content, run $ sudo systemctl daemon-reload To, further, make systemd auto remount any new entries, do $ sudo systemctl restart remote-fs.target local-fs.target
How to check last boot’s systemd journal log in CentOS 7 Linux?
Posted onThe command to check last boot’s journal log shows nothing on CentOS 7: # journalctl -b -1 Failed to look up boot -1: No such boot ID in journal Is the log stored and where it is? The reason this happens on CentOS 7 is that CentOS 7 by default does not enable the persistent
Read more
How to find the hostname of an IP using /etc/hosts if it has the mapping on Linux?
Posted onCommon DNS queries like ping will first get the IP of a hostname if it exists in /etc/hosts. How to find the hostname of an IP using /etc/hosts if it has the mapping on Linux? Multiple tools on Linux can do the “reverse” checking using /etc/hosts file. For example, if we have a line 192.0.2.1
Read more
How to get the running process’ parent process’ ID in Python?
Posted onHow to get the running process’ parent process’ ID in Python? In Python, you can get the parent process’ pid by calling os.getppid(): import os ppid = os.getppid() One example: The shell’s pid: $ echo $$ 21779 Start a python REPL and get its parent pid (the shell’s): $ python Python 2.7.5 (default, Nov 6
Read more
How to get the running process’ parent process’ ID in C / C++?
Posted onHow to get the running process’ parent process’ ID in C / C++? In C and C++, you can call the getppid() library function which is a function from the POSIX library. #include <sys/types.h> #include <unistd.h> pid_t getppid(void); getppid() returns the process ID of the parent of the calling process. Example usage: getppid.c #include <stdio.h>
Read more
How to get the running process’ pid in Go?
Posted onHow to get the running process’ pid in Go lang? In Go, you may call the os.Getpid() func from the os package to get the parent process’ pid. func Getpid() int Getppid returns the process id of the caller. One example is as follows. $ gore gore version 0.2.6 :help for help gore> :import “fmt”
Read more
Getting Process Own Pid in C and C++
Posted onHow to get the running process’ pid in C / C++? In C and C++, you can call the getpid() library function which is a function from the POSIX library. #include <sys/types.h> #include <unistd.h> pid_t getpid(void); getppid() returns the process ID of the calling process. An example C program to get self process ID getpid.c:
Read more
How to get the running process’ parent process’ ID in Bash?
Posted onHow to get the running process’ parent process’ ID in Bash? In Bash, you can get the parent process’s pid from the variable PPID. Note that in a (…) subshell, the $$ stores the subshell’s parent shell pid actually.