centos7 Nginx1.14+php7+mysql5.7 以及 centos7 Apache2.4+PHP7+mysql 安裝 Linux 配置 composer 以及Python2.7升級到3.7
阿新 • • 發佈:2019-02-06
ack ria util oca 簡單 www. mbstring fig yum
1 centos7 Nginx1.14+php7.0+mysql5.7 (LNMP)安裝
nginx rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm yum install epel-release php rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm yum install php70w-fpm php70w-cli php70w-gdphp70w-mysql php70w-pear php70w-xml php70w-mbstring php70w-pdo php70w-json php70w-pecl-apcu php70w-pecl-apcu-devel mysql rpm -Uvh http://repo.mysql.com/mysql57-community-release-el7-7.noarch.rpm yum install mysql-server mysql-devel mysql 外部登錄 grep ‘temporary password‘ /var/log/mysqld.log mysql_secure_installation grant all privileges on *.* to 創建的用戶名 @"%" identified by "密碼"; flush privileges; 配置 /etc/php-fpm/www.config /etc/nginx/conf.d default.conf server { listen 80; fastcgi_buffers 16 16k; fastcgi_buffer_size 32k; server_name test1.loc www.test1.loc; error_log /var/log/default_error.log; root /usr/share/nginx/html; index index.php index.html index.htm; location ~ \.php$ { #fastcgi_pass unix:/var/run/php-fpm.sock; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } systemctl restart nginx.service systemctl enablenginx.service systemctl enable php-fpm.service systemctl start php-fpm.service service mysqld start service mysqld stop
說說配置lnmp遇到的坑 測試時一定要使用<?php?>這樣的PHP標記 fastcgi默認是不能解析<??>這樣的PHP代碼標記的 更別說 <% %>這樣以及其他的
為了這個問題苦惱了兩天,國內外的論壇·博客翻爛了沒找到解決辦法
這就是代碼規範的 重要性
2 centos7 +PHP7.2+Apache2.4+mysql (lamp)簡單配置
mysql rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY* yum -y install epel-release 安裝release yum -y install mariadb-server mariadb 安裝mysql systemctl start mariadb.service 開啟服務 systemctl enable mariadb.service 添加到開機啟動 mysql_secure_installation mysql重置命令 Apache yum -y install httpd systemctl start httpd.service systemctl enable httpd.service php rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm yum -y install yum-utils yum-config-manager utility 7.0 yum-config-manager --enable remi-php70 yum -y install php php-opcache 7.1 yum-config-manager --enable remi-php71 yum -y install php php-opcache 7.2 yum-config-manager --enable remi-php72 yum -y install php php-opcache 測試 ystemctl restart httpd.service vi /var/www/html/info.php <?php phpinfo(); 安裝PHP模塊 yum -y install php-mysqlnd php-pdo yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel systemctl restart httpd.service
3Linux操作系統下composer安裝 前提 安裝PHP並且啟動PHP服務
curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer chmod -R 777 /usr/local/bin/composer
4 centos 下Python2.7 升級到Python3.7
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz 下載壓縮包 tar -zxvf Python-3.7.0.tgz 解壓 cd Python-3.7.0/ 進入目錄 ./configure 對安裝軟件進行配置 如果出錯 先安裝GCC yum install make gcc gcc-c++ ./configure make & make install 編輯以及編譯安裝 順帶一提安裝模塊提示pip: command not found以下如何解決 wget https://bootstrap.pypa.io/get-pip.py python get-pip.py python -v
centos7 Nginx1.14+php7+mysql5.7 以及 centos7 Apache2.4+PHP7+mysql 安裝 Linux 配置 composer 以及Python2.7升級到3.7