win7安装php7,apache,mysql

安装64位最新版服务软件

PHP7下载链接
mysql-5.7下载链接
apache-httpd-2.4
记得新版php跟apache需要VC14平台,mysql需要.NET4平台的支持,要先安装好这两个平台才能开始安装我们的主角。

新装系统的电脑先等杀毒软件将各路补丁打全,再操作,不然安装.NET4平台会出现安装阻塞,不能正常安装,等补丁安装好了就可以了

安装好后,我们开始配置apache

  • 将apache软件安装路径下的conf/里头的httpd.conf文件内的ServerRoot修改为当前apache的安装路径
ServerRoot "D:/apache-httpd-2.4.17-win64-VC14/Apache24"
  • 将DocumentRoot还有Directory的路径修改为你想要放网站的路径,默认是apache路径下的htdocs这个文件夹,DirectoryIndex这个是路径索引,我们要添加index.php作为默认索引文件,这样访问网站路径的时候,apache自动导航请求到目录下的index.php文件
DocumentRoot "D:/apache-httpd-2.4.17-win64-VC14/Apache24/htdocs"
<Directory "D:/apache-httpd-2.4.17-win64-VC14/Apache24/htdocs">

文件配置完成,接下来我们要测试下httpd.exe是否能正常工作,打开cmd进入bin/路径,打出httpd然后回车,到浏览器上输入localhost回车访问测试下,正常工作的话,会显示it works,没有问题的话,接下来就是将其加入系统服务,httpd -k install -n "ApacheServer" 这里的ApacheServer名字可以自己命名

接下来我们配置php

将php解压路径下的php.ini-development拷贝一份,并重命名为php.ini,然后去刚刚那个apache的配置文件末尾添加php的支持,记得路径要修改成你们存放的路径

# php7 support
LoadModule php7_module "D:/php-7.1.4-Win32-VC14-x64/php7apache2_4.dll"
LoadModule php7_module "D:/php-7.1.4-Win32-VC14-x64/php7phpdbg.dll"
AddHandler application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "D:/php-7.1.4-Win32-VC14-x64"

接下来 按win菜单按钮

  • 计算机
  • 右键【管理】
  • 服务和应用程序
  • 服务
  • 选择刚刚我添加进系统服务的ApacheServer,重启

然后到DocumentRoot路径下添加index.php文件,内容如下

<?php
    phpinfo();
?>
// 切换到浏览器,访问localhost/index.php正常的话会输出php的详细配置信息

最后我们配置mysql

我们先到刚刚php.ini的配置文件里修改下配置

...
extension_dir = "D:/php-7.1.4-Win32-VC14-x64/ext"
...
...
extension=php_pdo_mysql.dll   //# 将;去掉

我们安装mysql,记得我们如果没有特别需要,直接选择安装server版本就可以,反正客户端,我们待会可以使用phpmyadmin这个利器代劳!没必要安装那么多的东西,设置好mysql的账户密码,我们去下载个phpmyadmin的zip包,解压到DocumentRoot路径下,修改主路径下的config.inc.php文件

// 写入账户名密码
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '********';
// 切换到浏览器,访问localhost/phpmyadmin正常的话会出现mysql数据库的管理界面,里面的功能绝对满足日常需求

然后这边有一个小坑,就是我之前使用的是旧版的php,使用mysql_开头的函数要修改成mysqli_,不然会提醒undefine function,然后默认mysql的数据存放位置为同一驱动盘盘下的隐藏目录:\ProgramData路径下,例如

C:\ProgramData\MySQL\MySQL Server 5.7\Data

如果想要直接访问旧数据库的文件,可以直接将其拷贝进该路径即可。

编译 ./configure --prefix=/usr/local/php --exec-prefix=/usr/local/php --bindir=/usr/local/php/bin --sbindir=/usr/local/php/sbin --includedir=/usr/local/php/include --libdir=/usr/local/php/lib/php --mandir=/usr/local/php/php/man --with-config-file-path=/usr/local/php/etc --with-mysql-sock=/var/run/mysql/mysql.sock --with-mcrypt=/usr/include --with-mhash --with-openssl --with-mysql=shared,mysqlnd --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --with-gd --with-iconv --with-zlib --enable-zip --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache --enable-fpm --enable-fastcgi --with-fpm-user=www --with-fpm-group=www --without-gdbm --with-mcrypt=/usr/local/apps/libmcrypt --disable-fileinfo 报错:1, **configure: error: system libzip must be upgraded to version >=**0.11。 使用Yum最新版只到0.10,不足以达到要求。 一、先删除libzip yum remove libzip -y SSH执行以上命令,先删除libzip 和 libzip-devel 二、下载安装并手动编译 wget https://nih.at/libzip/libzip-1.2.0.tar.gz tar -zxvf libzip-1.2.0.tar.gz cd libzip-1.2.0 ./configure make && make install 三、(可忽略)另外最新版本请参考官网:https://nih.at/libzip/ 1.5.0的libzip需要cmake wget https://libzip.org/download/libzip-1.5.0.tar.gz tar -zxvf libzip-* cd libzip* mkdir build && cd build && cmake .. && make && make install 报错2: error: off_t undefined; check your library configuration 根据报错信息分析 configure: error: off_t undefined; check your library configuration 未定义的类型 off_t。 off_t 类型是在 头文件 unistd.h中定义的,在32位系统 编程成 long int ,64位系统则编译成 long long int ,这里题主的系统应该是 64位的吧,在进行编译的时候 是默认查找64位的动态链接库,但是默认情况下 centos 的动态链接库配置文件/etc/ld.so.conf里并没有加入搜索路径,这个时候需要将 /usr/local/lib64 /usr/lib64 这些针对64位的库文件路径加进去。 采用下面的方法。 添加搜索路径到配置文件 echo '/usr/local
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值