Tag Archives: Centos

Call to undefined function mysql_ Connect() solution summary

A:
Use the phpinfo() function in your PHP code to see PHP basics
Mysql_connect () has been deprecated since PHP5.0, and is deprecated in PHP7.0. Mysqli_connect () is used instead if PHP is 7.0 or higher
Method 2:
Missing MySQL module caused by PHP installation
Mysql> install mysql from CentOs
yum install php-mysql -y
If installed, report the following warning
Headers and client library minor version mismatch. Headers:
This is due to the higher version of MySQL, the lower version of the MySQL Client API
You can uninstall php-mysql first
yum remove php-mysql -y
then
yum install php-mysqlnd -y
Finally, restart Apache
systemctl restart httpd
Ubuntu install MySQL module:
Apt to get the install php5 – mysql
Sudo DPKG — reconfigure php5 – mysql
sudo /etc/init.d/mysql restart
sudo /etc/init.d/apache2 restart
Three:
If the first two methods fail, try opening the MySQL module extension in the php.ini configuration file
Php.ini = php.ini; Extension =” related MySQL module “; To get rid of
Then make sure that the dir of extension points to the directory where the extension resides
Windows is usually under Ext and CentOS is under /usr/lib64/php.modules
The above information can be found in the PHPINFO printed information
However, when I encountered this problem, I just needed to install the PHP-MySQL module, and I didn’t need to modify php.ini
My environment is Centos7 and PHP version is PHP5.4
 

A solution to the default invalid host only mode of CentOS virtual machine in VirtualBox

Because the network card is not activated at boot time.
Go to /etc/sysconfig/network-scripts/
Inside is the network card configuration file. Usually the hostonly configuration file name is: IFCFG-ENP0S8
If you open this file, you can see the ONBOOT=no line configuration. Change it to ONBOOT=yes and restart the virtual machine.

Php7 compiles collect2: error: LD returned 1 exit status

Problem description
PHP7: PHP7: PHP7: PHP7: PHP7: PHP7: PHP7

/usr/bin/ld: ext/ldap/.libs/ldap.o: undefined reference to symbol ‘ber_strdup’
/usr/bin/ld:note: ‘ber_strdup’ is defined in DSO /lib64/liblber-2.4.so.2 so try adding it to the linker command line
/lib64/liblber-2.4.so.2:could not read symbols: Invalid operation
collect2:error: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

The solution
In the PHP source code directory vi Makefile open the file, find the EXTRA_LIBS line, line at the end of the add - llber save out of the again make

The solution of centos7 in VMware virtual machine unable to access after installing nginx

VMware virtual machine in Centos7 after installing NGINX is not native access solution
To install Nginx on Linux, see: Linux Centos7 to install Nginx
The firewall of CentOS is changed to “iptables”, which is no longer called “iptables”. The firewall of CentOS is changed to “iptables”, which is no longer called “iptables”. The firewall of CentOS is changed to “iptables”.

firewall-cmd --zone=public --add-port=80/tcp --permanent  

Command meaning:
— zone # scope
— add-port=80/ TCP # Add port in format: port/communication protocol
— permanent # is permanent and will fail if restarted without this parameter
Restart firewall:

systemctl stop firewalld.service  
systemctl start firewalld.service  

Refresh the access again, as shown in the figure below:

QT encountered in CentOS installation( qt.qpa.plugin : Could not load the Qt platform plugin “xcb” )

I don’t believe it. How hard is it to install Qt on Linux?I reinstalled the system several times and got drunk. Here are the problems I encountered:
Round1:
After installation, execute the QTCreator prompt:
Linux qt “qt.qpa.plugin: Could not load the Qt platform plugin “xcb” ”

sudo gedit ~/.bashrc
sudo gedit ~/.bashrc
sudo gedit ~/.bashrc

export QT_DEBUG_PLUGINS=1
export LD_LIBRARY_PATH=/opt/Qt5.13.1/5.13.1/gcc_64/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/Qt5.13.1/Tools/QtCreator/lib:$LD_LIBRARY_PATH

The last two sentences are from the link library path added to the search path, do not know whether to work.
Emphasized in fact the first sentence here, and after the configuration items, QtCreator will output a lot of information, so we can be targeted, step by step to solve the problem/
the changes to take effect

sudo source  ~/.bashrc

round2:
Execute the QtCreator program again from the command line, and output a bunch of log information. Skip to the end to find a prompt:
always load the library/opt/Qt5.13.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb. So: (libxkbcommon – x11. So. 0: unable to open the Shared object file: Don’t have that file or directory)
QLibraryPrivate: : loadPlugin failed on “/ opt/Qt5.13.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb. So” : “Always load the library/opt/Qt5.13.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb. So: (libxkbcommon – x11. So. 0: unable to open the Shared object file: no files or directories)”

obviously failure load of dynamic link library, first check whether there is the file exists, then look at whether the dependent libraries are able to find success:

ldd  /opt/Qt5.13.1/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so

Libxkbcommon is not available, you need to install the library, use yum to install:

yum -y install libxkbcommon-x11-devel

Round 3 lacks DBUS
If you continue, there is still an error. If you skip to the last line, there is still an error
/ opt/Qt5.13.1/Tools/QtCreator/bin/QtCreator: relocation error:/opt/Qt5.13.1/Tools/QtCreator/lib/Qt/plugins/platforms /.. /.. /lib/ libqt5dbus.so.5: Symbol dbus_message_set_allow_interactive_authorization, version LIBDBUS_1_3 not defined in file libbus-1.so.3 with link time reference

yum -y install dbus-devel

round4
Continue with the following error
Opt/Qt5.13.1/Tools/QtCreator/bin/QtCreator: symbol lookup error:/opt/Qt5.13.1/Tools/QtCreator/lib/Qt/plugins/platforms /.. /.. /lib/ libqt5xcbqpa.so.5: undefined Symbol: FT_GET_FONT_FORMAT

yum -y install freetype-devel

Export QT_DEBUG_PLUGINS=1. You may not have the same problem as me, but with the output, you can solve it step by step.

VirtualBox Failed to start LSB:Bring up/down Networking problem

Background:
Static (BOOTPROTO=static # static address protocol)

When using Service Restart Network, you cannot restart the network.

Restarting network (via systemctl): Job for network.service failed. See *systemctl status network.service* and *journalctl -xn* for details.

2. According to the prompt use systemctl status network. The service to check the detailed error message:

 network.service - LSB: Bring up/down networking
   Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2017-03-13 23:24:37 CST; 16s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 2878 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)

Mar 13 23:24:37 centos7 network[2878]: RTNETLINK answers: File exists
Mar 13 23:24:37 centos7 network[2878]: RTNETLINK answers: File exists
Mar 13 23:24:37 centos7 network[2878]: RTNETLINK answers: File exists
Mar 13 23:24:37 centos7 network[2878]: RTNETLINK answers: File exists
Mar 13 23:24:37 centos7 network[2878]: RTNETLINK answers: File exists
Mar 13 23:24:37 centos7 network[2878]: RTNETLINK answers: File exists
Mar 13 23:24:37 centos7 systemd[1]: network.service: control process exited, code=exited status=1
Mar 13 23:24:37 centos7 systemd[1]: Failed to start LSB: Bring up/down networking.
Mar 13 23:24:37 centos7 systemd[1]: Unit network.service entered failed state.
Mar 13 23:24:37 centos7 systemd[1]: network.service failed.

LSB: A set of standard specifications for Linux. Can make Linux conform to software architecture, or file system architecture standard specifications.
If you make sure your network card configuration information is correct (/etc/sysconfig/network-scripts/ifcfg-xxx), and most of the methods on the web are overwritten, such as:

    Add the MAC address in the configuration file (/etc/sysconfig/network-scripts/ifcfg-xxx)

    HWADDR=08:00:27:8c:4d:46

    Close the NetworkManager configuration DNS and restart……

Try turning on the Ethernet configuration when installing Linux CentOS, as shown below:

Turn on the Internet


After the installation will find, magically effective O(∩_∩)O ha ~. (Mine is like this)
 
 
 
 
 
 
 
 
 
 
 
 
 

Modify the name after @ in Linux

Change the name of Linux
When we use Linux with long names, it’s hard for our ocd patients to change
to the name they want.

vi /etc/hostname

Delete the contents and replace them with the name you want. If (Alice)
, save and exit.
, restart and you will find that the modification is complete

Solutions to the problem of “there are stopped jobs” in Linux

Typing exit or logout in a Linux shell sometimes says “There are stopped Jobs” because pressing Ctrl+Z caused the program or process to suspend. It can be enabled by command typing or run in the background.

Enter the command JOBS in the shell to see a list of stopped processes
Enter the command JOBS-l to display a detailed list of stopped processes
A stopped process can be killed or activated with the following command:
Kill: Kill %1 (%1 is the process number of the job to be killed)
Activation: fg %1 (%1 is the process number of the job to be activated)
Fg represents foreground, which wakens the process of suspended