Home >Backend Development >PHP Problem >How to install php in xampp (tutorial sharing)
When developing websites or building servers, you often need to use the php language. So, how to install php in xampp? This article will give you a detailed introduction to the installation steps of php in xampp.
Step one: Download xampp
xampp is a free, open source server that supports Windows, Linux, macOS and other platforms. First, we need to download xampp from the official website (https://www.apachefriends.org/zh_cn/index.html) and install it.
Step 2: Download php
In xampp, php is not installed by default and needs to be downloaded and installed manually. We can download the PHP compressed package corresponding to the operating system on the PHP official website (https://windows.php.net/download/).
Step 3: Decompress php
After the download is completed, we need to decompress php into the "php" folder in the xampp installation directory. If you choose the default installation path when installing xampp, the folder where php is located should be "C:\xampp\php".
Step 4: Configure php
In xampp, the php configuration file is located in "C:\xampp\php\php.ini". We need to open the file and make the following configuration:
error_reporting = E_ALL
display_errors = On
extension_dir = "C:\xampp\php\ext"
extension=php_mysql.dll
extension= php_mysqli.dll
extension=php_pdo_mysql.dll
date.timezone = Asia/Shanghai
upload_max_filesize=2M
post_max_size=8M
Step 5: Restart xampp
After completing the above steps , we need to restart xampp so that it applies the new php configuration. In the xampp control panel, select "Stop" to stop the service, and then select "Start" to start the service.
Step 6: Test whether php is installed successfully
In the xampp installation directory, find the "htdocs" folder, create a new folder, such as "test", and create it in the folder A file named "index.php" and enter the following code:
phpinfo();
?>
Save the file and visit "http://localhost/test/" in the browser. If you see the PHP information page, it means PHP has been successfully installed and configured.
To sum up, the above is the installation tutorial of php in xampp, I hope it will be helpful to everyone. When developing websites or building servers, making full use of the functions provided by xampp can bring great convenience to developers.
The above is the detailed content of How to install php in xampp (tutorial sharing). For more information, please follow other related articles on the PHP Chinese website!