Environment (Windows OS)
Apache and PHP8 installation reference
PHP Installation
reference:
- download PHP 8.0.3 https://windows.php.net/downloads/releases/php-8.0.30-Win32-vs16-x64.zip
- unzip to a folder, e.g. D:\Tool\PHPEnv\php-8.0.30
- copy php.ini-development and name the file as php.ini
- edit php.ini: change ;extension_dir = "ext" to extension_dir = "D:\Tool\PHPEnv\php-8.0.30\ext"
Apache Installation
- download binary from https://www.apachelounge.com/download/VS17/binaries/httpd-2.4.57-win64-VS17.zip
- unzip to a folder e.g. D:\Tool\PHPEnv\Apache24
- copy "D:\Tool\PHPEnv\php-8.0.30\libsodium.dll" to "D:\Tool\PHPEnv\Apache24\bin\libsodium.dll"
- edit config file: D:\Tool\PHPEnv\Apache24\conf\httpd.conf
- change Define SRVROOT "c:/Apache24" to Define SRVROOT "D:/Tool/PHPEnv/Apache24"
- (optional) uncomment #ServerName www.example.com:80 and change www.example.com to localhost
- add below content under line: #LoadModule xml2enc_module modules/mod_xml2enc.so
#加载PHP
LoadModule php_module 'D:\Tool\PHPEnv\php-8.0.30\php8apache2_4.dll'
#将PHP配置文件加载到Apache配置文件中,共同生效
PHPIniDir 'D:\Tool\PHPEnv\php-8.0.30'
#配置Apache分配工作给PHP模块,把PHP代码交给PHP处理
#即.php后缀名的文件
AddType application/x-httpd-php .php
- add below in the end of file httpd.conf
<IfModule mpm_winnt_module>
ThreadStackSize 8888888
</IfModule>
- open command line and go to D:\Tool\PHPEnv\Apache24\bin folder
- run httpd.exe and open http://localhost in browser, it works fine if you can see "It works!" in browser
PHP and Apache integration test
- go to folder D:\Tool\PHPEnv\Apache24\htdocs
- create a file named test.php and copy below content to this file
<?php
//test
echo 'Hello php!';
?>
- run httpd in cmd
- open url in browser: http://localhost/test.php and verify if "Hello php!" is shown.
MySql Installation
download URL: https://dev.mysql.com/downloads/mysql/
reference: https://blog.csdn.net/weixin_43423484/article/details/124408565
- create database named moodle after installation
Moodle
- version 4.2.2
- Branch: MOODLE_402_STABLE
- go to folder D:\Tool\PHPEnv\Apache24\htdocs and put moodle code in this folder
- run httpd and open http://localhost/hackathon_2023/install.php in browser
- configure moodle in the opened guide