установка php ext php
Установка php ext php
Данный модуль устарел, начиная с версии PHP 5.5.0, и удалён в PHP 7.0.0. Используйте вместо него MySQLi или PDO_MySQL. Смотрите также инструкцию MySQL: выбор API. Альтернативы для данной функции:
Несмотря на то, что модуль MySQL совместим с MySQL 4.1.0 и выше, он не поддерживает дополнительную функциональность, предоставляемую этими версиями. Для получения такой возможности воспользуйтесь модулем MySQLi.
Если вы хотите установить модуль mysql совместно с mysqli, то для избежания каких-либо конфликтов необходимо использовать одну и ту же клиентскую библиотеку.
Установка на Linux-системы
Примечание: [DIR] является путём к файлам клиентской библиотеки MySQL ( заголовкам и библиотекам), которые можно скачать с » MySQL.
PHP Версия | По умолчанию | Опции настройки: mysqlnd | Опции настройки: libmysqlclient | Список изменений |
---|---|---|---|---|
4.x.x | libmysqlclient | Недоступно | —without-mysql для отключения | MySQL включён по умолчанию, клиентские библиотеки MySQL входят в поставку PHP |
5.0.x, 5.1.x, 5.2.x | libmysqlclient | Недоступно | —with-mysql=[DIR] | MySQL больше не включён по умолчанию, и клиентские библиотеки MySQL больше не входят в поставку PHP |
5.3.x | libmysqlclient | —with-mysql=mysqlnd | —with-mysql=[DIR] | Стал доступен mysqlnd |
5.4.x | mysqlnd | —with-mysql | —with-mysql=[DIR] | mysqlnd выбирается по умолчанию |
Установка на Windows-системы
PHP 5.0.x, 5.1.x, 5.2.x
PHP 5.3.0+
Замечания по установке MySQL
Сбои в работе PHP могут возникнуть при загрузке этого модуля вместе с модулем recode. За дополнительной информацией обращайтесь к разделу о модуле для recode.
Если вам требуется поддержка кодировок отличных от latin, (установленной по умолчанию), вам придётся установить внешнюю библиотеку libmysqlclient, скомпилированную с их поддержкой.
Руководство по ручной установке
Этот раздел содержит инструкции для ручной установки и настройки PHP на Microsoft Windows.
Выбор и загрузка пакета дистрибутивов PHP
Если PHP используется с IIS, тогда следует использовать PHP 5.3 VC9 Non Thread Safe или PHP 5.2 VC6 Non Thread Safe;
Если PHP используется с IIS7 или выше и версия PHP 5.3+, тогда должна использоваться версия дистрибутива PHP VC9.
Если PHP используется с Apache 1 или Apache 2 тогда выбирайте PHP 5.3 VC6 или PHP 5.2 VC6.
Версии VC9 компилируются с помощью Visual Studio 2008 и имеют улучшенную производительность и стабильность. Версии VC9 требуют наличия в системе » Microsoft 2008 C++ Runtime (x86) или » Microsoft 2008 C++ Runtime (x64).
Структура пакетов PHP и их содержимое
Распакуйте содержимое zip архива в директорию по вашему выбору, например C:\PHP\. Директория и структура файлов, извлеченных из zip, будет такой:
Пример #1 Структура пакета PHP 5
Ниже представлен список модулей и исполняемых файлов, включенных в PHP zip дистрибутив:
Изменение файла php.ini
После того, как содержимое пакета php извлечено, создайте копию php.ini-production с именем php.ini в той же папке. Если необходимо, также возможно разместить php.ini в любом другом месте по вашему выбору, но это потребует дополнительной настройки, которая приводится в разделе Настройка PHP.
После установки PHP в вашей системе, следующим шагом будет выбор веб-сервера и его дальнейшая настройка для работы с PHP. Выберите конкретный веб-сервер в оглавлении к данному материалу.
Помимо запуска PHP с помощью веб-сервера, PHP может быть запущен из командной строки как .BAT скрипт. За более подробной информацией обращайтесь к материалу Консоль PHP на Microsoft Windows.
Установка php ext php
On Windows, you have two ways to load a PHP extension: either compile it into PHP, or load the DLL. Loading a pre-compiled extension is the easiest and preferred way.
To load an extension, you need to have it available as a «.dll» file on your system. All the extensions are automatically and periodically compiled by the PHP Group (see next section for the download).
To compile an extension into PHP, please refer to building from source documentation.
To compile a standalone extension (aka a DLL file), please refer to building from source documentation. If the DLL file is available neither with your PHP distribution nor in PECL, you may have to compile it before you can start using the extension.
Where to find an extension?
PHP extensions are usually called «php_*.dll» (where the star represents the name of the extension) and they are located under the «PHP\ext» folder.
PHP ships with the extensions most useful to the majority of developers. They are called «core» extensions.
However, if you need functionality not provided by any core extension, you may still be able to find one in » PECL. The PHP Extension Community Library (PECL) is a repository for PHP Extensions, providing a directory of all known extensions and hosting facilities for downloading and development of PHP extensions.
If you have developed an extension for your own uses, you might want to think about hosting it on PECL so that others with the same needs can benefit from your time. A nice side effect is that you give them a good chance to give you feedback, (hopefully) thanks, bug reports and even fixes/patches. Before you submit your extension for hosting on PECL, please read » PECL submit.
Which extension to download?
You should keep in mind that your extension settings should match all the settings of the PHP executable you are using. The following PHP script will tell you all about your PHP settings:
Установка в системах Windows
Содержание
Установка PHP в современных операционных системах Microsoft Windows и рекомендуемая конфигурация под распространённые веб-серверы.
Официальные релизы PHP для Windows рекомендованы для использования в промышленной эксплуатации. Однако, вы также можете собрать PHP из исходных кодов. Вам потребуется окружение Visual Studio. Обратитесь к разделу » Пошаговое руководство по сборке для получения более полной информации.
Установка PHP на Azure App Services (он же Microsoft Azure, Windows Azure, или (Windows) Azure Web Apps).
User Contributed Notes 12 notes
If you make changes to your PHP.ini file, consider the following.
(I’m running IIS5 on W2K server. I don’t know about 2K3)
PHP will not «take» the changes until the webserver is restarted, and that doesn’t mean through the MMC. Usually folks just reboot. But you can also use the following commands, for a much faster «turnaround». At a command line prompt, type:
and that will stop the webserver service. Then type:
and that will start the webserver service again. MUCH faster than a reboot, and you can check your changes faster as a result with the old:
in your page somewhere.
I wish I could remember where I read this tip; it isn’t anything I came up with.
You can have multiple versions of PHP running on the same Apache server. I have seen many different solutions pointing at achieving this, but most of them required installing additional instances of Apache, redirecting ports/hosts, etc., which was not satisfying for me.
Finally, I have come up with the simplest solution I’ve seen so far, limited to reconfiguring Apache’s httpd.conf.
Here it is (Apache’s httpd.conf contents):
—————————
# replace with your PHP4 directory
ScriptAlias /php4/ «c:/usr/php4/»
# replace with your PHP5 directory
ScriptAlias /php5/ «c:/usr/php5/»
# populate this for every directory with PHP4 code
Action application/x-httpd-php «/php4/php.exe»
# directory where your PHP4 php.ini file is located at
SetEnv PHPRC «c:/usr/php4»
# remember to put this section below the above
# directory where your PHP5 php.ini file is located at
SetEnv PHPRC «c:/usr/php5»
—————————
This solution is not limited to having only two parallel versions of PHP. You can play with httpd.conf contents to have as many PHP versions configured as you want.
You can also use multiple php.ini configuration files for the same PHP version (but for different DocumentRoot subfolders), which might be useful in some cases.
Remember to put your php.ini files in directories specified in lines «SetEnv PHPRC. «, and make sure that there’s no php.ini files in other directories (such as c:\windows in Windows).
Hope this helps someone.
If you are installing PHP on Vista just go to David Wang’s blog. http://blogs.msdn.com/david.wang/
archive/2006/06/21/HOWTO-Install-and-Run-PHP-on-IIS7-Part-2.aspx
I made the mistake of setting a ‘wildcard application map’ for PHP on a Windows 2003 / IIS 6.0 / PHP ISAPI installation.
This resulted in «No input file specified» errors whenever I tried to load the default page in my site’s directories. I don’t know why this broke things, but it did.
If anyone has the same problem, this may be the cause.
IIS setup: 403 forbidden error.
Despite this, php version 5.1.4 was being loaded. We renamed 5.1.4’s folder and then PHP was not loading at all.
There were no visible references to 5.1.4 in the IIS configuration, but in the file \webConfig.xml, there was a reference to 5.1.4’s isapi under IISFilters.
To fix this problem, we added version 5.2.5’s php5isapi.dll to the ISAPI Filter category for the web site, in the IIS control panel.
I installed by Microsoft Installer, manually, whatever I always received de same error from IIS7.
The IIS7 interface is quite diferent and are not all together like IIS6
The 5.3 version have not any of those files: php5stdll, php5isapi.dll. etc.
The installer puts others files in handlers and I decided to use them as substitutes. Nothing done!
After that, I discovered that installer do not install these files within the sites, but in the root default site configuration of IIS7.
So, I copied the root configuration to my site and them it worked (all others procedures were done e.g. copy php.ini to windows folder)
If you get 404 page not found on Windows/IIS5, have a look at C:\SYSTEM32\INETSRV\URLSCAN
Here’s how to run dual PHP instances with PHP 5.2 and any previous PHP on Windows 2003:
1. Right-click My Computer, go to Advanced tab, and click on Environment Variables.
Add the two installations and their EXT directories to the Path variable. For example, add:
c:\php;c:\php\ext;c:\TMAS\php;c:\tmas\php\ext;
Then, add the newer PHP version’s directory as a variable called PHPRC. For example:
Variable:PHPRC
Value: C:\PHP
Click OK to close the Environment Variables window, and click OK to close System Properties.
2. In registry, under HKEY_LOCAL_MACHINE>SOFTWARE>PHP, add a REG_SZ key called iniFilePath and give it a value
of the directory where the older PHP is installed. For example:
C:\TMAS\PHP
3. In IIS, go to the Web Service Extensions. Add both versions’ ISAPI module separately to the extensions
list, and allow both.
Testing Date: 05.15.09
Background:
For several days now I, as a newbie, have been unsure if I had installed PHP correctly, or not. No matter what I did phpinfo( ) reported «Configuratin File Path» as: “C:\WINDOWS”. I was left to wonder what was wrong.
To help resolve the phpinfo() “issue”, I conducted a series of tests using two scripts:
The first is “test-php-ini-loaded.php”; it is stored in c:\inetpub\wwwroot, and has the following code:
Установка
Этот раздел содержит общие вопросы о том, как производится установка PHP. Дистрибутивы PHP доступны почти для всех операционных систем и веб-серверов.
Для установки PHP, следуйте инструкциям: Установка и настройка.
Unix: Я установил PHP, но при каждом открытии какого-либо документа вижу ‘Document Contains No Data’, что это значит?
Это значит, что, возможно, PHP столкнулся с какой-то проблемой и падает в core-dump. Просмотрите логи ошибок сервера, чтобы проверить это, а затем попытайтесь воспроизвести цепочку шагов, приведших к ошибке; например, создав отдельную тестовую программу. И если вы умеете пользоваться ‘gdb’, то это поможет вам получить стек вызовов функций (backtrace) для включения его в отчёт об ошибке, чтобы облегчить выявление причин проблемы разработчикам. Если вы пользуетесь PHP как модулем для Apache, вам может оказаться полезным следующее:
Вновь остановите httpd-процессы
Затем скопируйте URL,вызвавший проблему в браузере
Если будет происходить core dump, gdb сообщит вам об этом
Включите backtrace в ваш отчёт об ошибке. И отправьте по адресу: » https://bugs.php.net/
Если ваш скрипт использует регулярные выражения ( preg_match() и подобные), проверьте, с одинаковыми ли пакетами обработки RegEx скомпилированы PHP и Apache? В случае PHP и Apache 1.3.x это происходит автоматически.
Unix: Я установил PHP используя RPMS, но Apache не обрабатывает PHP-страницы, в чём дело?
Если что вы установили и Apache, и PHP из RPM-пакетов, вам понадобится раскомментировать или добавить некоторые (или, быть может, все) строки из числа следующих, в вашем файле httpd.conf :
Unix: Я пропатчил Apache модулем FrontPage, и теперь PHP не работает. Т.е. PHP несовместим с модулями Apache FrontPage?
Нет, совместим, но патч FrontPage влияет на структуры Apache, нужные для PHP. Перекомпиляция PHP (команда ‘make clean ; make’) после установки патча может решить проблему.
Unix/Windows: Я установил PHP, но при попытке открыть PHP-файл браузером вижу просто пустой экран.
Выберите в браузере опцию «посмотреть код» и вы, возможно, увидите, ваш PHP-код. Это значит, что Apache не передал ваш скрипт интерпретатору PHP. Значит что-то неправильно с конфигурацией сервера. В этом случае перепроверьте конфигурацию веб-сервера в соответствии с инструкциями по установке PHP.
Unix/Windows: Я установил PHP, но когда пытаюсь посмотреть созданную PHP-страницу через браузер, то получаю ошибку 500.
Некоторые операционные системы: Я установил PHP без каких-либо ошибок, но когда пытаюсь запустить Apache, мне выводится ошибка:
Windows: Я установил PHP, но когда пытаюсь открыть страницу скрипта через браузер, получаю ошибку:
Как я могу понять, что мой php.ini найден и используется? Такое впечатление, что вносимые мною изменения игнорируются.
Как я могу добавить директорию с PHP в PATH в Windows?
Старт → Панель Управления → Система
Перейдите на вкладку ‘Дополнительно’
Нажмите кнопку ‘Переменные Окружения’
Посмотрите раздел ‘Системные Переменные’
Найдите строку, содержащую переменную PATH
Совершите на ней двойной щелчок мышью
Допишите в конец строки путь к PHP, не забыв добавить перед ним ‘;’ (например ;C:\php )
Замечание: Не забудьте перезагрузиться после описанных выше действий и, после перезагрузки, проверить, что переменная PATH содержит нужный путь.
Можно ли использовать согласование контента Apache (опция MultiViews) с PHP?
PHP ограничен работой только с методами GET и POST?