如何更改 XAMPP 中 PHP 的默认路径?

2024-04-12php开发问题
6

本文介绍了如何更改 XAMPP 中 PHP 的默认路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在使用 xampp 来部署 Web 应用程序.它在一个包中包含 PHP 模块.现在我要做的是更改 PHP 的默认路径,这样我就可以使用其他版本的 PHP 而不会覆盖现有模块.我的新 PHP 副本存在于桌面上.如何配置 Apache 以引用桌面上的 PHP 模块,而不是默认的?

I am using xampp for deploying web apps. It includes the PHP module in a package. Now what I want to do is change the default path to PHP so that I can make use of other versions of PHP without overwriting the existing module. My new copy of PHP exists on the desktop. How can I configure Apache to refer to the PHP module present on the desktop, rather than the default one?

推荐答案

  1. 从 http://windows.php 下载所需版本的 PHP 线程安全二进制文件(压缩).网络/下载/.
  2. 将下载的 PHP 版本解压缩到一个单独的目录中.请确保您的新 php 目录的名称不是PHP".(例如,对于 PHP 5.4 使用 php54)
  3. 将新的 PHP 目录复制到您的 XAMPP 目录中.(不要覆盖您现有的 php 目录!)
  4. 现在转到您的 xampp/apache/conf/extra 目录.备份,然后打开 httpd-xampp.conf 文件.
  5. 更改以下变量/指令:

  1. Download your desired version of the PHP thread-safe binary (zipped) from http://windows.php.net/download/.
  2. Unzip the downloaded version of the PHP in a separate directory. Please make sure that your new php directory's name is not "PHP". (For example, use php54 for PHP 5.4)
  3. Copy the new PHP directory into your XAMPP directory. (DO NOT overwrite your existing php directory!)
  4. Now go to your xampp/apache/conf/extra directory. Make a backup of, then open the httpd-xampp.conf file.
  5. Change the following variables/directives:

PHPINIDir[你的 xampp 文件夹]/[新版本的 PHP]

LoadModule[你的 xampp 文件夹]/[新版 PHP]/php5apache2_2.dll

保存 httpd-xampp.conf 文件.重新启动您的 XAMPP apache 服务器.如果您的服务器重新启动成功,那么您的服务器的 PHP 版本已升级.您可以使用 URL [localhost][:port]/xampp/phpinfo.php 来检查您的 PHP 版本的状态.

Save the httpd-xampp.conf file. Restart your XAMPP apache server. If your server get restarted successfully, then your server's PHP version was upgraded. You can check the status of your PHP version by using the URL [localhost][:port]/xampp/phpinfo.php.

如果您仍然遇到问题,请尝试以下方法:

If you are still having issues, try this as well:

LoadFile "[xammp folder]/php/php5ts.dll" 指令更改为 LoadFile "[xampp folder]/php54/php5ts.dll"

来源:http://www.techflirt.com/how-to-upgrade-php-in-xampp/

这篇关于如何更改 XAMPP 中 PHP 的默认路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

PHP实现DeepL翻译API调用
DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以...
2025-08-20 php开发问题
168

PHP通过phpspreadsheet导入Excel日期数据处理方法
PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的...
2024-10-23 php开发问题
287

mediatemple - 无法使用 codeigniter 发送电子邮件
mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)...
2024-08-23 php开发问题
11

Laravel Gmail 配置错误
Laravel Gmail Configuration Error(Laravel Gmail 配置错误)...
2024-08-23 php开发问题
16

将 PHPMailer 用于 SMTP 的问题
Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)...
2024-08-23 php开发问题
4

关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题
Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)...
2024-08-23 php开发问题
17