[LINUX] Be careful when running CakePHP3 with PHP7.2

PHP7.2 is a songwriter! ??

As I wrote in the following article, I run into an unexpected situation when I try to run CakePHP3 on PHP7.2. https://qiita.com/21century_girl_/items/5be2606b3bfa98514952

Originally, I received a request to migrate the server, so I upgraded from *** PHP7.1 to PHP7.2 *** with a light feeling, "How can I upgrade the PHP version?"

The php command doesn't work ...

php -v

This is the usual one. This is a command to check the version of php

command not found

It doesn't work.

php72 -v

This will work.

For the time being, as a simple response, it is posted in the following article, so I will omit it here https://qiita.com/21century_girl_/items/5be2606b3bfa98514952

The shell set in cron doesn't work ..

I set it in /etc/cron.d as follows.

* * * * * root /var/www/html/***/bin/cake test

It's a normal cron setting. In the above case, it is an image of running TestShell.php in the shell of cakephp.

But the following error. ..

Failed to find a CLI version of PHP; falling back to system standard php executable /var/www/html/service/bin/cake: line 72: exec: php: not found

Apparently, looking at line 72 of the file, it seems that you are hitting the php command ...

for TESTEXEC in php php-cli /usr/local/bin/php

However, this error is appearing because the php command does not work.

Then what should we do?

Set environment variables in cron file

Set as follows

PATH=/usr/local/bin:/sbin:/bin:/usr/bin:/usr/sbin/sendmail:/opt/remi/php72/root/usr/bin:/opt/remi/php72/root/usr/sbin

* * * * * root /var/www/html/***/bin/cake test

Now the php command is also available and the cakephp shell is running.

Recommended Posts

Be careful when running CakePHP3 with PHP7.2
Be careful when working with gzip-compressed text files
Be careful when reading data with pandas (specify dtype)
Be careful with easy method references
(Note) Be careful with python argparse
[Python] Be careful when using print
Be careful with Python's append method
Be careful of LANG for UnicodeEncodeError when printing Japanese with Python 3
Specify options when running flake8 with flycheck
Be careful when adding an array to an array
Be careful when retrieving tweets at regular intervals with the Twitter API
Be careful of the type when making an image mask with Numpy
When Html cannot be output with Jupyter Notebook
When contour map cannot be drawn with APLpy
I get a UnicodeDecodeError when running with mod_wsgi
Investigation when import cannot be done with python
Be careful when differentiating the eigenvectors of a matrix
[android] When AVD cannot be used with permission denied
What I was careful about when implementing Airflow with docker-compose
[Python3] Be careful with removing character strings (strip, lstrip, rstrip)
Options when installing libraries that cannot be piped with pyenv
Solution when the image cannot be displayed with tkinter [python]
Be careful when assigning Series as a column to pandas.DataFrame
When Times New Roman cannot be used with matplotlib (Ubuntu)
When developing with ipython, scrapy can no longer be read
[Introduction to Udemy Python3 + Application] 51. Be careful with default arguments