使用Ansible安裝部署nginx+php+mysql之安裝php(2)

2、使用Ansible安裝phpphp

一、php.yaml文件內容html

 1 - hosts: clong  2  remote_user: root  3  gather_facts: no  4  tasks:  5  # 安裝libselinux-python  6  - name: isntall libselinux-python  7  yum: name=libselinux-python state=present  8  # 安裝epel源  9  - name: install epel-release repo 10  yum: name=epel-release state=present 11  # 安裝rpm包 12  - name: install remote php rpm 13  yum: name=http://rpms.famillecollet.com/enterprise/remi-release-7.rpm state=present 14  # 安裝php5.6 15  - name: install php 16  yum: name={{ item }} state=present enablerepo=remi enablerepo=remi-php56 17  with_items: 18  - php 19  - php-opcache 20  - php-devel 21  - php-mbstring 22  - php-mcrypt 23  - php-mysqlnd 24  - php-phpunit-PHPUnit 25  - php-pecl-xdebug 26  - php-pecl-xhprof 27  - php-mysql 28  - php-pecl-apcu 29  - php-pdo 30  - php-pear 31  - php-fpm 32  - php-cli 33  - php-xml 34  - php-bcmath 35  - php-process 36  - php-gd 37  - php-common 38  - php-json 39  - php-pdo_dblib 40  - php-pgsql 41  - php-recode 42  - php-snmp 43  - php-soap 44  - php-pecl-zip 45  - libjpeg* 46  - php-imap 47  - php-ldap 48  - php-odbc 49  - php-xmlrpc 50  - php-mbstring 51  - php-bcmath 52  - php-mhash 53  - libmcrypt 54  - libmcrypt-devel 55  # 開啓php-fpm 56  - name: start php-fpm 57  service: name=php-fpm state=started enabled=yes 58  # 複製index.php文件到網站根目錄 59  - name: copy index.php 60  copy: src=index.php dest=/usr/share/nginx/html/index.php 61  notify: restart nginx 62  # 重啓nginx 63  handlers: 64  - name: restart nginx 65       service: name=nginx state=restarted

二、index.php文件python

1 <?php 2  echo phpinfo(); 3 ?>    

 注:安裝的php版本查看mysql

#php -vlinux

PHP 5.6.31 (cli) (built: Jul  6 2017 08:06:11)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethansnginx

相關文章
相關標籤/搜索