且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在我的电脑上运行PHP文件

更新时间:2023-02-22 19:57:55

您必须运行一个Web服务器(例如Apache)的并浏览到本地主机,最有可能在80端口。

You have to run a web server (e.g. Apache) and browse to your localhost, mostly likely on port 80.

你真正应该做的是安装一个全功能于一身的包如 XAMPP ,它捆绑了Apache,MySQL和PHP和Perl(如果你是如此倾斜),以及与Apache和MySQL的一些其他工具 - 再加上它是跨平台(这是在'XAMPP'的'X'代表)

What you really ought to do is install an all-in-one package like XAMPP, it bundles Apache, MySQL PHP, and Perl (if you were so inclined) as well as a few other tools that work with Apache and MySQL - plus it's cross platform (that's what the 'X' in 'XAMPP' stands for).

一旦你安装XAMPP(且有一个安装程序,所以它不应该是硬)打开控制面板的XAMPP,然后点击旁边的阿帕奇开始按钮 - 注意,需要数据库的应用程序,你还需要启动MySQL(和你就可以通过phpmyadmin与它接口)。一旦你开始了Apache,你可以浏览到的http://本地主机

Once you install XAMPP (and there is an installer, so it shouldn't be hard) open up the control panel for XAMPP and then click the "Start" button next to Apache - note that on applications that require a database, you'll also need to start MySQL (and you'll be able to interface with it through phpMyAdmin). Once you've started Apache, you can browse to http://localhost.

此外,无论你是否选择XAMPP(我建议),你应该只需要启动Apache。

Again, regardless of whether or not you choose XAMPP (which I would recommend), you should just have to start Apache.