Menu
Is free
check in
the main  /  the Internet / Install P. Installing PHP.

Install P. Installing PHP.

The course is intended for the basic training of administrators of sites created on "1C-Bitrix: Site Management". Having studied the course, you master the main methods of system administration, as well as replenish the knowledge on topics learned Content manager.

If you conscientiously study the course, then learn:

  • manage access to system, sites, users, user groups;
  • work with system tools;
  • use the capabilities of the system management interface;
  • work with Modules "1C-Bitrix: Management Site" associated with the optimization and safety of the site;
  • perform the configuration of the web system for optimal work.

If you are preserved independent installation Systems or website transfer to hosting, then without a course Installation and Setup Course Installation and Setup Designed for the specialists of the "1C-Bitrix: Site Management" or "Bitrix24 in the box".

Download Course Materials in CHM format.

How to undergo a training course?

Developer site: http://www.php.net/
Distribution (VC9 X86 Thread Safe, Zip Archive): http://windows.php.net/download/
Direct link: php-5.3.10-win32-vc9-x86.zip.
At the same time, download immediately and documentation in Russian in format.chm, you will need it when learning and work: php_enhanced_en.chm

Unpack the archive to the desired directory (initially offered "C: \\ PHP"). Open configuration file. Containing the recommended settings is "php.ini-development" (located in the root distribution), rename it in php.ini and make the following changes.

Editorial Php.ini:

  1. Find the string:
    post_max_size \u003d 8m
    Increase to 16 MB maximum size Data taken pOSTBy changing it on:
    post_max_size \u003d 16m.
  2. Find the string:
    ; include_path \u003d ".; C: \\ PHP \\ INCLUDES"
    Unset it, removing the point with a comma in front of the string.
    (ATTENTION Exception! Return skeins when specifying the path):
    include_path \u003d ".; c: \\ php \\ includes"
    Create an empty C: \\ PHP \\ INCLUDES directory, to store connected classes.
  3. Find the string:
    extension_dir \u003d "./"
    Set this directive the path to the folder with extensions:
    EXTENSION_DIR \u003d "C: / PHP / EXT"
  4. Find the string:
    ; Upload_tmp_dir \u003d.
    Allow it and specify the following path in the value:
    Upload_TMP_DIR \u003d "C: / PHP / UPLOAD"
    Create an empty folder "C: \\ PHP \\ UPLOAD", to store temporary files downloaded via HTTP.
  5. Find the string:
    Upload_max_FileSize \u003d 2m.
    Increase the maximum allowable size of downloaded files up to 16 MB:
    Upload_max_FileSize \u003d 16m.
  6. Connect, unchanging, expansion library data:
    EXTENSION \u003d php_bz2.dll
    Extension \u003d php_curl.dll.
    EXTENSION \u003d PHP_GD2.DLL
    EXTENSION \u003d php_mbstring.dll
    Extension \u003d php_mysql.dll
    EXTENSION \u003d php_mysqli.dll
  7. Find the string:
    ; Date.TimeZone \u003d.
    Allow and set the time zone of your location (the number of time zones can be found in the documentation):
    Date.TimeZone \u003d "Europe / Moscow"
  8. Find the string:
    ; session.save_path \u003d "/ tmp"
    Unset and set the value of this directive Such path:
    session.save_path \u003d "C: / PHP / TMP"
    Create an empty folder "C: \\ PHP \\ TMP" to store temporary session files.

Save the changes and close the php.ini file.

Next, you need to add a directory with installed PHP. Interpreter in Path. operating system. Why walk along the path "Start" ("Start") -\u003e " Control Panel."(" Control Panel ") -\u003e" System "(" System "), open the Advanced tab (" Advanced "), click Environment Variables (" Environment Variables"), In the section" System Variables "(" System Variables ") Make double-click On the "Path" string, add to the "Variable Value" field, to the fact that there already exists, the path to the directory with the PHP installed, for example, "C: \\ PHP" (without quotes). Pay attention to the fact that the decimal point symbol shares the paths. So that the changes have entered into force, restart the operating system.

Example of Path Row:
% Systemroot% \\ System32;% Systemroot%;% Systemroot% \\ System32 \\ WBEM; C: \\ PHP; C: \\ Program Files \\ MySQL \\ MySQL Server 5.5 \\ Bin

Installation I. pHP Setup Interpreter - completed.

Description of connected libraries:

php_bz2.dll - With this PHP extension, it will be able to create and unpack the archives in the BZIP2 format.

php_curl.dll - Very important and necessary library, allowing to connect and work with servers using huge number Internet protocols.

php_gd2.dll - Another indispensable library that allows you to work with graphics. Did you think on PHP you can only generate HTML pages? And here is not! FROM using PHP. You can almost everything, including to draw.

php_mbstring.dll - The library contains functions for working with multi-byte encodings, which include the encoding of eastern languages \u200b\u200b(Japanese, Chinese, Korean), Unicode (UTF-8) and others.

php_mysql.dll - The library name speaks for itself - it is necessary for working with MySQL server.

php_mysqli.dll - This library is an extension of the previous one and contains additional pHP functions To work with MySQL Server version 4.1.3 and above.

Data libraries should be enough for a full-fledged php works. Over time, if such a need appears, you can connect additional libraries, but you should not connect them immediately with the idea that the porridge does not spoil the oil, in this case the unnecessary number of connected libraries can noticeably slow down the PHP.

Original Articles: http://php-myadmin.ru/learning/instrument-php.html

PHP SetupAs it turned out, not a very difficult lesson. Acquainted with pHP 5.3 settings can be in the file " php.ini.", Located in windows directory (The path to the configuration file looks like this: "% windows% \\ php.ini". It is definitely expected to backup located in the PHP \\ backup directory. PHP settings file can be edited differently, remove comments from it and Explanations (by the way, the same operations can be carried out with the "httpd.conf" file. PHP.INI file syntax: "Directive \u003d value." It looks like this:

Directive \u003d value; Explanation of the directive \u003d; directive \u003d value; directive \u003d

etc.

In configuration pHP file There is a specialized comment sign - ";". All that is after this sign is not perceived.

General settings

For settings PHP Apache. We need to record the PHP.ini configuration file.
Directive, giving the right to conclude pHP code In short tags:

Short_open_tag \u003d ON.

Including this directive, you can enter into such tags "", Instead of such" ".

To facilitate script debugs, you can enable error output directly to your browser:

Display_errors \u003d ON.

Show all errors other than comments:

Error_Reporting \u003d E_ALL & ~ E_NOTICE

Record error in the log file, which, however, is better to disable for local use:

Log_errors \u003d off.

A procedure in which PHP will register permanent (E - built-in variables, G - GET variables, P - POST variables, C - Cookies, S sessions). The absence of any of the letters will not allow you to work with the appropriate variables, so you need to ask the following order:

Variables_Order \u003d "EGPCS"

The ability to access the variables entering the GET / POST / COOKIE / session, as an ordinary variable (for example, "$ variable"), as it was possible to access these variables only through superglobal arrays. Enable recommended only in specific cases (for example, "$ _post [" variable ']):

Register_globals \u003d ON.

Disabling automatic quotes processing in POST / GET / COOKI:

Magic_Quotes_gpc \u003d OFF.

File download settings

Directive, allowing file download:

File_uploads \u003d ON.

Upload_tmp_dir \u003d C: \\ temp \\ uploadtemp

The maximum file size downloaded by you:

Upload_max_FileSize \u003d 3m.

Dynamically downloadable extensions

Path to folder with extensions:

EXTENSION_DIR \u003d EXTENSIONS.

or absolute:

EXTENSION_DIR \u003d C: \\ Server \\ PHP \\ Extensions

Connecting dynamic libraries. It is recommended to include only the library you need. In order to connect a particular library, you can simply unset the line. For example, to connect the GD graphics library, unavomat the following line:

EXTENSION \u003d PHP_GD2.DLL

SMTP Server Setup

Used SMTP server:

SMTP \u003d Localhost.

SMTP_PORT \u003d 25.

The address that will be indicated in the "From" field in:

Sendmail_From \u003d. [Email Protected]

Setting up MySQL.

We all work with different versions PHP, therefore, it is necessary to configure them in different ways. In later versions of PHP, there is support built into the nucleus of the MYSQL database, and in earlier - no. So, if in the archive with the extensions you downloaded, there is no library "php_mysql.dll", then yours pHP version Supports MySQL, if this library is present, then you need to connect it:

Extension \u003d php_mysql.dll

Specifying port:

Mysql.default_port \u003d 3306.

and the default MYSQL host

Mysql.default_host \u003d localhost

Setting the sessions

Store session data in files:

Session.Save_Handler \u003d Files.

Folder for storing session files (do not forget to create this catalog!):

Session.save_path \u003d c: / temp / session

Use cookie in sessions:

Session.use_cookies \u003d 1.

Use the session session as a session name and session cookie:

Session.name \u003d phpsessid

Ban on initialization of the session at the beginning of the connection:

Session.auto_start \u003d 0.

Life time of session cookie ("0" - before closing the browser window):

Session.Cookie_Lifetime \u003d 0.

Session.use_trans_sid \u003d 1.

PHP Setup Completed. You need to restart Apache in order for the changes to take effect.
Materials from the thematic site CodeNet.Ru were used.

PHP is one of the most popular programming languages \u200b\u200bfor creating websites and web applications. It has developed many ready-made content management systems for blogs, sites of firms or even online stores. Despite the fact that this language has its drawbacks, it is quite easy to learn and is therefore very often used to develop new sites.

PHP interpreter can be supplied as a module for Apache, perform scripts from command line Or in the form of a separate PHP-FPM service. These services are distinguished by their capabilities and purpose, but for any type of interpreter you need to ask basic settings, eg, work folderEnabled extensions, error mapping and so on. All these settings are set via the php.ini file. In this manual, we will look at how to configure the php.ini file in the operating linux systemsAlthough all information is suitable for Windows.

If you have not yet installed a PHP programming language interpreter, then you can familiarize yourself with the article.

For each version of the interpreter, the PHP.ini configuration file is located in a separate folder. But all configuration files are located in the / etc / PHP folder, for example, / etc / php5:

Conf.d folder contains general settings For various extensions and modules, they will not interest us now. The following three folders are more interesting - Apache, CLI and FPM. They contain PHP.ini configuration files for each of these interpreters.

If you are going to use a few of these interpreters, then you will have to specify the settings for each of them separately. You can make sure that in each folder lies the php.ini file.

As for the file syntax, it is divided into sections, first the PHP setting section, which is divided into subsection, depending on the type of settings, the settings of different modules are followed. The syntax of the settings themselves is very simple, it corresponds to the familiar syntax of INI files. The string begins with the configuration name, then the sign should be equal, and the value for it:

name_Name \u003d value of parametrats

Symbols indicate the name of the section, for example, and a symbol; Means a comment, it and all characters after it are not read by the interpreter. Now consider how to configure php.ini and by moving the most important parameters.

Setting up the php.ini file

For ease of orientation, we will break all the parameters by categories depending on their purpose. You will find enough to find the desired parameter and change its value. And now open the PHP settings file, for example, for the Apache module and proceed to the setting. To avoid errors, do not add new lines, but look for already existing and change the values \u200b\u200bto the desired:

sudo gedit /etc/php5/apache/php.ini.

First there is some information about the file itself in the form of comments, then the settings you are interested in.

Output errors in PHP

PHP 7 Setup usually begins with error output configuration. All error output settings are in the Error Handling and Logging section. By default, the output of errors on the screen during the execution of the script is disabled. This is done so that users cannot see anything superfluous. Instead, all errors are written in the log file. If you use PHP on home computer, then such measures are not needed and you can immediately display everything on the screen:

display_errors \u003d off.

Replace Off on ON. Used in PHP different types Errors, such as critical, warnings, syntax errors, using the ERROR_Rer_Reporting string you can enable the output of only certain types of errors:

error_Reporting \u003d E_ALL & ~ E_DepRecated

If you need to combine multiple error types, then use the & and, and to disable the display, place before the type sign ~. The example above displays all errors (E_ALL), except for reports on outdated functions (E_DepRecated). You can disable all types using 0:

error_Reporting \u003d 0.

Turn on the PHP error record in the log file, if you do not output them:

In order not to clog the log of the same type, you can ignore the repetitive errors within one version:

ignore_repeated_errors \u003d ON.

Resource restrictions

If pHP scripts They did not limit themselves in resources, they could easily overload the server and not to give it to work normally. Therefore, by default PHP establishes hard restrictions, but you may need to loosen them a little.

By default, the maximum execution time of the script is 30 seconds, let's take a minute:

max_execution_time \u003d 30.

If you specify 0, the script can be performed infinitely. You can also limit the time during which the script will upload data, 60 seconds:

max_input_time \u003d 60.

Maximum number of variables in GET and POST:

max_input_vars \u003d 1000.

The following parameter sets the maximum amount of memory that one script can use during its execution, in megabytes:

memory_Limit \u003d 128m.

The maximum amount of data transmitted to the POST request is also limited, the default size is 8 megabytes:

post_max_size \u003d 8m

You can limit the PHP action area in the system using the OpenBase_Dir option, it indicates the folder above which the script cannot access file System:

oPEN_BASEDIR \u003d / VAR / WWW /

Using Disable_Functions and Disable_Classes directives, you can disable the use of certain functions or classes in scripts, for example, it can be useful for web hostings. In this example, we turn off the use of the INI_SET function, which allows you to change PHP settings from the script:

disable_functions \u003d ini_set.

Default directory

The PHP.ini setup file allows you to specify paths in the default file system for various actions. You can set folders where the system will search for scripts if you try to connect them using the INCLUDE instruction:

include_path \u003d ".: / usr / Share / PHP5: / USR / Share / PHP5 / PEAR"

Folder with PHP modules:

extension_dir \u003d "./"

Folder for recording temporary files:

sYS_TEMP_DIR \u003d "/ TMP"

In order for users to download their files to a server, for example, a photo, you need to enable this feature in PHP:

file_uploads \u003d ON.

Maximum size of the downloaded file:

upload_max_FileSize \u003d 2m.

Maximum number of files that one script can be downloaded:

mAX_FILE_UPLOADS \u003d 20.

The PHP.ini setting is almost completed, we have only expansion.

Extension setting

Extensions allow you to greatly increase PHP functionality. For example, thanks to extensions, you can use the base in your scripts. mySQL data, PostgreSQL, MySqli, Sqlite, GD graphic library and much more. All this is included in this section.

To enable extension, it is enough to remove the comment in front of the line with its command, for example:

eXTENSION \u003d PHP_MYSQL.SO.
EXTENSION \u003d PHP_MBSTRING.SO.
EXTENSION \u003d PHP_PGSQL.SO.

Note that for windows Expansion will have a DLL format, but for Linux you need to use SO. The following sections are setting up each extension, but we will not consider them because they usually do not require configuration.

conclusions

In this article, we reviewed how PHP is configured on the server or by the usual computer To develop websites. PHP settings file has a fairly simple structure and it is not quite difficult to cope with it. After completing all the settings and save changes, do not forget to restart the web server or PHP-FPM service.

Generally speaking, PHP-FPM is a separate topic, because there is a lot there additional settingsAnd maybe we will consider it in one of the following articles. If you have any questions, ask in the comments!


Direct link: php-5.3.10-win32-vc9-x86.zip.
At the same time, download immediately and documentation in Russian in format.chm, you will need it when learning and work: php_enhanced_en.chm

Unpack the archive to the desired directory (initially offered "C: \\ PHP"). Open the configuration file containing recommended settings - "php.ini-development" (found in the root distribution), rename it in php.ini and make the following changes.

Editorial Php.ini:

  1. Find the string:
    post_max_size \u003d 8m
    Increase up to 16 MB maximum data generated by the POST method by changing it on:
    post_max_size \u003d 16m.
  2. Find the string:
    ; include_path \u003d ".; C: \\ PHP \\ includes"
    Unset it, removing the point with a comma in front of the string.
    (ATTENTION Exception! Return skeins when specifying the path):
    include_path \u003d ".; C: \\ PHP \\ includes"
    Create an empty Catalog "C: \\ PHP \\ INCLUDES", to store connected classes.
  3. Find the string:
    extension_dir \u003d "./"
    Set this directive the path to the folder with extensions:
    eXTENSION_DIR \u003d "C: / PHP / EXT"
  4. Find the string:
    ; Upload_tmp_dir \u003d.
    Allow it and specify the following path in the value:
    upload_TMP_DIR \u003d "C: / PHP / UPLOAD"
    Create an empty folder "C: \\ PHP \\ UPLOAD", to store temporary files downloaded via HTTP.
  5. Find the string:
    upload_max_FileSize \u003d 2m.
    Increase the maximum allowable size of downloaded files up to 16 MB:
    upload_max_FileSize \u003d 16m.
  6. Connect, unchanging, expansion library data:
    eXTENSION \u003d php_bz2.dll
    Extension \u003d php_curl.dll.
    EXTENSION \u003d PHP_GD2.DLL
    EXTENSION \u003d php_mbstring.dll
    Extension \u003d php_mysql.dll
    EXTENSION \u003d php_mysqli.dll
  7. Find the string:
    ; Date.TimeZone \u003d.
    Allow and set the time zone of your location (the number of time zones can be found in the documentation):
    date.timezone \u003d "Europe / Moscow"
  8. Find the string:
    ; session.save_path \u003d "/ tmp"
    Unset and set the value of this directive Such path:
    session.save_path \u003d "C: / PHP / TMP"
    Create an empty folder "C: \\ PHP \\ TMP" to store temporary session files.
Save the changes and close the php.ini file.

Next, you need to add a directory with a PHP installed interpreter in the PATH operating system. For what follow the path "Start" ("Start") -\u003e "Control Panel" ("System") -\u003e "System" ("System"), open the "Advanced" tab, click " Environment Variables "(" System Variables "), in the" System Variables "section (" System Variables ") Make a double click on the" PATH "line, add to the" Variable Value "field, to the fact that there is already There is a way to a directory with a PHP installed, for example, "C: \\ PHP" (without quotes). Pay attention to the fact that the decimal point symbol shares the paths. So that the changes have entered into force, restart the operating system.

Example of Path Row:
% Systemroot% \\ System32;% Systemroot%;% Systemroot% \\ System32 \\ WBEM; C: \\ PHP; C: \\ Program Files \\ MySQL \\ MySQL Server 5.5 \\ Bin

Installing and configuring a PHP interpreter - completed.

Description of connected libraries:

php_bz2.dll - With this PHP extension, it will be able to create and unpack the archives in the BZIP2 format.

php_curl.dll - Very important and necessary library, allowing to connect and work with servers using a huge amount of Internet protocols.

php_gd2.dll - Another indispensable library that allows you to work with graphics. Did you think on PHP you can only generate HTML pages? And here is not! With the help of PHP, you can almost everything, including to draw.

php_mbstring.dll - The library contains functions for working with multi-byte encodings, which include the encoding of eastern languages \u200b\u200b(Japanese, Chinese, Korean), Unicode (UTF-8) and others.

php_mysql.dll - The library name speaks for itself - it is necessary for working with MySQL server.

php_mysqli.dll - This library is the extension of the previous one and contains additional functions PHP to work with MySQL version 4.1.3 and above.

Data libraries should be enough for full-fledged PHP operation. Over time, if such a need appears, you can connect additional libraries, but you should not connect them immediately with the idea that the porridge does not spoil the oil, in this case the unnecessary number of connected libraries can noticeably slow down the PHP.

«