2 replaced http://abyz.co.uk/ with http://abyz.me.uk/
source | link

Will I need to have a Python script

You do not need python, you just need something with a module that wraps one or more of the following C libraries:

  • pigpio
  • wiringPi
  • libbcm2835

All of which provide PWM for at least the hardware driven pin(s). Python for has wrappers for all three. PHP has one for wiringPi and may have ones for the others. However, while the underlying libraries are I think reasonably well maintained, sometimes the wrappers are half-complete and/or abandoned. Since python is probably the most widely used method, it is probably the safest bet other than C.

a single PHP script is not designed to execute indefinitely waiting for input

Not necessarily -- PHP scripts can be executed in the same manner as python -- but in an apache context you are correct, they are not persistent.

have some sort of communication

This is called "inter process communication" (IPC). There are all kinds of ways of doing this. Probably the most common and versatile is via sockets. You would create a persistent local server process and send it requests from the web server script. This is a form of daemon.

I know that pigpio already has such a daemonalready has such a daemon, so the easiest thing to do would probably be to investigate that; it is likely capable of meeting your needs since there is an explicit reference to PWM on that page. It also has a pipe interface (aka. a fifo, for "first in first out") in addition to a server socket, which will be easier if you do not know how to use the latter.

Will I need to have a Python script

You do not need python, you just need something with a module that wraps one or more of the following C libraries:

  • pigpio
  • wiringPi
  • libbcm2835

All of which provide PWM for at least the hardware driven pin(s). Python for has wrappers for all three. PHP has one for wiringPi and may have ones for the others. However, while the underlying libraries are I think reasonably well maintained, sometimes the wrappers are half-complete and/or abandoned. Since python is probably the most widely used method, it is probably the safest bet other than C.

a single PHP script is not designed to execute indefinitely waiting for input

Not necessarily -- PHP scripts can be executed in the same manner as python -- but in an apache context you are correct, they are not persistent.

have some sort of communication

This is called "inter process communication" (IPC). There are all kinds of ways of doing this. Probably the most common and versatile is via sockets. You would create a persistent local server process and send it requests from the web server script. This is a form of daemon.

I know that pigpio already has such a daemon, so the easiest thing to do would probably be to investigate that; it is likely capable of meeting your needs since there is an explicit reference to PWM on that page. It also has a pipe interface (aka. a fifo, for "first in first out") in addition to a server socket, which will be easier if you do not know how to use the latter.

Will I need to have a Python script

You do not need python, you just need something with a module that wraps one or more of the following C libraries:

  • pigpio
  • wiringPi
  • libbcm2835

All of which provide PWM for at least the hardware driven pin(s). Python for has wrappers for all three. PHP has one for wiringPi and may have ones for the others. However, while the underlying libraries are I think reasonably well maintained, sometimes the wrappers are half-complete and/or abandoned. Since python is probably the most widely used method, it is probably the safest bet other than C.

a single PHP script is not designed to execute indefinitely waiting for input

Not necessarily -- PHP scripts can be executed in the same manner as python -- but in an apache context you are correct, they are not persistent.

have some sort of communication

This is called "inter process communication" (IPC). There are all kinds of ways of doing this. Probably the most common and versatile is via sockets. You would create a persistent local server process and send it requests from the web server script. This is a form of daemon.

I know that pigpio already has such a daemon, so the easiest thing to do would probably be to investigate that; it is likely capable of meeting your needs since there is an explicit reference to PWM on that page. It also has a pipe interface (aka. a fifo, for "first in first out") in addition to a server socket, which will be easier if you do not know how to use the latter.

1
source | link

Will I need to have a Python script

You do not need python, you just need something with a module that wraps one or more of the following C libraries:

  • pigpio
  • wiringPi
  • libbcm2835

All of which provide PWM for at least the hardware driven pin(s). Python for has wrappers for all three. PHP has one for wiringPi and may have ones for the others. However, while the underlying libraries are I think reasonably well maintained, sometimes the wrappers are half-complete and/or abandoned. Since python is probably the most widely used method, it is probably the safest bet other than C.

a single PHP script is not designed to execute indefinitely waiting for input

Not necessarily -- PHP scripts can be executed in the same manner as python -- but in an apache context you are correct, they are not persistent.

have some sort of communication

This is called "inter process communication" (IPC). There are all kinds of ways of doing this. Probably the most common and versatile is via sockets. You would create a persistent local server process and send it requests from the web server script. This is a form of daemon.

I know that pigpio already has such a daemon, so the easiest thing to do would probably be to investigate that; it is likely capable of meeting your needs since there is an explicit reference to PWM on that page. It also has a pipe interface (aka. a fifo, for "first in first out") in addition to a server socket, which will be easier if you do not know how to use the latter.