centos7發布php網站(centos7 php74)

本文目錄一覽:

阿里雲默認centos7上怎麼安裝php

首先更新系統軟體/str

$ yum update

安裝nginx/str/str

1.安裝nginx源

$ yum localinstall .安裝nginx

$ yum install nginx

3.啟動nginx

$ service nginx start

Redirecting to /bin/systemctl start nginx.service4.訪問http://你的ip/

如果成功安裝會出來nginx默認的歡迎界面

安裝MySQL5.7.*

/str

1.安裝mysql源/str

$ yum localinstall .安裝mysql

$ yum install mysql-community-server

確認一下mysql的版本,有時可能會提示mysql5.63.安裝mysql的開發包,以後會有用

$ yum install mysql-community-devel

4.啟動mysql

$ service mysqld start

Redirecting to /bin/systemctl start mysqld.service5.查看mysql啟動狀態

$ service mysqld status

出現pid

證明啟動成功

6.獲取mysql默認生成的密碼

$ grep ‘temporary password’ /var/log/mysqld.log2015-12-05T05:41:09.104758Z 1 [Note] A temporary password is generated for root@localhost: %G1Rgns!dD!v/str

加粗的就是生成的密碼

7.換成自己的密碼

$ mysql -uroot -p

Enter password:輸入上面的密碼

成功輸入後進入一下步,這裡你估計會輸入 好幾次才進去8. 更換密碼

mysql ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘MyNewPass4!’;這個密碼一定要足夠複雜,不然會不讓你改,提示密碼不合法;9.退出mysql;

mysql quit;

10.用新密碼再登錄,試一下新密碼

$ mysql -uroot -p

Enter password:輸入你的新密碼

11.確認密碼正確後,退出mysql;

mysql quit;

編譯安裝php7.0.0

/str

/str

1.下載php7源碼包/str

$ cd /root wget -O php7.tar.gz .解壓源碼包/str

$ tar -xvf php7.tar.gz

3./str

$ cd php-7.0.1

4.安裝php依賴包/str

/str

$ yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel5.編譯配置,這一步我們會遇到很多configure error,我們一一解決,基本都是相關軟體開發包沒有安裝導致/str

/str

$ ./configure \

–prefix=/usr/local/php \

–with-config-file-path=/etc \

–enable-fpm \

–with-fpm-user=nginx \

–with-fpm-group=nginx \

–enable-inline-optimization \

–disable-debug \

–disable-rpath \

–enable-shared \

–enable-soap \

–with-libxml-dir \

–with-xmlrpc \

–with-openssl \

–with-mcrypt \

–with-mhash \

–with-pcre-regex \

–with-sqlite3 \

–with-zlib \

–enable-bcmath \

–with-iconv \

–with-bz2 \

–enable-calendar \

–with-curl \

–with-cdb \

–enable-dom \

–enable-exif \

–enable-fileinfo \

–enable-filter \

–with-pcre-dir \

–enable-ftp \

–with-gd \

–with-openssl-dir \

–with-jpeg-dir \

–with-png-dir \

–with-zlib-dir \

–with-freetype-dir \

–enable-gd-native-ttf \

–enable-gd-jis-conv \

–with-gettext \

–with-gmp \

–with-mhash \

–enable-json \

–enable-mbstring \

–enable-mbregex \

–enable-mbregex-backtrack \

–with-libmbfl \

–with-onig \

–enable-pdo \

–with-mysqli=mysqlnd \

–with-pdo-mysql=mysqlnd \

–with-zlib-dir \

–with-pdo-sqlite \

–with-readline \

–enable-session \

–enable-shmop \

–enable-simplexml \

–enable-sockets \

–enable-sysvmsg \

–enable-sysvsem \

–enable-sysvshm \

–enable-wddx \

–with-libxml-dir \

–with-xsl \

–enable-zip \

–enable-mysqlnd-compression-support \

–with-pear \

–enable-opcache

configure error:

1.configure: error: xml2-config not found. Please check your libxml2 installation.

解決:

$ yum install libxml2 libxml2-devel

2.configure: error: Cannot find OpenSSL’s evp.h

解決:

$ yum install openssl openssl-devel

3.configure: error: Please reinstall the BZip2 distribution解決:

$ yum install bzip2 bzip2-devel

4.configure: error: Please reinstall the libcurl distribution – easy.h should be in curl-dir/include/curl/解決:

$ yum install libcurl libcurl-devel

5.If configure fails try –with-webp-dir=DIR configure: error: jpeglib.h not found.

解決:

$ yum install libjpeg libjpeg-devel

6.If configure fails try –with-webp-dir=DIR

checking for jpeg_read_header in -ljpeg… yesconfigure: error: png.h not found.

解決:

$ yum install libpng libpng-devel

7.If configure fails try –with-webp-dir=DIR

checking for jpeg_read_header in -ljpeg… yeschecking for png_write_image in -lpng… yesIf configure fails try –with-xpm-dir=DIR

configure: error: freetype-config not found.

解決:

$ yum install freetype freetype-devel

8.configure: error: Unable to locate gmp.h解決:

$ yum install gmp gmp-devel

9.configure: error: mcrypt.h not found. Please reinstall libmcrypt.

解決:

$ yum install libmcrypt libmcrypt-devel

10.configure: error: Please reinstall readline – I cannot find readline.h解決:

$ yum install readline readline-devel

11.configure: error: xslt-config not found. Please reinstall the libxslt = 1.1.0 distribution解決:

$ yum install libxslt libxslt-devel

6.編譯與安裝

$ make make install

這裡要make好久,要耐心一下

7.添加 PHP 命令到環境變數

$ vim /etc/profile

在末尾加入

PATH=$PATH:/usr/local/php/bin

export PATH

要使改動立即生效執行

$ ./etc/profile

$ source /etc/profile

查看環境變數

$ echo $PATH

查看php版本

$ php -v

8.配置php-fpm

$ cp php.ini-production /etc/php.ini

$ cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf$ cp /usr/local/php/etc/php-fpm.d/ /usr/local/php/etc/php-fpm.d/ cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm$ chmod +x /etc/init.d/php-fpm

9.啟動php-fpm

$ /etc/init.d/php-fpm start

配置nginx虛擬機,綁定域名/str

1.

/str

$ vim /etc/nginx/conf.d/php7.thinkcmf.com.conf這裡可以把php7.thinkcmf.com.conf改成自己的域名把下面的內容複製到php7.thinkcmf.com.conf里server{

listen 80;

server_name php7.thinkcmf.com;

root /var/www/html/php7.thinkcmf.com; # 該項要修改為你準備存放相關網頁的路徑location / {

index index.php index.html index.htm;

#如果請求既不是一個文件,也不是一個目錄,則執行一下重寫規則if (!-e $request_filename)

{

#地址作為將參數rewrite到index.php上。

rewrite ^/(.*)$ /index.php/$1;

#若是子目錄則使用下面這句,將subdir改成目錄名稱即可。

#rewrite ^/subdir/(.*)$ /subdir/index.php/$1;}

}

#proxy the php scripts to php-fpm

location ~ \.php {

include fastcgi_params;

##pathinfo支持start

#定義變數 $path_info ,用於存放pathinfo信息set $path_info “”;

#定義變數 $real_script_name,用於存放真實地址set $real_script_name $fastcgi_script_name;#如果地址與引號內的正則表達式匹配

if ($fastcgi_script_name ~ “^(.+?\.php)(/.+)$”) {#將文件地址賦值給變數 $real_script_name

set $real_script_name $1;

#將文件地址後的參數賦值給變數 $path_info

set $path_info $2;

}

#配置fastcgi的一些參數

fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;fastcgi_param SCRIPT_NAME $real_script_name;fastcgi_param PATH_INFO $path_info;

###pathinfo支持end

fastcgi_intercept_errors on;

fastcgi_pass 127.0.0.1:9000;

}

}

2.重啟nginx

$ service nginx reload

3.

$ vim /var/www/html/php7.thinkcmf.com/index.php/str

把下面的代碼複製到這個文件 里

?php

phpinfo();

4.查看訪問

linuxcentos7中怎麼搭建php伺服器

centos7建立伺服器 Centos 7 中 :裝jdk+Tomcat+mysql+php+phpAdmin 伺服器這樣呢,希望能幫到你,如果還有不明白的話,你可以在後盾人看看視頻找找答案,有空多看看時間長了,慢慢就明白了,希望能幫到你,給個採納吧謝謝♫ヽ(゜∇゜ヽ)♪

如何在centos7搭建web伺服器

首先,需要在centos7上面配置網站所需要的環境。

如果說你不會配置網站環境,那可以安裝webmin、kloxo、cp等面板來使用。

因為這樣的面板在配置好之後都是配置好網站所需要的阿帕奇、mysql等環境的。

centos7部署php網站需要什麼步驟

1、搭建LAMP (apache+mysql+PHP)環境,即安裝與配置

2、安裝vsftpd服務,以用於FTP上傳與下載

如何在阿里雲Centos7伺服器下安裝部署Nginx+PHP+Mysql+PHP擴展

1、典型的LNMP安裝問題

2、首先你得準備編譯環境

yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers bison lynx

3、下載所需MySQL/nginx/php等安裝包

4、安裝nginx和mysql沒有先後順序

5、安裝php依賴包,安裝php,安裝php擴展及優化包

6、詳細的安裝步驟可以網上查LNMP安裝步驟

原創文章,作者:小藍,如若轉載,請註明出處:https://www.506064.com/zh-tw/n/270792.html

(0)
打賞 微信掃一掃 微信掃一掃 支付寶掃一掃 支付寶掃一掃
小藍的頭像小藍
上一篇 2024-12-16 13:38
下一篇 2024-12-16 13:38

相關推薦

  • PHP和Python哪個好找工作?

    PHP和Python都是非常流行的編程語言,它們被廣泛應用於不同領域的開發中。但是,在考慮擇業方向的時候,很多人都會有一個問題:PHP和Python哪個好找工作?這篇文章將從多個方…

    編程 2025-04-29
  • Python爬蟲可以爬哪些網站

    Python是被廣泛運用於數據處理和分析領域的編程語言之一。它具有易用性、靈活性和成本效益高等特點,因此越來越多的人開始使用它進行網站爬取。本文將從多個方面詳細闡述,Python爬…

    編程 2025-04-29
  • 網站為什麼會被黑客攻擊?

    黑客攻擊是指利用計算機技術手段,入侵或者破壞計算機信息系統的一種行為。網站被黑客攻擊是常見的安全隱患之一,那麼,為什麼網站會被黑客攻擊呢?本文將從不同角度分析這個問題,並且提出相應…

    編程 2025-04-29
  • PHP怎麼接幣

    想要在自己的網站或應用中接受比特幣等加密貨幣的支付,就需要對該加密貨幣擁有一定的了解,並使用對應的API進行開發。本文將從多個方面詳細闡述如何使用PHP接受加密貨幣的支付。 一、環…

    編程 2025-04-29
  • 如何用Python訪問網站

    本文將從以下幾個方面介紹如何使用Python訪問網站:網路請求、POST請求、用戶代理、Cookie、代理IP、API請求。 一、網路請求 Python有三種主流的網路請求庫:ur…

    編程 2025-04-29
  • 如何將Python開發的網站變成APP

    要將Python開發的網站變成APP,可以通過Python的Web框架或者APP框架,將網站封裝為APP的形式。常見的方法有: 一、使用Python的Web框架Django Dja…

    編程 2025-04-28
  • 如何在伺服器上運行網站

    想要在伺服器上運行網站,需要按照以下步驟進行配置和部署。 一、選擇伺服器和域名 想要在伺服器上運行網站,首先需要選擇一台雲伺服器或者自己搭建的伺服器。雲伺服器會提供更好的穩定性和可…

    編程 2025-04-28
  • 使用PHP foreach遍歷有相同屬性的值

    本篇文章將介紹如何使用PHP foreach遍歷具有相同屬性的值,並給出相應的代碼示例。 一、基礎概念 在講解如何使用PHP foreach遍歷有相同屬性的值之前,我們需要先了解幾…

    編程 2025-04-28
  • Python網站源碼解析

    本文將從多個方面對Python網站源碼進行詳細解析,包括搭建網站、數據處理、安全性等內容。 一、搭建網站 Python是一種高級編程語言,適用於多種領域。它也可以用於搭建網站。最常…

    編程 2025-04-28
  • PHP獲取301跳轉後的地址

    本文將為大家介紹如何使用PHP獲取301跳轉後的地址。301重定向是什麼呢?當我們訪問一個網頁A,但是它已經被遷移到了另一個地址B,此時若伺服器端做了301重定向,那麼你的瀏覽器在…

    編程 2025-04-27

發表回復

登錄後才能評論