Чем запустить php файлы в windows 10

Download Article

Two simple ways to run a PHP file on your computer

Download Article

  • How to Open a PHP File on Windows
  • |

  • On Mac
  • |

  • Q&A
  • |

  • Tips
  • |

  • Warnings

This wikiHow teaches you how to open and edit a PHP programming file on your Windows or Mac computer.

Opening a PHP File

  1. Download Notepad++ (Windows) or BBEdit (Mac).
  2. Open the downloaded application on your computer.
  3. Click File at the top of your screen.
  4. Select Open from the drop-down menu.
  5. Click on your PHP file and click Open.
  1. Step 1 Download and install Notepad++.

    Notepad++ is a free, Windows-only text editor that can open PHP files. To install it, do the following:

    • Go to notepad-plus-plus.org/download/v7.5.8.html in your computer’s web browser.
    • Click the green DOWNLOAD button.
    • Double-click the Notepad++ setup file.
    • Follow the installation prompts.
  2. Step 2 Open Notepad++.

    If Notepad++ doesn’t automatically open after you finish installing it, open Start

    Windows Start

    , type in notepad++, and click Notepad++ at the top of the results.

    Advertisement

  3. Step 3 Click File.

    It’s in the top-left corner of the Notepad++ window. A drop-down menu will appear.

  4. Step 4 Click Open….

    This option is in the drop-down menu. Doing so brings up a File Explorer window.

  5. Step 5 Select your PHP file.

    Go to the location of your PHP file, then click the PHP file to select it.

  6. Step 6 Click Open.

    It’s in the bottom-right corner of the window. This will open the PHP file in Notepad++, allowing you to view the file’s code and make any necessary edits.

    • If you do edit your PHP file, press Ctrl+S to save the changes before you exit Notepad++.
  7. Advertisement

  1. Step 1 Download and install BBEdit.

    This free program allows you to view and edit numerous different file types, PHP included. To install it, do the following:

    • Go to https://www.barebones.com/products/bbedit/ in your Mac’s web browser.
    • Click Free Download in the upper-right side of the page.
    • Double-click the downloaded DMG file.
    • Verify the software if prompted.
    • Drag the BBEdit icon onto the «Applications» folder.
    • Follow any on-screen prompts.
  2. Step 2 Open Spotlight icon.

    Click the magnifying glass-shaped icon in the top-right corner of the screen to do so.

  3. Step 3 Open BBEdit.

    Type in bbedit, then double-click BBEdit in the resulting drop-down menu.

    • If this is your first time opening BBEdit after installing, click Open when prompted, then click Continue to continue with the 30 day trial.
  4. Step 4 Click File.

    It’s in the top-left corner of the screen. A drop-down menu will appear.

  5. Step 5 Click Open….

    This is in the File drop-down menu. Doing so opens a Finder window.

  6. Step 6 Select your PHP file.

    Go to the location in which your PHP file is stored, then click the PHP file to select it.

  7. Step 7 Click Open.

    It’s in the bottom-right corner of the window. Doing so opens the PHP file in BBEdit; you should now be able to see the PHP file’s text.

    • You may instead click Choose here.
    • If you edit your PHP file, be sure to save it by pressing Command+S.
  8. Advertisement

Add New Question

  • Question

    PHP file is running in xampp only when it is stored or copied in htdocs. I want to know why we aren’t able to run the php files in their current locations instead of changing their directories?

    When you are running XAMPP, it is creating a web server which runs the file. The web server expects the files to be stored in the public directory, which is configurable, and defaults in the case of XAMPP to htdocs.

  • Question

    Can I print a PHP file?

    Yes, you could just click File > Print. Or you could copy it into another text editor and print it from there.

  • Question

    Which is the best to use on a .PHP in my documents?

    At the very least, you want a plain text editor, as PHP will be plain text. However, PHP is a programming language, so you are better off using a proper PHP editor which will make it look easier to read and edit. There are many available, depending on your operating system and budget, but if you just want to see what the file is, notepad will do.

See more answers

Ask a Question

200 characters left

Include your email address to get a message when this question is answered.

Submit

Advertisement

  • Dragging and dropping your PHP file into most web browsers (excluding Firefox) will open the PHP file’s code. While the PHP file probably won’t display correctly, you’ll at least be able to view the file’s code itself.

Thanks for submitting a tip for review!

Advertisement

  • Always save a copy of your original PHP file before making any changes. Editing the code incorrectly can cause your website to stop functioning, so it’s always best to have a backup.

Advertisement

About This Article

Article SummaryX

To open a PHP file on Windows, search online for Notepad++, which is a free text-editor, and download it to your computer. Once it’s finished downloading, double-click the setup file and follow the prompts to install it. After it’s installed, open Notepad++. Then, click «File» and «Open» and locate your PHP file from the file explorer. To open a PHP file on a Mac, search online for BBEdit and download it. Double-click the downloaded DMG file and drag the BBEdit icon to your “Applications” folder. When it’s finished copying, open the program from your applications. Then, click “File” and “Open” and select your PHP file from the finder window. For more tips, including how to print a PHP file, read on!

Did this summary help you?

Thanks to all authors for creating a page that has been read 925,217 times.

Reader Success Stories

  • «Variety of options to suit user level, requirement and choice.»

Is this article up to date?

File Extension Database

PHP file extension is most commonly
associated with a Hypertext Preprocessor file. PHP files contain server-side
scripts written in the PHP language with embedded Hypertext Markup Language (HTML),
and are widely used by web developers to build dynamic websites. Though now
uncommon, the PHP file extension may also be used to denote a Picture It! project
file or a PhotoParade Slideshow, though the default extension of the latter was
changed as of version 4 to avoid confusion with PHP scripts.

The majority of PHP files refer to web
pages written using the PHP scripting language. PHP is a freely available,
general purpose scripting language developed primarily for web-based
applications. Its simplicity and cross-platform compatibility has made it a popular
language, and is widely used to develop dynamic websites. PHP is a server-side
language, and is often used to generate web pages dynamically based on user
input, such as from File extension HTML forms, or using back-end databases. Other, similar
server-side scripting languages include Microsoft’s File extension ASP.NET and Sun
Microsystems’ JavaServer Pages (File extension JSP).

PHP files are stored in plaintext, and
usually contain a mixture of PHP scripts and HTML. These are then parsed and
compiled at runtime by a PHP engine which runs on a web server and the output,
usually in the form of pure HTML, is sent to the user’s web browser. As all
script execution takes place server-side, no actual PHP code is sent to the
client browser despite the file having the PHP extension.

PHP script files are stored in plaintext. That’s why you can open PHP file using any text editor or website development software such as
Adobe Dreamweaver which may offer additional functionality such as syntax
highlighting. In order to run a PHP file, it must be executed on a web server
with PHP support such as Apache or Microsoft’s IIS. The output can be viewed
via a standard web browser by navigating to the PHP file on the web server.

Frequently associated Windows objects:

  • XWeb.php.12.0

How Can I Open PHP File on Windows

  • We researched and learned that the best way to open PHP file is to find a PHP file in question in Windows OS File Explorer and double click on it to launch the corresponding application.
  • If a PHP file is not opened in an application and you instead get a «Windows can’t open a file» error message you should try looking for an application which can open the file in question.
  • If you know the application which can open PHP file then run it and see if there is a File->Open main menu option in the application.
  • If you don’t know the application which function as PHP file opener then try to search online for «PHP viewer», «application to open PHP file» or «open PHP file» queries in the search engine you like.
  • Install the application you found and check if it can open PHP file

How Can I Open PHP File on Mac OS

  • We recommend to find a PHP file in question in Mac OS Finder and double click on it to launch the corresponding application.
  • If a PHP file is not opened in a Mac OS application and you instead get a «There is no application set to open the file» error message you can click on «Search App Store» in the error dialog and Mac OS will show you applications compatible with PHP file.
  • If you know the Mac OS application which can work as PHP file opener you can choose the «Choose Application…» option in the error box to associate the file extension and open PHP file in it.
  • If you don’t know the application which can open PHP file then try to search for «PHP viewer», «application to open PHP file» or «read PHP file» queries in the online search engine you like.
  • Install the application you found and check if it can read PHP file

How Can I Open PHP File on Android

If you downloaded a PHP file on Android device you can open it by following steps below:

  • In the Android apps list on your Android device find «My Files» or «File manager» app and tap to start it.
  • Tap on «Downloads» folder inside the app.
  • You should see your downloaded PHP file in that folder.
  • Tap on the file. If Android device supports opening the file you downloaded it will open in the corresponding app.
  • If file does not open you can look for the corresponding app that can open the file by searching Android App Store for the «PHP».
  • If you cannot open the file with the apps from Android App Store it is possible that the file could only be opened on desktop platforms such as Windows or Mac OS. Try searching for «PHP viewer», «PHP file reader» online and see if any desktop applications can open it.
  • It is also possible that the file you downloaded is outdated and is no longer supported.

How to Open PHP File on iPhone or iPad

To open PHP File on iOS device follow steps below:

  • We advies to open Files app on your iPhone or iPad device. You can find it by swiping down on the home screen and typing «Files» in the search bar.
  • Tap on the Downloads folder on the Files app home screen.
  • You will see all files that you recently downloaded. Tap on the PHP file to view it.
  • If you have the right app that can open it it will automatically launch and open your file.
  • If you don’t have the app which can open it you need to serch Apple app store for «PHP». This way you can find apps which can open PHP files.
  • If this doesn’t help it is possible that your file could be opened only by the desktop application. To find an app which can open it on desktop look for «PHP viewer» or «PHP file» online in your favorite search engine.

Populating this website with information and maintaining it is an ongoing process. We always welcome feedback and questions that can be submitted by visiting Contact Us page. However since there are many users visiting this website and because our team is quite small we may not be able to follow up personally on every request. Thank you for your understanding.

PHP file article translations

В этой статье вы узнаете, как открыть файл PHP, что это за формат, для чего он используется, и какие существуют особенности у файлов с расширением PHP. Материал предназначен для начинающих.

Файл PHP включает в себя исходный код, который написан на соответствующем языке программирования. Но не только. Некоторые специализированные программы тоже используют в своей работе файлы (files) с PHP-расширением:
— слайд-шоу Callisto PhotoParade;
— файл Microsoft Picture It!
— рабочий файл CreataCard, который содержит автосохранения.

Однако в большинстве случаев, когда мы говорим о PHP файле (file.php), мы подразумеваем именно код, написанный на этом языке программирования. И обычно файл с таким расширением (форматом) представляет собой скрипт либо веб-страницу.

Что неудивительно, ведь язык широко используется в процессе разработки динамических сайтов и web-приложений. Он популярен, имеет широкий перечень сторонних и встроенных инструментов для разработки, совместим с СУБД (часто используется вместе с базами данных MySQL), имеет открытый исходный код. Язык относительно простой, характеризуется богатыми функциональными возможностями и высокой скоростью исполнения, им пользуется множество программистов со всего мира.

Сайты, работающие на PHP, выполняют анализ имеющихся файлов с расширением .php, а потом создают HTML-страницу и отправляют её в web-браузер пользователя. То есть код PHP-страницы динамически обрабатывается сервером, вследствие чего пользователь получает сгенерированный HTML-код. А код PHP, который внедрён в файл HTML, распознается в качестве PHP если он заключен в соответствующие теги:


Если же надо в файле HTML прописать ссылку на PHP-файл, применяют следующий код:

< ?php include 'vash_cod.php';?>

А если web-страница использует PHP-код, ссылаясь на URL, где есть PHP файл (тот же index.php), выглядеть это может так:

https://www.otus.ru/index.php

Здесь отметим ещё один важный момент: PHP выполняется и открывается на стороне сервера, в то время как HTML — на стороне клиента, то есть в браузере. В результате открыть файл с расширением .php не так же просто, как HTML, и сделать это можно лишь при наличии на персональном компьютере пользователя специального программного обеспечения. Но тут есть один важный нюанс: открыть PHP и запустить PHP — это не одно и то же!

Чем и как можно открыть PHP-файл?

На своём компьютере вы сможете без проблем открыть такой файл, используя программные и текстовые редакторы. Они позволяют редактировать код с последующим сохранением. Вот лишь некоторые из этих редакторов:
— Notepad++;
— PSPad editor;
— Adobe Dreamweaver;
— PHPEdit;
— Eclipse PHP Development Tools;
— MPSoftware phpDesigner и другие.

Какие-то из вышеперечисленных программ работают лишь на Windows, какие-то поддерживают Linux (Notepad++, Eclipse PHP Development Tools), какие-то могут работать с Mac OS (Adobe Dreamweaver). Редакторов — огромное множество, поэтому найти и скачать (download) подходящий с учётом своей операционной системы не составит труда.

Если же вы хотите произвести выполнение PHP файла, вам потребуется сервер. Можно воспользоваться хостинговыми услугами на стороне или же установить локальный сервер на свой персональный компьютер. Говоря о локальных серверах, стоит упомянуть наиболее популярные:
• OpenServer;
• Denwer;
• Xammp.

Далее вы сможете создать сайт (как это сделать, зависит от выбранного вами локального сервера — в сети есть множество подробных инструкций по этому поводу). Останется поместить файл PHP в папку web-сервера и запустить его путём набора адреса в строке веб-браузера. В результате вы сможете увидеть, как отработает ваш код и протестировать интерактивные возможности созданной страницы.

На этом всё. Очень надеемся, что после прочтения этого текста (text) и получения соответствующей информации у вас больше не будут возникать вопросы о расширении PHP — что за формат, как открыть и т. д. Если же вы хотите всерьёз заняться разработкой на этом популярнейшем языке программирования, ждём вас на наших курсах!

Источники:
• https://www.internet-technologies.ru/articles/chto-takoe-fayl-php.html;
• https://freesoft.ru/blog/fayl-formata-php-chem-otkryt-opisanie-osobennosti;
• https://filesreview.com/ru/info/php.

Файлы такого формата содержат в себе язык программирования php. Открыть php файл можно специальным П…

Файлы такого формата содержат в себе язык программирования php. Открыть php файл можно специальным ПО, либо в окне браузера. Помимо файлов для программирования сайтов есть три разновидности php-расширения, которые применяются в отдельных нераспространенных сервисах. Это слайд-шоу программы Callisto PhotoParade, рабочий файл  CreataCard, содержащий автосохранения и файл издательской программы Microsoft Picture It! Они не так распространены, поэтому вероятность встретить их невелика. Как открыть php файл для веб-программирования, расскажем ниже.

php открыть

Общее описание формата PHP

Язык программирования PHP в 1995 году разработал датский программист Расмус Релдорф. Спустя два года после выхода первой версии Релдорф выпустил улучшенный вариант. Его стал использовать каждый сотый домен в интернете. В 1998 году документ  переделали израильские программисты, которые в дальнейшем продолжили заниматься проектом. Их версия получила название PHP 3.0. На сегодняшний день используется 7.0.0 версия, выпущенная в 2015 году. Язык PHP находится на 6 месте по популярности, на нем написаны интернет-гиганты Facebook и Wikipedia.

чем открывать php файлы

У расширения язык без конкретного назначения. Он наиболее распространен при разработке веб-приложений и динамических сайтов. Своей популярностью язык обязан широким выбором встроенных и внешних инструментов для разработки, совместимости с системами управления баз через дополнительные модули, взаимодействию с куками и сессиями и так далее.

У формата открытый исходный код на  сервере. Сайты на таком движке анализируют php-файлы, создают html страницу и отправляют в браузер . В итоге, при просмотре исходного кода пользователь не видит php-код.

Как и чем открыть файл php расширения

Файл php открыть не так просто, как html. Есть два способа: программный и браузерный. В двух случаях нужен интерпретатор, либо специальное ПО, причем важно отметить, что запустить php и открыть – не одно и то же.

как открыть php в браузере

Открыть php в браузере

Чтобы понять, как открыть файл php в браузере, важно понять отличие php от html. Последний открывается на стороне клиента – то есть в браузере, а php – на сервере. Чтобы запустить php, нужно либо приобрести домен и работать с php на нем, либо установить локальный сервер на компьютере. Последний способ предпочтительнее, поскольку бесплатный и позволяет создавать безграничное количество сайтов, которые хранятся на вашем ПК.

Есть три основных вида локальных серверов:

  • OpenServer;
  • Denwer;
  • Xammp.

После установки локального сервера на компьютере необходимо создать сайт.

Затем в папке сервера необходимо найти папку под названием «home», в ней создаете еще одну и называете ее как домен будущего сайта. Далее создаем еще одну папку и называем «www», в нее перетаскиваем нужные документы.

как открывать php файлы в браузере

Далее запускаем браузер и в адресной строке пишем название сайта/название файла php. После нажатия на «Enter», php запускается в виде приложения, а не текстового кода. Это позволяет тестировать интерактивные возможности получившейся страницы.

Открыть php на компьютере

Способов, чем открыть файл php на компьютере достаточно много. Так как они открываются в текстовом формате, специализированные редакторы программного кода смогут работать с php.

Чем открыть php:

  • Notepad++ — редактор, работающий на Linux и Windows;
  • Eclipse PHP Development Tools – специализированная программная среда для веб-разработок на PHP;
  • MPSoftware phpDesigner – аналогичная программа, не распространенная в русскоязычном сегменте;
  • Apache Web Server – свободный сервер для разработок, совместим с Windows, Mac OS, Linux;
  • WampServer – комплект ПО для работы с php;
  • Adobe Dreamweaver CC – программа для веб-дизайна, поддерживающая в том числе язык PHP;
  • Стандартный текстовый редактор.

Некоторые программы из перечисленных работают только на Windows, поэтому в случае использования на других ОС проверьте совместимость перед установкой.

как запустить php файл

Today, we’re going to discuss how you can run PHP files. If you’re new to PHP programming, this article will help you learn how to run PHP scripts.

PHP is a server-side scripting language which is mostly used to build web-based applications. These may range from a very simple blog to a full-fledged eCommerce website. In fact, PHP is one of the most popular server-side scripting languages for web development.

If you’re a beginner in PHP programming and you don’t know what a PHP file is, I would recommend that you review the basics of a PHP file. 

In this post, we’ll discuss different ways to run PHP files.

Different Ways to Run PHP Files

There are two ways to run PHP files. The preferred way of running PHP files is within a web server like Apache, Nginx, or IIS—this allows you to run PHP scripts from your browser. That’s how all PHP websites work! The other way is to run PHP scripts on the command line, and it doesn’t require you to set up a web server.

Of course, if you want to publish your PHP pages online, you’ll have to go with the web server setup. On the other hand, running PHP scripts from the command line is useful for performing routine tasks. These are generally configured to run in the background as jobs and are run by the php command without a web server.

In fact, many PHP scripts or applications nowadays come with built-in commands that are used to perform various operations like installing software, exporting and importing database entities, clearing the cache, and more. You may have heard of Composer—it’s a dependency manager for PHP and is one of the most popular tools built for command-line PHP.

Run a PHP File on a Web Server

If you want to run PHP scripts from a web server, you need to configure it with one of the web servers that supports it. For Windows, the IIS web server is one of the most popular. On the other hand, Apache and Nginx are widely used web servers for other operating systems.

The good news is that most hosting providers will have a web server with PHP already set up for you when you log in to your new server.

Run a PHP File in the Browser for Development With XAMPP

If you want to run a PHP file in the browser on your own computer, you’ll need to set up a PHP development stack. You’ll need at least PHP, MySQL, and a server like Apache or Nginx. MySQL is used to set up databases your PHP applications can work with. Of course, you can choose to work with other database engines, but MySQL is one of the most popular databases used with PHP.

Instead of downloading all this software separately and configuring it to work together, I  recommend you just download and install a program like XAMPP. It will include all the necessary software and will get you set up to run PHP in no time. And yes, it supports Windows, Linux, and macOS.

XAMPP contains everything you need to build your web pages locally. It’s hassle-free and allows you to start PHP development right away.

For this tutorial, I’ll use the XAMPP software to demonstrate PHP examples. So download and install it if you want to follow along and run the PHP examples. If you face any problems during installation, feel free to post your queries using the feed at the end of this article.

Once you’ve installed the XAMPP software locally and have it running successfully, you should be able to see the default XAMPP page at http://localhost in your browser.

Run Your PHP File in XAMPP

The first thing you’ll need to know after installing XAMPP is the location where you will put your PHP files. When you install the XAMPP software, it creates the htdocs directory, which is the document root of your default web server domain: localhost. So if you go to http://localhost/example.php, the server will try to find the example.php file under the htdocs directory.

Depending on the OS you’re using, the location of the htdocs directory varies. For Windows, it would be located at C:\xampp\htdocs. On the other hand, it would be located at /opt/lampp/htdocs for Linux users. Once you’ve found the location of the htdocs directory, you can start creating PHP files right away and running them in your browser!

phpinfo() is a very useful function that gives you information about your server and PHP setup. Let’s create a phpinfo.php file under the htdocs directory with the following contents:

1
<?php
2
phpinfo();
3
?>

Now, go ahead and run it in your browser at http://localhost/phpinfo.php, and you should see output like this:

PHPINFO Output

PHPINFO Output

If you haven’t realized yet, let me tell you that you have just run your first PHP file on the web server! It may be a small one, but it’s a significant step towards learning PHP website development.

In fact, you could also create new directories under the htdocs directory to organize your PHP scripts. For example, you could create the datetime directory under htdocs for examples related to date and time. So if you create a today_date.php file under the htdocs/datetime directory, you could access it in the browser by going to http://localhost/datetime/today_date.php.

So in this way, you could create and run PHP scripts with a web server. In fact, this is what you are going to use most of the time in your day-to-day PHP development. 

In the next section, we’ll see how you could run PHP scripts using the command line.

How to Run a PHP File Using the Command Line

When it comes to running PHP scripts on the command line, you should be aware of the location of the PHP executable file in your PHP installation.

For Windows users, you should be able to find the php.exe file under the directory where you have installed your PHP.  On the other hand, if you’re a Linux or macOS user, you should be able to find it at /usr/bin/php. In fact, on Linux or macOS, you can just use the php shortcut from any directory. Once you know the location of your PHP executable file, you just need to provide the name of the PHP file which you want to execute from the command-line interface.

As a Windows user, though, you’ll need to type the full path to the PHP executable to run a PHP script. The PHP executable is usually available at C:\php7\php.exe, so you can use it to execute the PHP file as shown in the following command.

1
C:\php7\php.exe my_example.php

For Linux, you don’t need to type the whole path to the PHP executable.

As we discussed earlier, command-line PHP scripts are generally used for routine application-specific tasks, like:

  • clearing or generating application caches
  • exporting/importing system entities
  • batch processing
  • other general-purpose tasks

Generally, these kinds of tasks take a long time to execute and are not suited to running in a web environment since they cause timeout errors.

It’s important to note that when you’re running PHP scripts on the command line, you won’t have access to any $_SERVER variables, since these are only initiated if you’re running PHP on a web server. Thus, it’s not recommended to rely on these variables if you’re planning to run your scripts using the command line.

As a PHP programmer, it is important to understand how the command-line PHP interface works. In fact, a lot of PHP software and frameworks nowadays come with a built-in command-line tool which allows you to perform a wide range of utility tasks from the CLI itself. 

Conclusion

Today, we discussed how you could run PHP files on your system. Specifically, we went into the details of how to execute PHP scripts in a browser along with a web server and how to run it with a command-line interface as well.

As a beginner, it’s important for you to understand the basic concepts in the first place. And I hope this article has helped you to move a step further in your PHP leaning. Don’t hesitate to ask if you have any queries by using the feed below.

The Best PHP Scripts on CodeCanyon

Explore thousands of the best and most useful PHP scripts ever created on CodeCanyon. With a low-cost, one-time payment, you can purchase one of these high-quality WordPress themes and improve your website experience for you and your visitors.

Here are a few of the best-selling and up-and-coming PHP scripts available on CodeCanyon for 2020.

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Настройка ибп windows 10
  • Установка windows на данный диск невозможна программа установки не поддерживает конфигурацию дисков
  • Как найти папку программы в windows 10
  • Windows 10 корпоративная ltsc код продукта
  • Windows kids играть онлайн