当前位置:首页 » 编程语言 » linuxcentos安装php

linuxcentos安装php

发布时间: 2022-08-20 15:35:09

‘壹’ 服务器上怎么安装php程序

你好,如果你的服务器是Windows系统,那么你需要远程到你的服务器,进行启动IIS(asp环境),如果你需要php环境,你可以从xp.cn(小皮)或者bt.cn(宝塔)安装面板
如果你的服务器是linux,建议使用宝塔
打开终端,不同Linux系统的输入指令不同:
Centos安装脚本
终端输入:yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh
Ubuntu/Deepin安装脚本
终端输入:wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh
Debian安装脚本
终端输入:wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && bash install.sh
Fedora安装脚本
终端输入wget -O install.sh http://download.bt.cn/install/install_6.0.sh && bash install.sh
输入后进行安装就可以了

‘贰’ Linux CentOS下编译安装PHP5.3.x卡在Generating phar.php

压缩
a) 下载的php压缩包,并进入解压后目录内运行如下命令:
b) ./configure--prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs--with-config-file-path=/usr/local/lib --enable-track-vars --with-xml
c) make
d) make install

一共就这么四个步骤,要不你重新来吧
看你那屏幕截图,貌似是乱码的赶脚,是不是环境比那辆没有设置正确

‘叁’ centos6 最完整安装php方法~呢

  1. 安装必要依赖。这一步较繁杂而且涉及更多linux方面的知识。我想偷懒因此用yum

    yum installlibxml2-devel

    yum installinstallopensslopenssl-devel

    yum installcurl-devellibjpeg-devellibpnglibpng-devel

    yum installfreetype-devellibmcrypt-devel

  2. php官网找一个php来下载,假设链接就是url

    cd (你的下载目录)

    wgeturl

    解压

    ./configure --prefix=(你的安装目录)

    cd (你的安装目录)

    make && make install && cd ..

  3. 增加环境变量

    vim /etc/profile

    export PATH=$PATH:(你的安装目录)bin/

    source /etc/profile

‘肆’ 如何在Centos的linux操作系统安装php的memcache扩展

准备工作:
1、一台linux的服务器

2、下载相应版本的php源码,知道自己php的版本并且知道phpize的位置

3、懂基本的linux解压命令和编译
操作步骤:
1、通过ssh登陆到我们的服务器,找到我们的phpize位置,如果不知道下载跟目前使用版本相同的php源码重新编译一下
2、下载memcached的源码包,并解压安装

wgettar -zxvf memcache-3.0.8.tgz #解压cd memcache-3.0.8 #进入源码包/usr/local/php/bin/phpize #执行phpize./configure --with-php-config=/usr/local/php/php-config #准备编译make && make install #编译安装

3、配置php.ini文件在最后面添加扩展进去

vim /etc/php.iniextension=memcache.so

4、重启web服务器,我用的是apache

service httpd restart

5、编写一个phpinfo文件去查看有没有安装成功

‘伍’ 如何在centos7上安装php

您好,安装PHP的方式可以一步一步的按照教程去安装,这个可以到网上搜一搜,因为步骤太多,我就不复制粘贴了。但是我这里最推荐的就是使用phpstudy一键安装,没错,就是在Linux上一键安装,可以去试一试。

黑马程序员的PHP是国内最早开设的真正人工智能课程。课程全面系统,紧跟时代潮流。

‘陆’ linuxcentos7中怎么搭建php服务器

linuxcentos7中搭建php服务器方法详见:http://jingyan..com/article/76a7e409f8e670fc3b6e15c9.html

‘柒’ centos 如何检测php安装

需要准备的材料分别是:电脑、centos主机,linux连接工具。

1、首先连接上centos主机,进入等待输入指令的linux命令行状态。

‘捌’ linux centos 7 下用yum 安装iso镜像里自带的php5.4.16版本的但是没有php-fqm文件不知道怎么重启php服务

systemctl restart php-fpm.service #这条命令是重启php服务
下面是一个比较靠谱的php安装步骤:
先删除已有的php版本 ,执行下面的命令删除php
yum remove php-common
然后像安装那样问你是否继续的,输入yes即可

添加 yum 源
CentOS 6.x 的源
# rpm -Uvh http://download.Fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

安装 PHP
# yum install --enablerepo=remi,remi-php56 php php-opcache php-pecl-apcu php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof php-pdo php-pear php-fpm php-cli php-xml php-bcmath php-process php-gd php-common
注:安装5.6版本为remi-php56,安装5.5版本为remi-php55

‘玖’ 如何在CentOS 7.3上安装Apache,PHP 7.1和M6767ySQL

1初步说明

在本教程中,我使用IP地址为192.168.1.100的hostname server1.example.com 。 这些设置可能会有所不同,因此您必须在适当的情况下更换它们。

我会在这里添加EPEL repo来安装最新的phpMyAdmin,如下所示:

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
yum -y install epel-release

要在shell上编辑文件,我将安装nano编辑器。 如果您喜欢vi进行文件编辑,请跳过此步骤。

yum -y install nano

2安装MySQL / MariaDB

MariaDB是原始MySQL开发人员Monty Widenius的MySQL分支。 MariaDB与MySQL兼容,我选择使用MariaDB而不是MySQL。 运行此命令以安装MariaDB:

yum -y install mariadb-server mariadb

然后,我们为MySQL创建系统启动链接(以便每当系统启动时,MySQL自动启动)并启动MySQL服务器:

systemctl start mariadb.service
systemctl enable mariadb.service

设置MySQL根帐户的密码:

mysql_secure_installation

[root@server1 ~]# mysql_secure_installation
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): <--ENTER
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n]
New password: <--yourmariadbpassword
Re-enter new password: <--yourmariadbpassword
Password updated successfully!
Reloading privilege tables..
... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
proction environment.

Remove anonymous users? [Y/n] <--ENTER
... Success!

Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] <--ENTER
... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a proction environment.

Remove test database and access to it? [Y/n] <--ENTER
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] <--ENTER
... Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
[root@server1 ~]#

3安装Apache

CentOS 7附带apache 2.4。 Apache可以直接作为CentOS 7软件包使用,因此我们可以这样安装:

yum -y install httpd

这里是安装过程的截图。

现在配置您的系统启动Apache启动时...

systemctl start httpd.service

systemctl enable httpd.service

为了能够从外部访问Web服务器,我们必须打开防火墙中的HTTP(80)和HTTPS(443)端口。 CentOS上的默认防火墙是firewalld,可以使用firewalld-cmd命令配置。

firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload

现在将您的浏览器指向服务器的IP地址,在我的情况下为http://192.168.1.100 ,您应该看到Apache占位符页面:

4安装PHP

CentOS附带的PHP版本相当旧(PHP 5.4),因此,我将在此步骤中显示一些选项,从Remi存储库安装更新的PHP版本,如PHP 7.0或7.1。

添加Remi CentOS存储库。

rpm -Uvhhttp://rpms.remirepo.net/enterprise/remi-release-7.rpm

安装yum-utils,因为我们需要yum-config-manager实用程序。

yum -y install yum-utils

并运行yum更新

yum update

现在您必须选择要在服务器上使用哪个PHP版本。 如果你喜欢使用PHP 5.4,那么继续下一个命令。 要安装PHP 7.0,请遵循第4.1章和PHP 7.1中的命令,使用第4.2章。

要安装PHP 5.4,请运行以下命令:

yum -y installphp

4.1安装PHP 7.0(可选)

我们可以安装PHP 7.0和Apache PHP 7.0模块,如下所示:

yum-config-manager --enable remi-php70

yum -y installphp php-opcache

4.2安装PHP 7.1(可选)

如果要使用PHP 7.1,请使用:

yum-config-manager --enable remi-php71

yum -y installphp php-opcache

在这个例子中,在可下载的虚拟机中,我将使用PHP 7.1。

我们必须重新启动Apache来应用更改:

systemctl restart httpd.service

5测试PHP /获取有关您的PHP安装的详细信息

默认网站的文档根目录是/ var / www / html。 我们将在该目录中创建一个小型的PHP文件(info.php),并在浏览器中调用它来测试PHP安装。 该文件将显示有关我们的PHP安装的许多有用的细节,例如安装的PHP版本。

nano /var/www/html/info.php

<?php
phpinfo();?>

现在我们在浏览器中调用该文件(例如http://192.168.1.100/info.php ):

如您所见,PHP 7.1正在工作,它正在通过Apache 2.0处理程序,如Server API行所示。 如果您进一步向下滚动,您将看到在PHP中已启用的所有模块。 MySQL没有列出,这意味着我们还没有在PHP中支持MySQL。

6在PHP中获取MySQL支持

要在PHP中获得MySQL支持,我们可以安装php71w-mysql包。 安装一些其他PHP模块是一个好主意,也可能需要它们用于应用程序。 您可以搜索可用的PHP5模块,如下所示:

yum search php

选择您需要的并安装它们:

yum -y install php-mysql

在下一步中,我将安装一些常见的PHP模块,CMS系统如Wordpress,Joomla和Drupal所需:

yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstringphp-soap curl curl-devel

现在重新启动Apache Web服务器:

systemctl restart httpd.service

现在在您的浏览器中重新加载http://192.168.1.100/info.php并再次向下滚动到模块部分。 你现在应该找到很多新的模块,如Curl等。

如果您不再需要php信息输出,那么为了安全起见,请删除该文件。

rm/var/www/html/info.php

7 phpMyAdmin安装

phpMyAdmin是一个Web界面,您可以通过它来管理MySQL数据库
phpMyAdmin现在可以安装如下:

yum -y install phpMyAdmin

现在我们配置phpMyAdmin。 我们更改Apache配置,以便phpMyAdmin不仅允许从localhost进行连接(通过注释<RequireAny>节并添加“要求所有已授予”行):

nano /etc/httpd/conf.d/phpMyAdmin.conf

[...]
Alias /phpMyAdmin /usr/share/phpMyAdminAlias /phpmyadmin /usr/share/phpMyAdmin<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8

<IfMole mod_authz_core.c>
# Apache 2.4
# <RequireAny>
# Require ip 127.0.0.1
# Require ip ::1
# </RequireAny>
Require all granted
</IfMole>
<IfMole !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfMole>
</Directory>
<Directory /usr/share/phpMyAdmin/>
Options none AllowOverride Limit
Require all granted</Directory>

[...]

接下来,我们将phpMyAdmin中的身份验证从cookie更改为http :

nano /etc/phpMyAdmin/config.inc.php

[...]$cfg['Servers'][$i]['auth_type'] = 'http'; // Authentication method (config, http or cookie based)?[...]

重新启动Apache:

systemctl restart httpd.service

之后,您可以访问http://192.168.1.100/phpmyadmin/下的phpMyAdmin :

8作为虚拟机下载

此设置可用于以ova / ovf格式(与VMWare和Virtualbox兼容)的虚拟机下载,以了解用户的身份。

VM的登录详细信息

  • Linux root密码是:howtoing。

  • Rhe MySQL的root密码是:howtoing

  • 请在第一次登录时更改两个密码。

  • 虚拟机的IP地址为192.168.1.100

热点内容
传智播客php韩顺平 发布:2024-05-17 20:09:52 浏览:819
android蓝牙打印打印图片 发布:2024-05-17 18:58:31 浏览:464
android年龄 发布:2024-05-17 18:51:33 浏览:198
termux安装python 发布:2024-05-17 18:44:55 浏览:655
手机流量上传 发布:2024-05-17 18:44:06 浏览:551
服务器怎么证明是好的 发布:2024-05-17 18:39:28 浏览:683
树莓派如何搭建mqtt服务器 发布:2024-05-17 18:27:38 浏览:437
门口机sip服务器ip是什么 发布:2024-05-17 17:38:27 浏览:554
光遇安卓区是什么服 发布:2024-05-17 17:22:25 浏览:25
linux驱动开发教程 发布:2024-05-17 17:19:52 浏览:501