Category: OS

Centos 7 , php 5.6 , mysql, vagrant

[root@localhost ~]# history
1  yum install httpd
2  yum search php
3  sudo apachectl restart
4  yum install php56w
5  yum install php56u
6  rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
7  rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
8  yum -y install php56w php56w-opcache
9  yum -y install php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mys                                                                                                                ql php56w-intl php56w-mbstring
10  sudo apachectl restart
11  php -v
12  httpd -v
13  exit
14  cd /home
15  cd/Demo
16  cd Demo
17  ls
18  chmod 644 index.php
19  sudo apachectl restart
20  nano /etc/sysconfig/selinux
21  vim /etc/sysconfig/selinux
22  vi /etc/sysconfig/selinux
23  sestatus
24  setenforce 0
25  sudo apachectl restart
26  exit
27  mysql -v
28  yum remove php56w-mysql
29  yum remove php56w-mysqlnd
30  yum remove php5-mysqlnd
31  yum install php-mysqlnd
32  yum remove php-common
33  yum install php-mysqlnd
34  apachectl restart
35  php -v
36  sudo php -v
37  yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd p                                                                                                                hp56w-devel php56w-intl php56w-mbstring
38  yum remove php
39  yum remove php-mysqlnd
40  yum remove php-common
41  yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd p                                                                                                                hp56w-devel php56w-intl php56w-mbstring
42  y
43  apachectl restart
44  php -v
45  mysql -v
46  yum install php56-mysql
47  yum install php56w-mysql
48  yum install php56w-mysqlnd
49  apachectl restart
50  pecl install xdebug
51  yum install pecl
52  yum install php54w-pear
53  yum install php56w-pear
54  yum install gcc gcc-c++ autoconf automake
55  pecl install Xdebug
56  apachectl restart
57  yum install java-1.7.0-openjdk
58  yum remove java-1.7.0-openjdk
59  apachectl stop
60  exit
61  apachectl restart
62  getenforce
63  setenforce 0
64  getenforce
65  yum -y install mysql-community-server
66  rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rp                                                                                                                m
67  yum -y install mysql-community-server
68  /usr/bin/systemctl enable mysqld
69  /usr/bin/systemctl start mysqld
70  service mysqld restart
71  /usr/bin/mysql_secure_installation
72  firewall-cmd  –reload
73  mysql -u root -p root
74  mysql -u root -p mysql
75  service mysqld restart
76  apachectl restart
77  install php5-mysqlnd
78  yum install php5-mysqlnd
79  yum install php56w-mysqlnd
80  yum install php56w-mysqlnd56
81  yum install php-mysqlnd
82  php -m | grep -i php
83  php -i | grep “php”
84  yum info php-fpm
85  yum info php-
86  yum search php
87  yum search php54w
88  yum install php56w-mysqlnd
89  yum install php56w-mysqlnd –skip-broken
90  apachectl restart
91  yum install php-mysqlnd-5.4.16-23.el7_0.3.x86_64
92  yum install php-mysqlnd-5.6.16-23.el7_0.3.x86_64
93  yum install php56w-mysqlnd-5.6.16-23.el7_0.3.x86_64
94  mysql -v
95  su root
96  exit
97  su root
98  exit
99  history

http://www.techoism.com/how-to-upgrade-php-version-5-4-to-5-6-on-centosrhel/

The PHP Development Team reports the quick accessibility of PHP 5.6.0. This new version accompanies new features, some backward incompatible changes and many enhancements.

logo-php56

Main features include in PHP 5.6.0 :

 

  • Constant scalar expressions.
  • Exponentiation utilizing the ** operator.
  • Function and constant importing with the utilization decisive word.
  • phpdbg as an intuitive coordinated debugger SAPI.
  • GMP questions now bolster operator over-burdening.
  • Document transfers bigger than 2 gigabytes in size are presently acknowledged.
  • First we need to check the current version of PHP. To check the versio of PHP run following command:
    # php -v
    
    PHP 5.4.35 (cli) (built: Nov 14 2014 07:04:10)
    Copyright (c) 1997-2014 The PHP Group
    Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
        with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies
    
  • To upgrade php, first you must include the Webtatic EL yum repository data relating to your CentOS/RHEL variant to yum:For CentOS/RHEL 7:
    # rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
    # rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
    

    For CentOS/RHEL 6:

    # rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
    
  • After installing Webtatic yum repository, you have to remove the old version of php-common package. It will also delete it dependencies packages.
    # yum remove php-common
    

    Sample Output:

    Dependencies Resolved
    
    ===================================================================================
     Package             Arch          Version                      Repository    Size
    ===================================================================================
    Removing:
     php-common          x86_64        5.4.39-1.el6.remi            @remi        7.0 M
    Removing for dependencies:
     php                 x86_64        5.4.39-1.el6.remi            @remi        9.1 M
     php-cli             x86_64        5.4.39-1.el6.remi            @remi         12 M
     php-devel           x86_64        5.4.39-1.el6.remi            @remi        8.1 M
     php-gd              x86_64        5.4.39-1.el6.remi            @remi        665 k
     php-ldap            x86_64        5.4.39-1.el6.remi            @remi        119 k
     php-mbstring        x86_64        5.4.39-1.el6.remi            @remi        2.5 M
     php-mcrypt          x86_64        5.4.39-1.el6.remi            @remi         86 k
     php-mysql           x86_64        5.4.39-1.el6.remi            @remi        452 k
     php-pdo             x86_64        5.4.39-1.el6.remi            @remi        348 k
     php-pear            noarch        1:1.9.5-9.el6.remi           @remi        2.0 M
     php-process         x86_64        5.4.39-1.el6.remi            @remi        128 k
     php-snmp            x86_64        5.4.39-1.el6.remi            @remi        107 k
     php-xml             x86_64        5.4.39-1.el6.remi            @remi        626 k
    
    Transaction Summary
    ===================================================================================
    Remove       14 Package(s)
    
    Installed size: 43 M
    
  • Now we install PHP 5.5 using following command:
    # yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring
    
  • After installing PHP 5.6, we need to restart Apache service.
    # /etc/init.d/httpd restart
    
    # php -v
    
    PHP 5.6.8 (cli) (built: Apr 17 2015 22:49:36)
    Copyright (c) 1997-2015 The PHP Group
    Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
        with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies
    

 

How to upgrade PHP version 5.4 to 5.5 on CentOS/RHEL

Create user and enable remote Mysql

1) log-in your mysql via terminal as “root” –> mysql -uroot -p
2) CREATE USER ‘gioinv’@’%’ IDENTIFIED BY ‘your-password’ ;

3)

mysql> GRANT ALL ON database.* TO user@'10.10.0.2' IDENTIFIED BY 'user-password-here';
mysql> FLUSH PRIVILEGES;
(IP can be replaced with % to allow this user to logon from any host or IP.)

If connection still fails, check “bind-address” option in /etc/my.cnf file.

bind-address option is IP address to bind to.

4: /etc/my.cnf file

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
bind-address=192.168.33.10
port = 3306
# skip-networking

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

 

FTP vagrant

Make sure your vagrant vm is running. Then:

vagrant ssh
sudo apt-get install vsftpd

Edit the ftp config file to enable authenticated users to ftp:

sudo nano /etc/vsftpd.conf

Then uncomment the following lines:

local_enable=YES
write_enable=YES

Save the file. (Control-x, y, return) Restart ftp with:

sudo /etc/init.d/vsftpd restart

After this, you should be able to install modules from the modules page. Login with “vagrant” for the username and password if/when asked.

Obviously, it’d be best if we didn’t have to do this.

 

https://www.liquidweb.com/kb/how-to-install-and-configure-vsftpd-on-centos-7/

 

Neu ko tao file dc thì:

If you don’t want to go further with your SELinux do not change it, so you will see as default /etc/selinux/config

SELINUX=enforcing

then just run the commands as root or with sudo:

sudo setsebool -P ftpd_anon_write 1
sudo setsebool -P ftpd_full_access 1