如何在我的电脑上运行php文件 [英] How to run php files on my computer

查看:50
本文介绍了如何在我的电脑上运行php文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能告诉我如何在我的系统上本地运行一个 php 文件.
目前我正在使用服务器来运行文件.
我知道 php &要安装 Apache.
我需要看看这个程序的输出,例如:

Could anyone please tell me how to run a php file locally on my system.
Currently I am using a server to run files.
I know both php & Apache to be installed.
I need to see out put of this program, for example:

<?php 
$a=5;
$b=10;
$c=$a+$b;
print $c;
?>

如果我还需要什么,请告诉我如何运行这些文件.

Can you please tell how I can run these files of if I need anything more.

推荐答案

您必须运行 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 的控制面板,然后单击 Apache 旁边的开始"按钮 - 请注意,在需要数据库的应用程序上,您还需要启动 MySQL(并且您将能够通过 phpMyAdmin 与它进行交互).启动 Apache 后,您可以浏览到 http://localhost.

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.

这篇关于如何在我的电脑上运行php文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆