CentOS install PHP

  1. Obtain the PHP installation file: downloads or download directly php-5.5.9.tar.gz

Obtain the supporting files needed to install php: libxml2 or directly download libxml2-2.9.1.tar.gz

  1. Install libxml2

If the installation is successful, five directories, bin, include, lib, man and share will be generated under the /usr/local/libxml2/ directory. When installing the configuration of the PHP5 source code package later, the option "--with-libxml-dir=/usr/ local/libxml2" will be added to the options of the configure command to specify the location of the libxml2 library file.

  1. Install php5
# tar zvxf php-5.3.8.tar.gz #cd php-5.3.8
#. /configure \ 
- - prefix=/usr/local/php \ 
- - with-mysql=/usr/local/mysql \  
- - with-apxs=/usr/local/apache2/bin/apxs \
- - with-libxml-dir=/usr/local/libxml2
# make 
# make install
  1. Reconfigure apache2 to support php

# vi /usr/local/apache/conf/httpd.conf

Find AddType application/x-gzip .gz .tgz and add the following content under it

AddType application/x-httpd-php .php (with a space in front of it)

AddType application/x-httpd-php-source .phps (. There is a space in front of it)

cp php-5.3.8/php.ini.dist /usr/local/php/lib/php.ini

(If there is no php.ini.dist, just rename any one of php.ini-development php.ini-production to php.ini.dist.)

Modify the php.ini file register_globals = On

service apache restart

  1. Test whether php is successfully installed

Write a php test page info.php and put it in apache2/htdocs.

;  

Enter in the browser: server address/info.php

If the php information can be displayed normally, it means that Apche+Mysql+PHP is installed successfully!


CentOS 5.5 uses yum to install LAMP

1. Change source, use sohu installation source
1.1 Backup CentOS-Base.repo
cd /etc/yum.repos.d/ 
cp CentOS-Base.repo CentOS-Base.repo.bak 
1.2 Replacement source
Open CentOS-Base.repo with vi and empty the content, then copy the content below and save it.

CentOS-Base.repo

This file uses a new mirrorlist system developed by Lance Davis for CentOS.

The mirror system uses the connecting IP address of the client and the

update status of each mirror to pick mirrors that are updated to and

geographically close to the client. You should use this for CentOS updates

unless you are manually picking other mirrors.

If the mirrorlist= does not work for you, as a fall back you can try the

remarked out baseurl= line instead.

[ base] 
name=CentOS-releasever - Base  baseurl=http://mirrors.sohu.com/centos/releasever/os/$basearch/ 
gpgcheck=1 
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5

released updates

[ updates] 
name=CentOS-releasever - Updates  baseurl=http://mirrors.sohu.com/centos/releasever/updates/$basearch/ 
gpgcheck=1 
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5

packages used/produced in the build but not released

[ addons] 
name=CentOS-releasever - Addons  baseurl=http://mirrors.sohu.com/centos/releasever/addons/$basearch/ 
gpgcheck=1 
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5

additional packages that may be useful

[ extras] 
name=CentOS-releasever - Extras  baseurl=http://mirrors.sohu.com/centos/releasever/extras/$basearch/ 
gpgcheck=1 
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5

additional packages that extend functionality of existing packages

[ centosplus] 
name=CentOS-releasever - Plus  baseurl=http://mirrors.sohu.com/centos/releasever/centosplus/$basearch/ 
gpgcheck=1 
enabled=0 
gpgkey=http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5 
1.3 Update yum -y update

2. Install Apache, Mysql, PHP with yum
2.1 Install Apache
yum install httpd httpd-devel 
After the installation is complete, start apache

/etc/init.d/httpd start 
Set to boot up: chkconfig httpd on
2.2 Install mysql
yum install mysql mysql-server mysql-devel 
After completion, start mysql

/etc/init.d/mysqld start 
2.2.2 Set mysql password

mysql -uroot
mysql> USE mysql; 
mysql> UPDATE user SET Password=PASSWORD('newpassword') WHERE user='root'; FLUSH PRIVILEGES; 
2.2.3 Allow remote login
mysql -u root -p 
Enter Password:  
mysql>GRANT ALL PRIVILEGES ON . TO 'username'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;  FLUSH PRIVILEGES; 
After completion, you can use mysql-front to remotely manage mysql.
2.2.4 Set to boot
chkconfig mysqld on 
3. Install php
yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml 
/etc/init.d/httpd start 
4. have a test
4.1 Create a new test.php file in /var/www/html/, write the following content, and then save.

 

4.2 Firewall configuration
a. Add. Allow access to port {21: ftp, 80: http}.
iptables -I RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 21 -j ACCEPT 
iptables -I RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT 
b. Turn off the firewall {not recommended}.
service iptables stop 
c. Reset loading firewall
service iptables restart 
4.3 Then open http://serverip/test.php in the client browser, if it can be displayed successfully, it means the installation is successful.
At this point, the installation is complete. With emotion, yum is so easy to use.

PHP upgrade

  1. First check the current php version
    #php -v

  2. Upgrade php version
    rpm --import http://repo.webtatic.com/yum/RPM-GPG-KEY-webtatic-andy

wget -P /etc/yum.repos.d/ http://repo.webtatic.com/yum/webtatic.repo

yum --enablerepo=webtatic update php mysql
It is best to upgrade php with mysql, and you can see that php has been upgraded to 5.3.28

3、 View the upgraded php version

# php -v

PHP 5.3.28 (cli) (built: Dec 15 2013 17:43:05) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies

You can see that the version of php has been updated to 5.3.X

Restart /etc/init.d/httpd restart or apache service httpd restart


Upgrade 2 (recommended)

1 ) Pre-installed

yum --enablerepo=remi,remi-php55 install php-pecl-apc php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml

2 ) Upgrade php

yum --enablerepo=remi,remi-php55 install php-opcache

Unable to load dynamic library '/usr/lib64/php/modules/gd.so

[ root@ithomer ~]# php -v
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/gd.so' - libvpx.so.0: cannot map zero-fill pages: Cannot allocate memory in Unknown on line 0
PHP 5.5.9 (cli) (built: Feb 18 2014 14:51:49) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

solve:

How To Add Swap on CentOS 6


libcurl.so.3

Error: Package: php-common-5.3.28-2.w5.x86_64 (webtatic)
Requires: libcurl.so.3()(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

yum install libcurl libcurl-devel


MySQL upgrade

The source mysql of CentOS 5.5 is currently still on 5.0.19. When you want to be the master-slave of the database, you must upgrade to 5.1 or higher, simply directly to 5.5.36

1、 Install the yum source of MySQL 5.5.x:

rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm

2、 Install the support package for the MySQL client:

yum install libmysqlclient15 --enablerepo=webtatic

3、 Uninstall the packages of the old version of MySQL:

yum remove mysql mysql-*

4、 Install the client and server of MySQL 5.5:

yum install mysql55 mysql55-server --enablerepo=webtatic

5、 Start the MySQL system service and update the database:

/etc/init.d/mysqld restart

mysql_upgrade -uroot -proot

Upgrade complete

/etc/init.d/mysqld restart


Upgrade 1 (recommended)

To list Old MySql
yum list installed | grep -i mysql

To remove Old MySql
yum remove mysql mysql-*

Remi Dependency on CentOS 6 and Red Hat (RHEL) 6
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

Install MySQL server
yum --enablerepo=remi,remi-test install mysql mysql-server

To list New MySql
yum list installed | grep -i mysql
start MySql server

/etc/init.d/mysqld start  ## use restart after update
OR
service mysqld start  ## use restart after update

chkconfig --levels 235 mysqld on

Last
mysql_upgrade -u root -p
Now my MySql version is 5.5.32

Ref:
http://www.webtatic.com/packages/mysql55/
http://www.if-not-true-then-false.com/2010/install-mysql-on-fedora-centos-red-hat-rhel/

update MySQL version from 5.1 to 5.5 in CentOS 6.2

Centos uses YUM to install MariaDB

1、 Create MariaDB.repo under /etc/yum.repos.d/
$ cd /etc/yum.repos.d 
$ vim /etc/yum.repos.d/MariaDB.repo

Add the following configuration:

MariaDB 10.0 CentOS repository list - created 2013-08-23 13:08 UTC

http://mariadb.org/mariadb/repositories/

[ mariadb] 
name = MariaDB 
baseurl = http://yum.mariadb.org/10.0/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

If it is another operating system, you can find relevant information in here.

**2、 Install MariaDB using YUM **
$ sudo yum -y install MariaDB-client MariaDB-server MariaDB-devel

**3、 Start the database **
$ sudo service mysql start

4、 Modify Root password

$ mysqladmin -u root password ‘passwd’

5、 Configure remote access, MariaDB binds ip (127.0.0.1) by default for security.

$ mysql -u root -p 
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g. 
Your MariaDB connection id is 4 
Server version: 10.0.4-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY ‘passwd’ WITH GRANT OPTION;

MariaDB [(none)]> flush privileges;

The "%" in the first sentence means that any host can remotely log in to the server for access. If you want to restrict access to only a certain machine, just change it to the corresponding IP, such as:

GRANT ALL PRIVILEGES ON . TO root@"172.168.193.25" IDENTIFIED BY "root";

The second sentence means to reload the permission data from the grant table of the mysql database. Because MySQL stores all permissions in the cache, it needs to be reloaded after making changes.

6、 Firewall configuration

If the system firewall is on (or behind a hardware firewall or NAT), you must open the TCP port used by mysql, which is usually 3306.

7、 Case Sensitive

After logging in with the root account, add lower_case_table_names=1 after [mysqld] in /etc/my.cnf and restart the MYSQL service. At this time, it has been set successfully: the case of the table name is not distinguished;
Detailed explanation of lower_case_table_names parameters:
lower_case_table_names = 0 
Among them, 0: case-sensitive, 1: case-insensitive


ERROR 1045 (28000): Access denied for user 'ithomer'@'localhost' (using password: YES)

/etc/init.d/mysqld stop
mysqld_safe --skip-grant-tables &
mysql -u root
mysql> use mysql;

mysql> grant all privileges on . to "root"@"%" identified by "password" with grant option; flush privileges; # Add user

mysql> grant Select on your_dbname.* to "username"@"%" identified by "password" with grant option; flush privileges; # Assign read-only permissions (Select)
mysql> update user set password=PASSWORD("newrootpassword") where User='root'; flush privileges; # Modify password
mysql> quit
/etc/init.d/mysqld restart
/etc/init.d/mysqld stop
/etc/init.d/mysqld start

rpm installation

  1. Install command
    rpm -ivh filename.rpm
    Parameter explanation
  1. Upgrade command
    rpm -Uvh filename.rpm
    Parameter explanation

rzsz installation

ubuntu: sudo apt-get install lrzsz

centos: yum -y install lrzsz

hostname modification

Two things need to be modified:

1 ) Vim /etc/sysconfig/network modify HOSTNAME=your_hostname

2 ) Vim /etc/hosts modify 12.160.134.168 your_hostname

Python installation

1 ) Download Python, directly download Python-2.7.6.tar.xz

2 ) Install .tar.xz decompression tool: yum -y install xz

3 ) Unzip the .tar.xz file: unxz Python-2.7.6.tar.xz and tar xvf Python-2.7.6.tar

4 ) cd Python-2.7.6

5 ) ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"

make && make altinstall

pip install

1 ) wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py

2 ) python2.7 ez_setup.py

3 ) easy_install-2.7 pip

4 ) pip2.7 install [packagename]

pip2.7 install --upgrade [packagename]

pip2.7 uninstall [packagename]

LAMP configuration screenshot

Upgrade 3-httpd (apache server)

$ vi /etc/yum.repos.d/centalt.repo
[ CentALT]
name=CentALT Packages for Enterprise Linux 6 - basearch baseurl=http://centos.alt.ru/repository/centos/6/basearch/
enabled=1
gpgcheck=0

yum update httpd

Reference: Upgrade apache/httpd to 2.2.23 in CentOS

Install Git

The old version (1.7.1) is installed through the command yum install git

To install the latest git, the steps are as follows:

1 ) yum install perl-DBI -y

2 ) wget http://pkgs.repoforge.org/git/git-1.7.10-1.el6.rfx.x86_64.rpm

wget http://pkgs.repoforge.org/git/perl-Git-1.7.10-1.el6.rfx.x86_64.rpm

3 ) rpm -i git-1.7.10-1.el6.rfx.x86_64.rpm perl-Git-1.7.10-1.el6.rfx.x86_64.rpm

4 ) git --version

git version 1.7.10

Reference: Reference 1, Reference 2, github requires git version 1.7.6 or higher

Install Subversion

1 ) Install the client, command: yum install subversion

Install SVN server in Centos 6.x

Reference recommendation:

Linux installation configuration php

Ubuntu installation and configuration MySQL

CentOS 5.5 uses yum to install LAMP

Install Apache+PHP+MySQL under Win7

MySQL assign user permissions GRANT usage (recommended)

WordPress installation process

WordPress database and table structure

2 ) wget http://pkgs.repoforge.org/git/git-1.7.10-1.el6.rfx.x86_64.rpm

Recommended Posts

CentOS install PHP
Install php in centos
1.5 Install Centos7
CentOS 7 yum install PHP7.3 tutorial
Centos6 install Python2.7.13
Centos7.3 install nginx
CentOS7.2 install Mysql5.7.13
CentOS install Redmine
Centos7 install Python 3.6.
CentOS7 install MySQL
Centos7 install protobuf
CentOS 7 install Docker
CentOS 7 install Nginx, PHP, MySQL packages
CentOS7 install GlusterFS
CentOS 7.4 install Zabbix 3.4
CentOS7 install Docker
Centos6.5 install Tomcat
CentOS install Python 3.6
Vmware install CentOS6
centos7 install docker-ce 18.01.0
How to install PHP7.4 in CentOS
CentOS 7.2 install MariaDB
CentOS 7 install Hadoop 3.0.0
Centos 7.6 install seleniu
CentOS 7.3 install Zabbix3
CentOS install mysql
CENTOS6.5 install CDH5.12.1 (1)
CentOS6 install mist.io
Centos7 install Docker
CentOS7 install mysql
centOs install rabbitMQ
CentOS 7 install MySQL 5.6
Centos7 install Nginx
CentOS6.5 install CDH5.13
Centos7 install docker18
Centos install Python3
centos7 install docker
CentOS install jdk
centos7 install nginx-rtmp
CentOS8 install MySQL8.0
Centos6.3 install KVM
CentOS install PostgreSQL 9.1
CentOS7 install mysql8
CentOS 7 install Java 1.8
CentOS8 install fastdfs6.06
CentOS 7 install Gitlab
Centos 7 install PostgreSQL
CentOS7 install MySQL8
CentOS 7 install Java 1.8
Centos install php73 fast cgi + nginx
CentOS 6 install Docker
centos 6.5 install zabbix 4.4
Centos8 install Docker
CentOS6.8 install python2.7
CentOS install nodejs 8
How to install PHP on CentOS 8
CentOS6.5 install GNS3
centos 7.5 install mysql5.7.17
Centos7 install MySQL8.0-manual
CentOS7 install Kubernetes 1.16.3
VirtualBox install centos7