Installing PHP

Yum is only installed in version 5.1, so install manually

  1. Baidu cloud download phP-5.6.16.tar. gz: pan.baidu.com/s/1eSxfhXg
  2. The tar XZVF PHP - 5.6.16. Tar. Gz
  3. The installationlibxml2 : yum install libxml2-devel
  4. The installationbzip2: yum install bzip2 bzip2-devel
  5. The installationcurl: yum -y install curl-devel
  6. The installationlibpng :yum install libpng libpng-devel
  7. The installationlibmcrypt:yum install libmcrypt libmcrypt-devel
  8. The installationreadline: yum -y install readline readline-devel
  9. Perform the following configuration
     ./configure --prefix=/usr/local/php --with-config-file-path=/etc --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-opcache --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-gettext --enable-mbstring --with-iconv --with-mcrypt --with-mhash --with-openssl --enable-bcmath --enable-soap --enable-pcntl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-sockets --with-curl --with-zlib --enable-zip --with-bz2 --with-readline --without-sqlite3 --without-pdo-sqlite --with-pear --with-gd
    Copy the code
  10. Copy the PHP – FPM. Conf
    - 5.6.28 cp/opt/lib/PHP/sapi/FPM/PHP - FPM. Conf/usr /local/php/etc/php-fpm.conf
    Copy the code
  11. Php-fpm is started globally
     cp /usr/local/php/sbin/php-fpm /usr/local/bin/php-fpm
    Copy the code

12. Start the PHP – FPM

13. New index. PHP

   
      
   phpinfo();
Copy the code

14. Successful

Install nginx

  1. Yum install yum -y install nginx

  2. Delete all files in /etc/nginx/conf.d

  3. Configure your own service vim mysite.conf

    server {
        charset utf-8; client_max_body_size 128M; listen 80; server_name www.wexue.top; root /opt/server/gmfitness-wx; index index.php index.html; access_log /opt/log/access.log; error_log /opt/log/error.log; location / { # Redirect everything that isn't a real file to index.php try_files $uri $uri/ /index.php$is_args$args; } # forward location /wxnotify {proxy_pass HTTP://XXXXX/index.php? g=Restful&m=Vip&a=wxnotify; }# uncomment to avoid processing of calls to non-existing static files by Yii
        #location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
        # try_files $uri =404;
        #}
        #error_page 404 /404.html;
    
        location ~ \.php$ {
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_pass   127.0.0.1:9000;
            #fastcgi_pass unix:/var/run/php5-fpm.sock;try_files $uri =404; } location ~ /\.(ht|svn|git) { deny all; }}Copy the code
  4. Nginx: yum automatically installs nginx service, service nginx start

Mysql installation

  1. Yum install
     yum -y install mysql-server mysql mysql-devel
     service mysqld start
    Copy the code
  2. Powered up
    chkconfig mysqld on
    chkconfig --list | grep mysql
    Copy the code
  3. password
     mysqladmin -u root password 'password'
    Copy the code
  4. Set full network accessmysql -uroot -p
    • Input:use mysql;
    • To query host:select user,host from user;
    • Create host (skip this step if “%” host is present)
    • If there is no host value “%”, execute the following two statements:
      mysql> update user set host=The '%' where user='root';
      mysql> flush privileges;
      Copy the code
    • Authorized users
      • Any host can connect to the mysql server as user root and password PWD
      • The host whose IP address is 192.168.1.100, for example, is connected to the mysql server as user tuser and password TPWD
      mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@The '%' IDENTIFIED BY 'password' WITH GRANT OPTION;
      mysql> flush privileges;
      
      mysql> GRANT ALL PRIVILEGES ON *.* TO 'tuser'@'192.168.1.100' IDENTIFIED BY 'password' WITH GRANT OPTION; 
      mysql> flush privileges;
      Copy the code