Php msi installer
Install PHP on Windows
Obtaining PHP
- Download latest version of PHP from http://www.php.net/downloads.php.
- You can also download the .msi package i.e. windows installer of PHP from sourceforge.net
Prerequisite and running on your Windows system, else you will not be able to run PHP Scripts.
Alternatively, you can install wamp server to install PHP, MySQL, and Apache Web Server on your Windows machine.
Options for installing PHP on Windows
- You can install php on windows manually.
- You can run the .msi package, i.e. windows installer for php to install php.
- Besides full installation, you can install php extensions on an existing installation of PHP.
- You can upgrade to a higher version of PHP from an existing version.
Install PHP on Windows manually
You have to download zipped binary version of PHP from http://www.php.net/downloads.php.
Extract the downloaded file to php folder which must be created at the root of any of your windows drives (e.g. c:php or d:php).
Enter php folder and rename the file php.ini-recommonded to php.ini.
Open the file php.ini with any text editor and find extension_dir within the file.
Change the extension directory, i.e. if you have installed php in php folder of D drive, setting will be extension_dir=D:php.
Now you open Environment Variables (MyComputer -> System Properties -> Environment Variables), under system variables, select Path and click Edit,
in the Variable value, go to the end of the list and put a semicolon, then add D:php;D:phpext assuming D:php is the location of your php installation.
Then Click on New under system variable and add PHPRC against Variable name and D:php against Variable value.
Restart your system.
Install PHP on Windows using Windows installer
Simply run the .msi Windows installer file and follow the installation wizard.
Testing if PHP is installed properly
Create a php file containing code and save it as test.php.
Run this file on your web server and if you get an output like this:
then you have installed PHP properly.
Install PHP extensions on Windows
What is a PHP extension?
A PHP extension is a piece of code which is not part of the core PHP and you need it to explore certain functionalities of PHP (e.g. for using mysql you need mysql extension of PHP).
Many extensions are available out of the box in the PHP installer downloaded from php.net or in the .msi package. But many need to be obtained separately from php.net.
In Windows, extensions come in the form of a .dll file which you can download from php.net.
How do you configure an extension on Windows?
You need to change the setting of extension dir in php.ini file. For example, If you are using PHP 5.0.3, and you have installed php in c:php, then you have to set extension_dir = C:phpext in your php.ini file.
After downloading the files needed, you have to open php.ini and enable a line pointing to an extension in question.
For enabling extensions, you have to uncomment a line in your php.ini file. For example, for enabling mysql extension, you have to change; extension = php_mysql.dll to extension = php_mysql.dll in your php.ini file.
You also need to restart your web server and php in order to complete the installation of a specific extension.
Sample php.ini
Previous: PHP Home
Next: Install php on Linux
Php msi installer
установка PHP на вашем ПК позволяет безопасно создавать и тестировать веб-приложение, не затрагивая данные или системы на вашем веб-сайте.
Для предварительного просмотра страниц с кодом PHP необходим тестовый сервер.
Во-первых, установите HTTP сервер Apache на вашей системе, и удостоверьтесь, что он работает.
Устанавить веб-сервер Apache с поддержкой PHP на операционной системе Windows не сложно.
Используйте сборки Apache, предоставляемые Apache Lounge.
php Установка PHP в системах Windows.
Установка PHP в современных операционных системах Microsoft Windows и рекомендуемая конфигурация для распространенных веб-серверов.
Скачать PHP.
Зайдите на страницу загрузки официального сайта — PHP Archives
Выберите сборку
Есть 2 типа сборок PHP:
- Thread-Safe(TS) — для одного процесса веб-служб, как Apache с mod_php
- Non-Thread-Safe(NTS) — для служб IIS и других FastCGI веб-серверов (Apache с mod_fastcgi) рекомендуется и для сценариев командной строки
Загрузите Thread Safe, если вам нужно запустить PHP в качестве модуля.
Можно установить PHP как модуль, но лучше устанавливать PHP поверх mod_fcgid (fastcgi, best practice)
Программы инсталляции PHP 5 доступны только для 32-разрядных версий Windows, поэтому установка PHP как модуля возможна только на 32-разрядные версии Apache, например — apache_2.2.24-x86-no-ssl.msi.
Не удалось открыть этот пакет установки.
Убедитесь, что пакет существует и у вас есть к нему доступ, или обратитесь к поставщику приложения, чтобы проверить правильность этого пакета установщика.
Такое сообщение появится, если программа инсталляции PHP 5 будет запущена не из корневого каталога диска
После нажатия на кнопку Start
или ввода команд:
cd C:Program FilesApache Software FoundationApache2.4bin
httpd -k start
Будет получено сообщение об ошибке:
Администратор: Командная строка
Строка — xedxe5 xffxe2xebxffxe5xf2xf1xff xefxf0xe8xebxeexe6xe5xedxe8xe5xec Win32.
переводится как: не является приложением Win32
Для установки PHP 5 из установочного пакета запустите ( обязательно из корневого каталога диска ) программу инсталляции.
Процедура инсталляции
PHP в ОС Windows полностью автоматизирована.
Запустите, из корневого каталога диска C:,
программу инсталляции — php-5.3.9-Win32-VC9-x86.msi.
Открыть файл — предупреждение системы безопасности и нажмите — Запустить
В окне — PHP 5.3.9
нажмите кнопку Next.
Прочитайте лицензию и отметьте пункт —
I accept the terms in license agreement
(Я принимаю условия лицензионного соглашения).
Согласитесь с установкой PHP 5 в каталог по умолчанию — C:/Program Files(x86)/PHP/
Нажмите на кнопку Browse,
укажите путь к каталогу, в котором находятся файлы конфигурации сервера Apache —
C:Program FilesApache Software FoundationApache2.2conf
то в середине установки PHP 5
Будет выведено сообщение об ошибке —
«Error trying access httpd.conf file. You will need to manyally conigure the web server».
Ошибка при попытке доступа к файлу httpd.conf. Вам нужно будет вручную настроить веб-сервер
После выбора каталога с конфигурационными файлами сервера Apache
продолжите установку PHP
Installs PHP with all server modules and extensions enabled.
It is recommended to only select the extensions and modules you need below.
Устанавливает PHP с включенными всеми модулями сервера и расширениями.
Рекомендуется выбирать только те расширения и модули, которые вам нужны.
Оставьте установки по умолчанию.
Имеющим определенный опыт, можно сразу установить необходимые модули, нажимая на стрелку выбранного расширения и выделяя пункт- Will be installed on local hard drive (установить на локальный жесткий диск), для добавления необходимого расширения.
Запустите процесс инсталляции PHP
Дождитесь окончания установки PHP
Для завершения процесса инсталляции — нажмите на кнопку Finish.
Сервер Apache 2 PHP 5
Редактирование файла конфигурации Apache — httpd.conf для работы PHP на Windows
Если у вас был установлен сервер Apache 2, то программой установки PHP 5, после блока — #
В конце файла — httpd.conf
(C:/Program Files/Apache Software Foundation/Apache2.4/conf/)
будут добавлены ( выделено красным ) следующие записи:
Файл httpd.conf
После окончания инсталляции в меню — Пуск — Все программы, будет создан новый пункт — PHP 5
После перезагрузки компьютера или перезапуска сервера Apache
К службе Apache/2.2 (Win32) будет добавлена запись — PHP/5.3.9.
Убедитесь, что вы можете запустить PHP из командной строки Windows
введя — cd c:Program Files (x86)PHP и, затем — php -v
Администратор: Командная строка
Список загруженных модулей — php -m
Администратор: Командная строка
PHP: Изменения в файле — php.ini
Включить расширения. Это будет зависеть от библиотек, которые вы хотите использовать, но следующие расширения должны быть пригодны для большинства приложений (удалите комментарий с запятой):
По мере приобретения опыта, вы в любой момент можете добавить необходимые модули из панели управления —
Пуск — Панель управления — Установка и удаление программ — Программы и компоненты,
нажав кнопку — Изменить.
Будет запущена программа инсталляции.
Дойдите до окна диалога — Change, repair, or remote installation и нажмите кнопку Change.
В диалоге — Choose Item to Install, выберите нужный модуль, нажмите на стрелку
и на пункт — Will be installed on local hard drive (установить на локальный жесткий диск),
для добавления необходимого расширения.
Установка PHP на локальный компьютер
Вступление
Продолжаем собирать локальный сервер WAMP на локальной машине (персональном компьютере). В этой статье устанавливаем интерпретатор PHP, он же буква [P] в акрониме WAMP.
Напомню сборка Apache+MySQL+PHP необходима для работы по созданию сайта на своём компьютере, как локальном сервере. Задача многим интересная и часто используемая для работы над проектами. Самостоятельная сборка AMP – задача сложная, связанная с настройкой компьютера и его постоянной исправностью. Для многих это проще, чем работать с удалёнными серверами, ведь компьютерная помощь всегда под рукой. Кроме этого работа с локальным сервером бесплатна.
В прошлых статьях я рассказывал, как установить MySQL, как установить веб-сервер HTTP Apache. Локальный сервер собираем под управлением Windows 7. Пришло время установить PHP.
Устанавливать PHP будем в папку php созданную на системном диске: C:Program FilesPHP.
Где взять PHP
Последнюю версию php берем только на официальном сайте, вот ссылка: https://php.net/downloads.php. еще одна: https://windows.php.net/download#php-7.0. Последнюю версию php7.0 брать не будем, возьмем не такую «революционную» PHP 5.6 (5.6.20). Я беру сборку под 32 битную архитектуру Windows 7 с встроенным инсталлятором Windows.
Установка PHP с инсталлятором (MSI)
Последний PHP с инсталлятором и главное с модулем Apache 2.2. это php-5.3.10-nts-Win32-VC9-x86.msi. Берем его тут: https://windows.php.net/downloads/releases/archives/ его и поставим.
Примечание: Выбираем с модулем Apache 2.2., так как мы собираем WAMP на Apache 2.2, который мы уже установили.
Установка PHP при помощи инсталлятора (MSI) простая, в несколько окон:
1. Запускаем скаченный файл php-5.3.10-nts-Win32-VC9-x86.msi.
Первое окно установки php-5.3.10
2. Знакомимся с лицензией и согласившись с ней, идем дальше, нажимая кнопку «Next».
3. На этой странице задаем папку, в которую ставим PHP. Пусть это будет каталог: [C:Program filesPHP]
4. На следующей странице, выбираем используемый веб-сервер. В нашей сборке это Apache2.
5. На этой странице нужно выбрать модули PHP, которые нам будут нужны. Для подстраховки выбираем всё.
Жмем Install для установки php-5.3.10
Видим процесс окно установки php-5.3.10
Всё! Установка PHP на локальный компьютер завершена.
Php msi installer
The Windows PHP installer for later versions of PHP is built using MSI technology using the Wix Toolkit (» http://wix.sourceforge.net/). It will install and configure PHP and all the built-in and PECL extensions, as well as configure many of the popular web servers such as IIS , Apache, and Xitami.
Normal Install
Run the MSI installer and follow the instructions provided by the installation wizard. You will be prompted to select the Web Server you wish to configure first, along with any configuration details needed.
You will then be prompted to select which features and extensions you wish to install and enable. By selecting «Will be installed on local hard drive» in the drop-down menu for each item you can trigger whether to install the feature or not. By selecting «Entire feature will be installed on local hard drive», you will be able to install all sub-features of the included feature (for example by selecting this option for the feature «PDO» you will install all PDO Drivers).
It is not recommended to install all extensions by default, since many of them require dependencies from outside PHP in order to function properly. Instead, use the Installation Repair Mode that can be triggered thru the ‘Add/Remove Programs’ control panel to enable or disable extensions and features after installation.
The installer then sets up PHP to be used in Windows and the php.ini file, and configures certain web servers to use PHP. The installer will currently configure IIS, Apache, Xitami, and Sambar Server; if you are using a different web server you’ll need to configure it manually.
Silent Install
The installer also supports a silent mode, which is helpful for Systems Administrators to deploy PHP easily. To use silent mode:
You can control the install directory by passing it as a parameter to the install. For example, to install to e:php:
You can also specify what features to install. For example, to install the mysqli extension and the CGI executable:
The current list of Features to install is as follows:
For more information on installing MSI installers from the command line, visit » http://msdn.microsoft.com/en-us/library/aa367988.aspx
Upgrading PHP with the Install
To upgrade, run the installer either graphically or from the command line as normal. The installer will read your current install options, remove your old installation, and reinstall PHP with the same options as before. It is recommended that you use this method of keeping PHP updated instead of manually replacing the files in the installation directory.
Two aspects of a typical Windows installation:
1) The default behavior for short_open_tag is OFF. You must edit php.ini and explicitly set it to ON. This means most developers will have their source code displayed rather than the script executed. short_open_tag OFF means the php tags must be and the shorter will not be interpreted.
2) When using php as cli from the command line, Windows 7 will perform the file association in such a way that running a script from the command line will not accept additional arguments. Note, however that typing the full path to the executable will see arguments. As Windows 7 has a limited file associations GUI, the fix is to open regedit and change the key HKEY_CLASSES_ROOTApplicationsphp.exeshellopencommand from its default value of «C:phpphp.exe» «%1» to instead read «C:phpphp.exe» «%1» «%2» «%3» «%4» «%5» «%6» «%7» «%8» «%9»
run php as CGI binary, and add these to httpd.conf,
#BEGIN PHP INSTALLER EDITS — REMOVE ONLY ON UNINSTALL
ScriptAlias /php/ «C:/php/»
Action application/x-httpd-php «C:/php/php-cgi.exe»
#END PHP INSTALLER EDITS — REMOVE ONLY ON UNINSTALL
AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
AllowOverride None
Options None
Order allow,deny
Allow from all
AllowOverride None
Options None
Order allow,deny
Allow from all
finally it works
for running php5.3 on IIS6 I had to add an Web Service Extension:
IIS6 / Web Service Extensions
Add an WSExtension
ex. PHP — File to use . PHPphp-cgi.exe ( Filetype cgi_exe )
And switch to «allowed»
( In earlier versions of php there was an php5isapi.dll
which could be set as WebService Extention. But this is now
replaced from cgi/fastcgi )
Tryed installing PHP several times using the MSI instalation, which defaults to «C:Prorame FilesPHP», and could not work at all.
The OS: Windows XP, with SP3
Web Server: IIS 5.1
Step 1: Install the MSI Instalation, but make sure you select the instalation folder to be «C:PHP» and NOT «C:Programe FilesPHP».
Step 2: Copy the «php.ini» fil from «C:PHP», to «C:Windows» folder. Keep the default settings, so far OK.
Step 3: Go to IIS, Open «Default Website», Properties, and open the «Home Directory» tab, and then «Configue» buttton.
Step 4: Click ‘Add» under Mappings Tab, and browse for «C:PHPphp-cgi.exe» file from ‘Browse’, and add «.php» (i.e. without the Qoutes «»). Keep «Verb» settings to «All Verbs» and click «OK»
Step 5: Create a php file with : (); ?> , and test.
It should be working fine by this time.
Hope this was helpful to all.
On IIS 5.1 (Windows XP) and IIS 6.0 (Windows Server 2003) the following installation method goes very smoothly, but for three additional tasks.
Before installing PHP 5.2.x using the Microsoft Web Platform Installer, make sure:
C:PHP does not exist
C:Program FilesPHP does not exist (it will be created)
C:Windowsphp.ini does not exist (you won’t need it there)
Run Microsoft Web Platform Installer allowing it to install FastCGI support and PHP 5.2.x.
After installation you should have PHP installed in C:Program FilesPHP.
An examination of php.ini will show you will not likely need to change any settings, except the sendmail_from address. The Windows specific settings have been set, but are grouped together under:
; Default timeout for socket based streams (seconds)
Those are:
upload_tmp_dir=»C:WINDOWSTemp»
session.save_path=»C:WINDOWSTemp»
error_log=»C:WINDOWStempphp-errors.log»
cgi.force_redirect=0
fastcgi.impersonate=1
fastcgi.logging=0
In addition to having the correct minimal IIS settings already set in php.ini, you will find the Path has had C:Program FilesPHP added, and the environment variable PHPRC is set correctly.
The three things not performed by the install but needed to run:
1.
HKEY_LOCAL_MACHINESoftwarePHPIniFilePath may be wrong. It should not be C:Windows, but C:Program FilesPHP, which is what is set in both the PATH and PHPRC. (This could be a left over setting from a previous install, but the installer does not correct it.)
2.
In IIS manager, under the default web site properties, Home Directory (tab), Configuration (button), Mappings, the entry for .php may be missing or wrong. It should be:
Executable: «C:Program FilesPHPphp-cgi.exe» with the quotes.
Verbs: Limit To: GET,HEAD,POST,TRACE
Script Engine checkbox checked
Check That File Exists checkbox checked.
3.
The installer will not set the proper security permissions for php-cgi.exe or php.ini, both of which need to be accessible to the default Internet user account: e.g. IUSR_machine name.
In Windows Explorer, navigate to the C:Program FilesPHP folder, right click, properties, security (tab), add IUSR_machinename and accept the default security permissions.
All of these seemed to take effect without a reboot, but a reboot is suggested. Note: Items 1 and 2 may be left over from previous installations and might possibly be rightly ignored by the installer, but if they are not corrected (at least check) you are going to have a problem.
Item 3 is not going to be performed by the installer. You will have to do it based on how you have security permissions set in IIS.
Apache2 on Windows (PHP 5.3.1):
Install VC6 x86 THREAD SAFE. If you do not see Apache in the list of webservers, it is because you downloaded the NON-THREAD SAFE installer.
I have just spent a tiresome morning trying to get PHP 5.2 / 5.3 installed onto Apache 2.2 (WinXPSP2) (Slight oddity in setup that program files on D: drive)
I have finally got it to work by using the following:
1) Getting installation script to use «Other CGI» (would be nice if it mentioned Apache — I believe it to be a fairly popular option)
2) Adding the following directives to httpd.conf (the Apache configuration file)
ScriptAlias /php/ «D:/Program Files/PHP/»
(This tells Apache to treat the PHP directory as script files/executables and alias it under /php/ for ease of use later)
AddHandler x-httpd-php .php
(This tells apache to recognise all .php files as of type x-httpd-php (equally you could call them anything you liked and after this mornings debacle I can think of one or two choice phrases)
Action x-httpd-php «php/php-cgi.exe»
(The tells Apache to use php-cgi.exe to handle files of type x-httpd-php (or .php files as we declared earlier). php-cgi.exe only exists if you have selected the «Other CGI» option at installation». A lot of stuff around on the web is pointing at php.exe which is now failing. Has this changed recently?)
Using the installer, I have been getting the «cannot run script» error on Windows XP and IIS 5.1. I used both the Zip file and installer filer to make it successful:
1. I downloaded the zip file (not the installer) into C:php,
2. extracted the contents to the same directory (C:php).
3. Downloaded and ran the installer into the C:php
I just installed PHP 5.2.8 (MSI package) on windows XP, IIS 5.1.
Selected IIS-ISAPI, always got error «The specified module could not be found.» (firefox), HTTP 500 Internal Server Error (ie 7). Even though no extensions were selected.
Trick: Install PHP to C:PHP (and not to C:Program FilesPHP)
In your IIS web site properties, tab home directory, configuration, application mappings.
Remove the quotes before and after the executable path and the problem will be solved.
I just installed PHP 5.2.8 as an ISAPI-extension for IIS 6 in Windows 2003 server.
I used the Windows installer, but had to make a few changes manually: