首页 > 编程语言 >PHP 网页

PHP 网页

时间:2022-11-13 17:22:44浏览次数:57  
标签:www php 网页 workspace PHP com testuri

PHP官网下载 https://windows.php.net/download/

在PHP官网点击Download下载时不管选择哪个版本的都有两个类型 :

Non Thread Safe(非线程安全)和  Thread Safe (线程安全)

如果需要配合 Apache 使用,需要下载 Thread Safe 版本(才包含php7apache2_4.dll模块)。

apache24+php8配置

将 php8 目录中的 php.ini-development 改名为 php.ini,然后打开这个文件找到 extension_dir=“ext”,去掉注释分号,改为extension_dir = “D:/software/php8/ext” (php的安装路径/ext)

打开 apache 目录中的 config/httpd.conf,在 LoadModule 后面追加(将php加到apache中):

#载入PHP处理模块
LoadModule php_module "D:/workspace/php8/php8apache2_4.dll"  #php安装路径
PHPIniDir "D:/workspace/php8" 
#所有的*.php文件使用php处理
AddType application/x-httpd-php .php .phtml

添加虚拟目录:  先注释掉原来的路径:DocumentRoot "${SRVROOT}/htdocs",在 httpd.conf 文件后面加上:

<IfModule dir_module>
    DirectoryIndex index.php index.html index.htm default.php default.html default.htm home.php home.html home.htm
    #G:/workspace/yii2-basic/web 放php项目的地方,取一个别名 testuri
    Alias /testuri "G:/workspace/yii2-basic/web"  
    DocumentRoot "G:/workspace/yii2-basic/web"
    <Directory "G:/workspace/yii2-basic/web">
        Options Indexes FollowSymLinks
        AllowOverride all
        Require all granted
    </Directory>
</IfModule>

 

配置虚拟主机(配置多个服务的地方): 打开:conf/extra/httpd-vhosts.conf,在文件后面添加

<VirtualHost *:80>
    #和前面的 DocumentRoot 一致
    DocumentRoot "G:/workspace/PhoneShop/nginx/yii2-basic/web"
    #虚拟主机名 访问时的网址
    ServerName www.testuri.com  
    ErrorLog "logs/www.testuri.com-error.log"
    CustomLog "logs/www.testuri.com-access.log" common
</VirtualHost>

 

修改本地网址IP解析指向(访问www.testuri.com时,IP为本地),打开 C:\Windows\System32\drivers\etc\hosts 文件,在后面添加:

127.0.0.1 www.testuri.com

启动 apache 输入网址访问测试。

标签:www,php,网页,workspace,PHP,com,testuri
From: https://www.cnblogs.com/jiayouba/p/16886353.html