导航:首页 > 程序命令 > 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相关的资料

热点内容
单片机寄存器地址 浏览:396
七猫免费小说缓存加密 浏览:29
天津保税仓有溯源码 浏览:332
安卓9开发版什么时候推送 浏览:61
程序员可以天天加班吗 浏览:499
垃圾压缩车品牌 浏览:555
自制搜索引擎pdf 浏览:76
触漫安卓手机怎么登苹果的号 浏览:320
银行app怎么收信用卡的钱 浏览:288
java十进制转十六进制算法 浏览:920
pos刷卡需要app认证怎么弄 浏览:252
快速配IP命令 浏览:829
小程序后台源码导入 浏览:920
苹果手机app上的未读怎么取消 浏览:514
蜻蜓fm导出文件夹 浏览:514
我的世界怎么弄人家的服务器 浏览:361
pm编程软件是什么 浏览:318
移动硬盘有一个文件夹没有了 浏览:42
安卓字体怎么覆盖 浏览:558
汇川触摸屏编程手册 浏览:827