Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 348c545

Browse files
author
Steve Johnson
committed
Issue#705. Update cron documentation
1 parent f377f14 commit 348c545

File tree

2 files changed

+45
-26
lines changed

2 files changed

+45
-26
lines changed

_includes/config/setup-cron.md

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
11
<div markdown="1">
22

33
### Prerequisites
4-
Magento uses cron for two sets of tasks, and for each, cron can be run with a different configuration:
4+
Magento uses cron for two sets of tasks, and for each, cron can run with a different configuration:
55

6-
* The general cron job that reindexes indexers, generates e-mails, generates the sitemap, and so on, typically runs as the PHP command-line user's `php.ini`
7-
* Two other cron jobs are used by the <a href="{{page.baseurl}}comp-mgr/bk-compman-upgrade-guide.html">Component Manager and System Upgrade utilities</a>. Those commands must use the web server's `php.ini`.
6+
* PHP command-line configuration: The general cron job that reindexes indexers, generates e-mails, generates the sitemap, and so on.
7+
8+
You can find the command-line configuration using the command `php --ini`.
9+
* Web server PHP plug-in configuration: Two other cron jobs are used by the <a href="{{page.baseurl}}comp-mgr/bk-compman-upgrade-guide.html">Component Manager and System Upgrade utilities</a>.
10+
11+
You can find the web server plug-in configuration using <a href="{{ page.baseurl }}install-gde/prereq/optional.html#install-optional-phpinfo"><code>phpinfo.php</code>.
12+
13+
<div class="bs-callout bs-callout-warning">
14+
<p>To avoid issues during installation and upgrade, we strongly recommend you apply the same PHP settings to both the PHP command-line configuration and to the PHP web server plug-in's configuration. For more information, see the instructions in either the <a href="{{ page.baseurl }}install-gde/prereq/php-ubuntu.html#instgde-prereq-timezone">Ubuntu</a> or <a href="{{ page.baseurl }}install-gde/prereq/php-ubuntu.html#instgde-prereq-timezone">CentOS</a> PHP topics.</p>
15+
</div>
816

917
If you're not experienced with running cron, you can run all commands with the web server's configuration; however, we leave the decision up to you.
1018

1119
#### Find the web server configuration
12-
1320
To find the web server configuration, run a <a href="{{page.baseurl}}install-gde/prereq/optional.html#install-optional-phpinfo">`phpinfo.php` file</a> in your web browser and look for the Loaded Configuration File as follows:
1421

1522
<img src="{{ site.baseurl }}common/images/config_phpini-webserver.png" width="700px">
@@ -25,7 +32,7 @@ A sample result follows:
2532

2633
#### Create the cron job
2734

28-
To create a cron job as the Magento file system owner, enter the following command as a user with `root` privileges:
35+
To create a cron job for the Magento file system owner, enter the following command as a user with `root` privileges:
2936

3037
crontab -u <Magento file system owner user name> -e
3138

@@ -35,24 +42,24 @@ For example,
3542

3643
A text editor displays. (You might need to choose a text editor first.)
3744

38-
* * * * * <path_to_binary> -c <ini_file_path> <magento_dir>/bin/magento cron:run | grep -v "Ran jobs by schedule" >> <magento_dir>/var/log/magento.cron.log
39-
* * * * * <path_to_binary> -c <ini_file_path> <magento_dir>/update/cron.php >> <magento_dir>/var/log/update.cron.log
40-
* * * * * <path_to_binary> -c <ini_file_path> <magento_dir>/bin/magento setup:cron:run >> <magento_dir>/var/log/setup.cron.log
45+
* * * * * <path to php binary> <magento install dir>/bin/magento cron:run | grep -v "Ran jobs by schedule" >> <magento install dir>/var/log/magento.cron.log
46+
* * * * * <path to php binary> <magento install dir>/update/cron.php >> <magento install dir>/var/log/update.cron.log
47+
* * * * * <path to php binary> <magento install dir>/bin/magento setup:cron:run >> <magento_dir>/var/log/setup.cron.log
4148

4249
where
4350

44-
* `<path_to_binary>` is the absolute file system path to your PHP binary
45-
* `<ini_file_path>` is the path to a `php.ini` file to use for the cron job
51+
* `<path to php binary>` is the absolute file system path to your PHP binary
52+
* `<magento install dir>` is the directory in which you installed the Magento software; for example, `/var/www`
4653
* `| grep -v "Ran jobs by schedule"` filters this message from the log, making any errors easier to spot
4754

4855
The first command (`magento cron:run`) reindexes indexers, send automated e-mails, generates the sitemap, and so on. Usually it's associated with the PHP command line `.ini` file. The other two commands are used by the Component Manager and System Upgrade.
4956

50-
For example, if the PHP binary is located in `/usr/bin`, you installed Magento in `/var/www/html/magento2`, and all commands use the web server's `/etc/php5/apache2/php.ini`, enter
57+
For example, if the PHP binary is located in `/usr/bin`, you installed Magento in `/var/www/html/magento2`, enter
5158

5259
Example:
5360

54-
* * * * * /usr/bin/php -c /etc/php5/apache2/php.ini /var/www/magento2/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/www/magento2/var/log/magento.cron.log
55-
* * * * * /usr/bin/php -c /etc/php5/apache2/php.ini /var/www/magento2/update/cron.php >> /var/www/magento2/var/log/update.cron.log
56-
* * * * * /usr/bin/php -c /etc/php5/apache2/php.ini /var/www/magento2/bin/magento setup:cron:run >> /var/www/magento2/var/log/setup.cron.log
61+
* * * * * /usr/bin/php /var/www/magento2/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/www/magento2/var/log/magento.cron.log
62+
* * * * * /usr/bin/php /var/www/magento2/update/cron.php >> /var/www/magento2/var/log/update.cron.log
63+
* * * * * /usr/bin/php /var/www/magento2/bin/magento setup:cron:run >> /var/www/magento2/var/log/setup.cron.log
5764

5865
Save your changes to the crontab and exit the editor.

_includes/install/php-config.html

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,30 @@
2323

2424
`asp_tags` will be removed in PHP 7.
2525

26-
To set PHP options:
26+
<div class="bs-callout bs-callout-warning">
27+
<p>To avoid issues during installation and upgrade, we strongly recommend you apply the same PHP settings to both the PHP command-line configuration and to the PHP web server plug-in's configuration. For more information, see the next section.</p>
28+
</div>
29+
30+
### Find PHP configuration files
31+
To find the web server configuration, run a <a href="{{page.baseurl}}install-gde/prereq/optional.html#install-optional-phpinfo">`phpinfo.php` file</a> in your web browser and look for the Loaded Configuration File as follows:
32+
33+
<img src="{{ site.baseurl }}common/images/config_phpini-webserver.png" width="700px">
34+
35+
To locate the PHP command-line configuration, enter
2736

28-
1. Locate `php.ini` by entering the following command:
37+
php --ini
38+
39+
Use the value of Loaded Configuration file.
40+
41+
### Set PHP options
42+
43+
To set PHP options:
2944

30-
php --ini
45+
1. Locate `php.ini` for both the web server and the PHP command line as discussed in the preceding section.
3146

32-
Use the value of `Loaded Configuration File`.
33-
34-
Typical locations follow:
47+
Make the following changes to _both_ configurations.
3548

36-
* Ubuntu: `/etc/php5/cli/php.ini`
37-
* CentOS: `/etc/php.ini`
38-
2. Open `php.ini` in a text editor.
49+
2. Open a `php.ini` in a text editor.
3950
3. Locate your server's time zone in the available [time zone settings](http://php.net/manual/en/timezones.php){:target="_blank"}
4051
4. Locate the following setting and uncomment it if necessary:
4152

@@ -54,9 +65,10 @@
5465
asp_tags =
5566
9. Make sure its value is set to `Off`.
5667
10. Save your changes and exit the text editor.
68+
11. Open the other `php.ini` and make the same changes in it.
5769
11. Restart your web server:
5870

59-
* Ubuntu: `service apache2 restart`
60-
* CentOS: `service httpd restart`
61-
* Ubuntu and CentOS: `service nginx restart`
71+
* Apache, Ubuntu: `service apache2 restart`
72+
* Apache, CentOS: `service httpd restart`
73+
* nginx, Ubuntu and CentOS: `service nginx restart`
6274

0 commit comments

Comments
 (0)