導航:首頁 > 程序命令 > linux命令行安裝php

linux命令行安裝php

發布時間:2024-08-27 22:25:03

linuxphp安裝目錄在哪

1、首先,連接相應linux主機,進入到linux命令行狀態下,等待輸入shell指令。

❷ 怎麼把php部署到apache伺服器上linux

要將 PHP 部署到 Apache 伺服器上,您需要執行以下步驟:
1.安裝 Apache web 伺服器:
在 Linux 終端中使用以下命令安裝 Apache web 伺服器:
sql
sudo apt-get update
sudo apt-get install apache2
2.安裝 PHP:
在 Linux 終端中使用以下命令安裝 PHP:
vbnet
sudo apt-get install php libapache2-mod-php
3.重啟 Apache 伺服器:
在 Linux 終端中使用以下命令重啟 Apache 伺服器:
sudo service apache2 restart
4.測試 PHP 安裝:
在您的網站根目錄中創建一頌蔽個名為 phpinfo.php 的文件,並將以下代碼復制並粘貼到文件中:
php
<?php
phpinfo();
?>
將文件保存到網站根目錄 /var/www/html 中。
現在,在您的 Web 瀏覽器中輸入以下地址:http://localhost/phpinfo.php,您將看到 PHP 安裝信息的頁面。
如果您看到一個頁面顯示 PHP 安裝信息,那培慧么您已經成功將 PHP 部署到 Apache 伺服器上。
注意:在生產環境中,應採取安全措施,如配置 PHP,以避免潛在的安全漏野中州洞。

❸ 怎麼在linux運行php文件

1、打開我們的linux命令行,准備好。

2、找到php的安裝目錄,主要是找到linux環境下,php可執行文件的目錄。如圖所示。筆者的目錄為/opt/lampp/bin/php,將此目錄記下,備用。

3、找到要運行的php文件所在的目錄,隨便寫點php代碼就可以,在此筆者已經准備好。/opt/lampp/htdocs/wechat/xjtest-web_browser/pcntl_test.php,將此目錄記下,接下來就要正式開始運行了。

4、打開剛剛第一步打開的linux命令行,輸入/opt/lampp/bin/php /opt/lampp/htdocs/wechat/xjtest-web_browser/pcntl_test.php(即依次輸入剛剛的兩個目錄)注意兩個目錄中間有空格。

5、按下回車,可以看到,php文件已經正確執行了。

❹ linuxphp網站怎麼安裝

配置php服務

安飢塌裝yasm匯編器(解壓編譯過程已省略):

[[email protected]]cd/usr/local/src

[root@linuxprobesrc]tarzxvfyasm-1.2.0.tar.gz

[root@linuxprobesrc]cdyasm-1.2.0

[[email protected]]./configure

[[email protected]]make

[[email protected]]makeinstall

安裝libmcrypt加密演算法擴展庫(解爛銀圓壓與編譯過程已省略):

[[email protected]]cd/usr/local/src

[root@linuxprobesrc]tarzxvflibmcrypt-2.5.8.tar.gz

[root@linuxprobesrc]cdlibmcrypt-2.5.8

[[email protected]]./configure

[[email protected]]make

[[email protected]]makeinstall

安裝libvpx視頻編碼器(解壓與編譯過程搏旦已省略):

[[email protected]]cd/usr/local/src

[root@linuxprobesrc]tarxjvflibvpx-v1.3.0.tar.bz2

[root@linuxprobesrc]cdlibvpx-v1.3.0

[[email protected]]./configure--prefix=/usr/local/libvpx--enable-shared--enable-vp9

[[email protected]]make

[[email protected]]makeinstall

安裝Tiff標簽圖像文件格式(解壓與編譯過程已省略):

[[email protected]]cd/usr/local/src

[root@linuxprobesrc]tarzxvftiff-4.0.3.tar.gz

[root@linuxprobesrc]cdtiff-4.0.3

[[email protected]]./configure--prefix=/usr/local/tiff--enable-shared

[[email protected]]make

[[email protected]]makeinstall

安裝libpng圖片(png格式)函數庫(解壓與編譯過程已省略):

[[email protected]]cd/usr/local/src

[root@linuxprobesrc]tarzxvflibpng-1.6.12.tar.gz

[root@linuxprobesrc]cdlibpng-1.6.12

[[email protected]]./configure--prefix=/usr/local/libpng--enable-shared

[[email protected]]make

[[email protected]]makeinstall

安裝freetype字體引擎(解壓與編譯過程已省略):

[[email protected]]cd/usr/local/src

[root@linuxprobesrc]tarzxvffreetype-2.5.3.tar.gz

[root@linuxprobesrc]cdfreetype-2.5.3

[[email protected]]./configure--prefix=/usr/local/freetype--enable-shared

[[email protected]]make

[[email protected]]makeinstall

安裝jpeg圖片(jpeg格式)函數庫(解壓與編譯過程已省略):

[[email protected]]cd/usr/local/src

[root@linuxprobesrc]tarzxvfjpegsrc.v9a.tar.gz

[root@linuxprobesrc]cdjpeg-9a

[root@linuxprobejpeg-9a]./configure--prefix=/usr/local/jpeg--enable-shared

[root@linuxprobejpeg-9a]make

[root@linuxprobejpeg-9a]makeinstall

安裝libgd圖像處理程序(解壓與編譯過程已省略):

[root@linuxprobejpeg-9a]cd/usr/local/src

[root@linuxprobesrc]tarzxvflibgd-2.1.0.tar.gz

[root@linuxprobesrc]cdlibgd-2.1.0

[[email protected]]./configure--prefix=/usr/local/libgd--enable-shared--with-jpeg=/usr/local/jpeg--with-png=/usr/local/libpng--with-freetype=/usr/local/freetype--with-fontconfig=/usr/local/freetype--with-xpm=/usr/--with-tiff=/usr/local/tiff--with-vpx=/usr/local/libvpx

[[email protected]]make

[[email protected]]makeinstall

安裝t1lib圖片生成函數庫(解壓與編譯過程已省略):

[[email protected]]cd/usr/local/src

[root@linuxprobesrc]tarzxvft1lib-5.1.2.tar.gz

[root@linuxprobesrc]cdt1lib-5.1.2

[[email protected]]./configure--prefix=/usr/local/t1lib--enable-shared

[[email protected]]make

[[email protected]]makeinstall

將函數庫文件放至合適的位置:

[[email protected]]cd/usr/local/src

[root@linuxprobesrc]ln-s/usr/lib64/libltdl.so/usr/lib/libltdl.so

[root@linuxprobesrc]cp-frp/usr/lib64/libXpm.so*/usr/lib/

安裝php服務程序(命令比較長,請一定要復制完整!!!):

[root@linuxprobesrc]tar-zvxfphp-5.5.14.tar.gz

[root@linuxprobesrc]cdphp-5.5.14

[[email protected]]exportLD_LIBRARY_PATH=/usr/local/libgd/lib

[[email protected]]./configure--prefix=/usr/local/php--with-config-file-path=/usr/local/php/etc--with-mysql=/usr/local/mysql--with-mysqli=/usr/local/mysql/bin/mysql_config--with-mysql-sock=/tmp/mysql.sock--with-pdo-mysql=/usr/local/mysql--with-gd--with-png-dir=/usr/local/libpng--with-jpeg-dir=/usr/local/jpeg--with-freetype-dir=/usr/local/freetype--with-xpm-dir=/usr/--with-vpx-dir=/usr/local/libvpx/--with-zlib-dir=/usr/local/zlib--with-t1lib=/usr/local/t1lib--with-iconv--enable-libxml--enable-xml--enable-bcmath--enable-shmop--enable-sysvsem--enable-inline-optimization--enable-opcache--enable-mbregex--enable-fpm--enable-mbstring--enable-ftp--enable-gd-native-ttf--with-openssl--enable-pcntl--enable-sockets--with-xmlrpc--enable-zip--enable-soap--without-pear--with-gettext--enable-session--with-mcrypt--with-curl--enable-ctype

[[email protected]]make

[[email protected]]makeinstall

復制php服務程序的配置文件到安裝目錄:

[[email protected]]cpphp.ini-proction/usr/local/php/etc/php.ini

刪除默認的php配置文件:

[[email protected]]rm-rf/etc/php.ini

創建php配置文件的軟連接到/etc/目錄中:

[[email protected]]cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf

[[email protected]]ln-s/usr/local/php/etc/php-fpm.conf/etc/php-fpm.conf

[[email protected]]ln-s/usr/local/php/etc/php.ini/etc/php.ini

編輯php服務程序的配置文件:

[[email protected]]vim/usr/local/php/etc/php-fpm.conf

//將第25行參數前面的分號去掉。

pid=run/php-fpm.pid

//修改第148和149行,將user與group修改為www。

user=www

group=www

添加php-fpm服務程序到開機啟動項:

[[email protected]]cpsapi/fpm/init.d.php-fpm/etc/rc.d/init.d/php-fpm

[[email protected]]chmod+x/etc/rc.d/init.d/php-fpm

[[email protected]]chkconfigphp-fpmon

為了保障網站的安全性,禁用掉不安全的功能:

[[email protected]]vim/usr/local/php/etc/php.ini

//修改第305行的disable_functions參數,追加參數為:

disable_functions=passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname

配置nginx服務程序支持php:

[[email protected]]vim/usr/local/nginx/conf/nginx.conf

//將第2行前面的號去掉並修改為userwwwwww;

//將第45行參數修改為indexindex.htmlindex.htmindex.php;

//將第65-71行前面的號去掉,修改為:

location~.php${

roothtml;

fastcgi_pass127.0.0.1:9000;

fastcgi_indexindex.php;

fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;

includefastcgi_params;

}

重啟nginx與php-fpm服務程序:

[[email protected]]systemctlrestartnginx

[[email protected]]systemctlrestartphp-fpm

閱讀全文

與linux命令行安裝php相關的資料

熱點內容
鏈接命令文件如何編寫 瀏覽:226
大學編程開綠燈 瀏覽:821
谷歌商店伺服器通信出現問題怎麼辦 瀏覽:590
安卓手機怎麼把錄的視頻裁剪 瀏覽:226
linux命令強制退出 瀏覽:77
videostation怎麼添加文件夾 瀏覽:184
pythonrawsocket 瀏覽:861
編譯原理計算思維能力 瀏覽:247
衛星加密技術的應用 瀏覽:901
怎麼看手機實用頻率高的app 瀏覽:72
c實現sha1演算法 瀏覽:784
h200cy1是多大壓縮機 瀏覽:62
hbase查看錶結構命令 瀏覽:861
怎麼將rar解壓成安裝包 瀏覽:29
程序員幾點開始學習 瀏覽:201
linux百度雲文件 瀏覽:398
下載軟體解壓到哪裡合適 瀏覽:264
百度智能雲演算法工程師 瀏覽:98
模鍛造pdf 瀏覽:212
dom編程api 瀏覽:58