For mac system, php-fpm is added to the startup item.

不言
Release: 2023-03-24 18:48:02
Original
6857 people have browsed it

The content introduced in this article is about the mac system. php-fpm has been added to the startup item, which has a certain reference value. Now I share it with everyone. Friends in need can refer to it

Looking for php-fpm The path

whereis php-fpm
Copy after login

If you can’t find it, you can try to use:

find / -name php-fpm
Copy after login

Generally the default path is:

/usr/sbin/php- fpm

Modify the php-fpm.conf configuration file

The default location is:

/private/etc/php-fpm.conf

If it does not exist, check to see if it exists

/private/etc/php-fpm.conf.default

Then COPY:

sudo cp /private/etc/php-fpm.conf.default /private/etc/php-fpm.conf
Copy after login

Modify the project "daemonize" of the php-fpm configuration file

daemonize = yes
Copy after login

Remove the semicolon in front.

Add startup items

In the ~/Library/LaunchAgents directory, create a new org.php.php-fpm.plist file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>php-fpm</string>
    <key>Program</key>
    <string>/usr/sbin/php-fpm</string>
    <key>KeepAlive</key><true/>
</dict>
</plist>
Copy after login

Note: The path of php-fpm in the xml file is obtained through the above command.

sudo chown root:owner ~/Library/LaunchAgents/org.php.php-fpm.plist
sudo chmod +x ~/Library/LaunchAgents/org.php.php-fpm.plist
launchctl load -w ~/Library/LaunchAgents/org.php.php-fpm.plist
Copy after login

After executing the above command, you need to restart to see if it takes effect.

When the restart does not take effect, you can use this debugging command to see whether the startup items are loaded:

launchctl list | grep php
Copy after login

Regarding the directory of the above startup file, /Library/LaunchAgents, There is also a related location: /Library/LaunchDaemons/. When it does not take effect, you can check the plist file. It is better to try changing the location. In the mac system, there are several similar locations with different functions. In this case, it is recommended that you use ~/Library/LaunchAgents/.


Comparison of the functional differences between LaunchDaemons and LaunchAgents:
LaunchDaemons is a service (daemon process) started before the user logs in.
LaunchAgents is a service (daemon process) started after the user logs in.

Related recommendations:

php-fpm Smooth restart on and off

php-fpm restart

Nginx and php installation and configuration 2 Installation and configuration php-fpm


The above is the detailed content of For mac system, php-fpm is added to the startup item.. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template