centos 安装 php apache?centos7下载地址

大家好,今天来为大家分享centos 安装 php apache的一些知识点,和centos7下载地址的问题解析,大家要是都明白,那么可以忽略,如果不太清楚的话可以看看本篇文章,相信很大概率可以解决您的问题,接下来我们就一起来看看吧!

阿里云上的centos 7.2怎么yum安装php 5.6

因之前通过网易的 centos镜像,将阿里云的 centos升级到最新版了,乘自己的项目尚未开始正式开发,遂将所有的相应环境都升级到最高。

查看 centos版本:

[root@iZ23d~]# cat/etc/centos-release

CentOS Linux release 7.2.1511(Core)

1、删除之前的 php版本:

[root@iZ23d~]# yum remove php* php-common

Loaded plugins: langpacks

Repository base is listed more than once in the configuration

Repository updates is listed more than once in the configuration

Repository extras is listed more than once in the configuration

Repository centosplus is listed more than once in the configuration

No Match for argument: php-5.4.16

No Match for argument: php-5.4.16.tar.gz

No Match for argument: php-7.0.1RC1

No Match for argument: php-7.0.1RC1.tar.gz

No Match for argument: phpMyAdmin-4.4.0.tar.gz

No Match for argument: php-common

No Packages marked for removal

2、rpm安装 Php7相应的 yum源:

[root@iZ23d~]# rpm-Uvh

Retrieving

warning:/var/tmp/rpm-tmp.LhJKKR: Header V4 RSA/SHA1 Signature, key ID 62e74ca5: NOKEY

Preparing...################################# [100%]

package webtatic-release-7-3.noarch is already installed

3、直接yum安装php7:

[root@iZ23d~]# yum install php70w

Loaded plugins: langpacks

Repository base is listed more than once in the configuration

Repository updates is listed more than once in the configuration

Repository extras is listed more than once in the configuration

Repository centosplus is listed more than once in the configuration

Resolving Dependencies

--> Running transaction check

。。。【省略】

Warning: RPMDB altered outside of yum.

Installing: php70w-common-7.0.0-1.w7.x86_64 1/3

Installing: php70w-cli-7.0.0-1.w7.x86_64 2/3

Installing: php70w-7.0.0-1.w7.x86_64 3/3

Verifying: php70w-7.0.0-1.w7.x86_64 1/3

Verifying: php70w-common-7.0.0-1.w7.x86_64 2/3

Verifying: php70w-cli-7.0.0-1.w7.x86_64 3/3

Installed:

php70w.x86_64 0:7.0.0-1.w7

Dependency Installed:

php70w-cli.x86_64 0:7.0.0-1.w7 php70w-common.x86_64 0:7.0.0-1.w7

Complete!

4、检查 php版本:

[root@iZ23d~]# php-v

PHP 7.0.0(cli)(built: Dec 2 2015 20:42:32)( NTS)

Copyright(c) 1997-2015 The PHP Group

Zend Engine v3.0.0, Copyright(c) 1998-2015 Zend Technologies

[root@iZ23d2e6hoqZ~]#

以上显示安装成功!

5、重启 Apache,查看 phpinfo:

[root@iZ23d~]# systemctl restart httpd.service

检查phpinfo:

PHP Version 7.0.0

SystemLinux iZ23d 3.10.0-229.11.1.el7.x86_64#1 SMP Thu Aug 6 01:06:18 UTC 2015 x86_64

Build DateDec 2 2015 20:43:38

Server APIApache 2.0 Handler

Virtual Directory Supportdisabled

Configuration File(php.ini) Path/etc

Loaded Configuration File/etc/php.ini

Scan this dir for additional.ini files/etc/php.d

Additional.ini files parsed/etc/php.d/bz2.ini,/etc/php.d/calendar.ini,/etc/php.d/ctype.ini,/etc/php.d/curl.ini,/etc/php.d/exif.ini,/etc/php.d/fileinfo.ini,/etc/php.d/ftp.ini,/etc/php.d/gettext.ini,/etc/php.d/gmp.ini,/etc/php.d/iconv.ini,/etc/php.d/json.ini,/etc/php.d/phar.ini,/etc/php.d/shmop.ini,/etc/php.d/simplexml.ini,/etc/php.d/sockets.ini,/etc/php.d/tokenizer.ini,/etc/php.d/xml.ini,/etc/php.d/zip.ini

PHP API20151012

PHP Extension20151012

Zend Extension320151012

Zend Extension BuildAPI320151012,NTS

PHP Extension BuildAPI20151012,NTS

Debug Buildno

Thread Safetydisabled

Zend Signal Handlingdisabled

Zend Memory Managerenabled

Zend Multibyte Supportdisabled

IPv6 Supportenabled

DTrace Supportenabled

Registered PHP Streamshttps, ftps, compress.zlib, php, file, glob, data, http, ftp, compress.bzip2, phar, zip

Registered Stream Socket Transportstcp, udp, unix, udg, ssl, sslv3, sslv2, tls, tlsv1.0, tlsv1.1, tlsv1.2

Registered Stream Filterszlib.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, bzip2.*, convert.iconv.*

This program makes use of the Zend Scripting Language Engine:

Zend Engine v3.0.0, Copyright(c) 1998-2015 Zend Technologies

Configuration

apache2handler

Apache VersionApache/2.4.6(CentOS)

Apache API Version20120211

Server Administratorxxxxxx@xxxxxx.com

Hostname:Portxxxx.xxxxx.xxx:0

User/Groupapache(48)/48

Max RequestsPer Child: 0- Keep Alive: on- Max Per Connection: 100

TimeoutsConnection: 60- Keep-Alive: 15

Virtual ServerYes

Server Root/etc/httpd

Loaded Modulescore mod_so http_core mod_access_compat mod_actions mod_alias mod_allowmethods mod_auth_basic mod_auth_digest mod_authn_anon mod_authn_core mod_authn_dbd mod_authn_dbm mod_authn_file mod_authn_socache mod_authz_core mod_authz_dbd mod_authz_dbm mod_authz_groupfile mod_authz_host mod_authz_owner mod_authz_user mod_autoindex mod_cache mod_cache_disk mod_data mod_dbd mod_deflate mod_dir mod_dumpio mod_echo mod_env mod_expires mod_ext_filter mod_filter mod_headers mod_include mod_info mod_log_config mod_logio mod_mime_magic mod_mime mod_negotiation mod_remoteip mod_reqtimeout mod_rewrite mod_setenvif mod_slotmem_plain mod_slotmem_shm mod_socache_dbm mod_socache_memcache mod_socache_shmcb mod_status mod_substitute mod_suexec mod_unique_id mod_unixd mod_userdir mod_version mod_vhost_alias mod_dav mod_dav_fs mod_dav_lock mod_lua prefork mod_proxy mod_lbmethod_bybusyness mod_lbmethod_byrequests mod_lbmethod_bytraffic mod_lbmethod_heartbeat mod_proxy_ajp mod_proxy_balancer mod_proxy_connect mod_proxy_express mod_proxy_fcgi mod_proxy_fdpass mod_proxy_ftp mod_proxy_http mod_proxy_scgi mod_proxy_wstunnel mod_ssl mod_systemd mod_cgi mod_perl mod_php7

以上显示 php7安装成功!

如何搭建lamp(CentOS7+Apache+MySQL+PHP)环境

在网上搜资料,自己在本地虚拟机上尝试搭建,弄了整整一天一夜,终于弄好了.网上的资料,虽然很多,但大多都是重复的,拿去试了之后,又很多都不能得到正确的结果.最终找到了适合我的linux环境的搭建方式;在这里贴出来:度娘真不给力啊,没搜出来靠谱的方法。最后用喜乐搜找到的靠谱的教程。

这里还是要总结一下我的LAMP环境的搭建步骤。我先在电脑里装了虚拟机,在虚拟机中测试了数次之后,再在服务器上搭建的。说说我的环境:虚拟机是:VMware® Workstation 12.1.1 Pro;Linux系统用的是:CentOS-7-x86_64-DVD-1511.iso;(阿里云上也是用的CentOS7-64bit)准备好这两个之后,就开始一步一步搭建我们的LAMP环境了。

一、安装虚拟机

二、安装CentOS7

注意:以下安装,我都是用的root权限。

三、安装Apache1.安装yum-y install httpd2.开启apache服务systemctl start httpd.service3.设置apache服务开机启动systemctl enable httpd.service4.验证apache服务是否安装成功在本机浏览器中输入虚拟机的ip地址,CentOS7查看ip地址的方式为:ip addr(阿里云不需要用这种方式查看,外网ip已经在你主机列表那里给你写出来了的;)这里是访问不成功的(阿里云用外网访问,能成功,不需要做以下步骤)查了资料,说法是,CentOS7用的是Firewall-cmd,CentOS7之前用的是iptables防火墙;要想让外网能访问到apache主目录,就需要做以下的操作:firewall-cmd--permanent--zone=public--add-service=httpfirewall-cmd--permanent--zone=public--add-service=httpsfirewall-cmd--reload然后再访问外网ip,如果看到apache默认的页面--有Testing 123...字样,便是成功安装了apache服务了;

四、安装PHP1.安装yum-y install php2.重启apache服务systemctl restart httpd或者systemctl restart httpd.service然后,你可以写一个php文件在浏览器中运行一下了;eg:vi/var/www/html/info.phpi<?php phpinfo();?>Esc:wq然后,在自己电脑浏览器输入 192.168.1.1/info.php运行,会出现php的一些信息

五、安装MySQL我这里根据所学的那个教程,也安装了MariaDB1.安装

yum-y install mariadb*

2.开启MySQL服务systemctl start mariadb.service3.设置开机启动MySQL服务systemctl enable mariadb.service4.设置root帐户的密码mysql_secure_installation然后会出现一串东西,可以仔细读一下,如果你懒得读,就在提示出来的时候,按Enter就好了,让你设置密码的时候,你就输入你想要的密码就行,然后继续在让你选择y/n是,Enter就好了;当一切结束的时候,你可以输入mysql-uroot-p的方式,验证一下;

六、将PHP和MySQL关联起来yum search php,选择你需要的安装:yum-y install php-mysql

七、安装常用的PHP模块例如,GD库,curl,mbstring,...1.安装:yum-y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel2.重启apache服务systemctl restart httpd.service然后,再次在浏览器中运行info.php,你会看到安装的模块的信息;

至此,LAMP环境就搭建好了。

如何搭建lamp(CentOS7+Apache+MySQL+PHP)环境

标签:

如何在CentOS6下实现Apache+PHP+MySQL的快速安装

LAMP是一个免费、开源的解决方案,代表了Linux、Apache、MySQL、PHP,主要用作建立可行的通用的web服务器。那么如何在CentOS6下实现安装Apache+php+Mysql的快速安装?其具体安装配置步骤可以如下进行:

1.准备工作

使用yum进行安装,为了提高速度,最好先是修改为中国CentOS镜像服务器。目前国内有三个镜像可以选择,分别是:中国科学技术大学、163和Sohu的镜像,建议教育网用户选择中科大,电信用户选择163,他们的repo文件本博客作了备份如下:

下面命令是备份CentOS-Base.repo文件,并修改使用163镜像作为yum源:

mv/etc/yum.repos.d/CentOS-Base.repo/etc/yum.repos.d/CentOS-Base.repo.save

wget

mv CentOS6-Base-163.repo/etc/yum.repos.d/CentOS-Base.repo

2.更新系统内核

yum-y update

3.安装Apahce、Mysql、PHP

yum-y install httpd php mysql mysql-server

默认情况下,mysql数据目录位于/var/lib/mysql

4.安装相关组件:

yum install php-mysql php-gd php-imap php-ldap php-odbc

php-pear php-xml php-xmlrpc

5.安装MySQL管理工具phpMyAdmin

yum-y install phpMyAdmin

6.配置Apache随系统启动

chkconfig--levels 235 httpd on

/etc/init.d/httpd start

7.配置MySQL随系统启动

chkconfig--levels 235 mysqld on

/etc/init.d/mysqld start

8.设置数据库root密码

/usr/bin/mysqladmin-u root password'New+Password#www.yupengyan.com'

9.测试PHP是否安装成功

在 CentOS中 Apache的默认根目录是/var/www/html,配置文件/etc/httpd/conf/httpd.conf。其他配置存储在/etc/httpd/conf.d/目录。

阅读剩余
THE END