Archives par mot-clé : win32service

Win32Service 1.0.0 is available

Win32Service Logo
Win32Service Logo

The new version 1.0.0 of Win32Service extension for PHP is available.

Or

Win32Service is a PHP extension. The version 0.4.x is for PHP7 and the version 1.0.x is for PHP8. This extension provides a simple way to run your PHP script like a service into the Windows Service Manager. Win32Service is same as supervisorD or SystemD for Linux.

The PHP documentation for win32service is up to date.

The v1.0.0 change log

  • Add Win32ServiceException (extends Exception)
  • The return value is no longer false when call method with wrong parameters
    • win32_start_service_ctrl_dispatcher
    • win32_set_service_exit_mode
    • win32_set_service_exit_code
    • win32_set_service_status
    • win32_create_service
    • win32_delete_service
    • win32_get_last_control_message
    • win32_query_service_status
    • win32_start_service
    • win32_stop_service
    • win32_pause_service
    • win32_continue_service
    • win32_send_custom_control
  • Add check in array information provided to win32_create_service. On error, this method throw a ValueError.
  • For function win32_send_custom_control, the PHP error The control argument value is not between 128 and 255. is now throw on ValueError.
  • For all function needed the service name, a ValueError is throw if the string is empty.
  • The PHP Error This function work only when using the CLI SAPI and called into the service code. has been converted to Win32ServiceException for this method
    • win32_start_service_ctrl_dispatcher
    • win32_set_service_exit_mode
    • win32_set_service_exit_code
    • win32_set_service_status
    • win32_get_last_control_message
  • The PHP Warning Service ctrl dispatcher already running has been converted to Win32ServiceException.
    This exception is throw if function win32_start_service_ctrl_dispatcher is called when the control dispatcher is already started.
  • The PHP Warning Failed to start dispatcher thread has been converted to Win32ServiceException.

Edit on December 1, 2020 : I have updated this blog post to add download pre-built DLL links.

More blogpost about Win32Service

Win32Service 1.0.0-alpha2 is available

Win32Service Logo
Win32Service Logo

The new version 1.0.0-alpha2 of Win32Service extension for PHP is available for test.

Win32Service is a PHP extension. The version 0.4.x is for PHP7 and the version 1.0.x is for PHP8. This extension provides a simple way to run your PHP script like a service into the Windows Service Manager. Win32Service is same as supervisorD or SystemD for Linux.

The v1.0.0-alpha2 change log

  • Add Win32ServiceException (extends Exception)
  • The return value is no longer false when call method with wrong parameters
    • win32_start_service_ctrl_dispatcher
    • win32_set_service_exit_mode
    • win32_set_service_exit_code
    • win32_set_service_status
    • win32_create_service
    • win32_delete_service
    • win32_get_last_control_message
    • win32_query_service_status
    • win32_start_service
    • win32_stop_service
    • win32_pause_service
    • win32_continue_service
    • win32_send_custom_control
  • Add check in array information provided to win32_create_service. On error, this method throw a ValueError.
  • For function win32_send_custom_control, the PHP error The control argument value is not between 128 and 255. is now throw on ValueError.
  • For all function needed the service name, a ValueError is throw if the string is empty.
  • The PHP Error This function work only when using the CLI SAPI and called into the service code. has been converted to Win32ServiceException for this method
    • win32_start_service_ctrl_dispatcher
    • win32_set_service_exit_mode
    • win32_set_service_exit_code
    • win32_set_service_status
    • win32_get_last_control_message
  • The PHP Warning Service ctrl dispatcher already running has been converted to Win32ServiceException.
    This exception is throw if function win32_start_service_ctrl_dispatcher is called when the control dispatcher is already started.
  • The PHP Warning Failed to start dispatcher thread has been converted to Win32ServiceException.

The release 1.0.0-alpha2 on the GitHub project

The next version of Win32Service

Win32Service Logo
Win32Service Logo

I work in my free time to improve the win32service extension to make it great and easier to use. The future version is 1.0.0 only for PHP 8.

I’m excited about this future version.

What is the planned changes?

This extension needs a little cleanup. In many cases, the Windows version is checked. All this check will be removed because VS16 is used to build PHP 8 and this extension works only on Windows 7 SP1 and newer or Windows 2012 R2 or newer.

With PHP 8 a new ValueError exception is available. Many checks will be added to improve the work of this extension. Especially the win32_create_service function.

And the last, same as many other functions in PHP extensions, all function who returns an error code will be changed to throw an exception. All PHP Errors and some PHP Warning will be changed by throwing an exception.

What is the side effect to change?

You need to change your code when you upgrade your project to PHP 8.

The Win32Service project provides a PHP library and a Symfony Bundle. Both will be upgraded to PHP 8 on a new major version.

My Actual To-do List

All this plan needs more work. This is my to-do list but you can help me.

  • Upgrade the extension code.
  • Write more tests for the extension.
  • Update the English PHP documentation for Win32Service.
  • Update the French PHP documentation for Win32Service.
  • Update the PHP library win32service/service-library.
  • Update the Symfony Bundle win32service/win32servicebundle.
  • Update the example project.

Help me

You can help me in many ways:

You are interested in this project, but you cannot help in this way, you can buy a day of work. Please contact me.

Or ping me to encourage me.

Win32Service for PHP8

Win32Service Logo
Win32Service Logo

The version 8 of PHP is scheduled for December 2020. All active extension must be upgrading their code to need a run with the new version.

Actually in development, the version 1.0 of the extension Win32Service will be compliant only with PHP 8. The version 1.0.0-dev is already upgraded and usable for tests. You can download the snapshot build of PHP for Windows (on the bottom of the page) and the Win32Service extension DLL on the GitHub repository.

Currently, version 1.0 of the Win32Service extension is building only for the x64 architecture and for two PHP mode (NTS and TS).

Maintained version

For the future, Win32Service version 0.4 will be maintained for all PHP 7 maintained versions. And Win32Service version 1.0 will be maintained for all PHP 8 maintained versions.

Win32Service pour PHP 8

Win32Service Logo
Win32Service Logo

La version 8 de PHP est prévue pour décembre 2020. Toutes les extensions actives doivent mettre à jour leur code pour avoir besoin d’une exécution avec la nouvelle version.

La version 1.0 de l’extension Win32Service est en cours de développement et ne sera compatible qu’avec PHP 8. La version 1.0.0-dev est déjà mise à jour et utilisable pour les tests. Vous pouvez télécharger la version snapshot de PHP pour Windows (en bas de la page) et la DLL d’extension Win32Service sur le dépôt GitHub.

Actuellement, la version 1.0 de l’extension Win32Service est compilée uniquement pour l’architecture x64 et pour deux modes PHP (NTS et TS).

Versions maintenues

La version 0.4 sera maintenue pour les versions maintenues de PHP 7.
La version 1.0 sera maintenue pour les versions maintenues de PHP 8.

There comes the time to upgrade.

I want to reflect on the past to propel to the future!

At that time, my goal was only to update this extension for PHP 7.0.
At that time, I have written a couple of little programs in C, most in C++, and so many in PHP since its version 3.

I have taken out the Win32Service extension from the oldest SVN repository on May 29 2016. The most recent SVN commit is on July 26 2011.

It is hard work to understand how to write a PHP extension, but with time, documentation, books, friends and labor, I released version 0.1.2-dev on October 16 2016.

At that time, some ground-work was done.

  • The AppVeyor service was set on the project.
  • The DLL are built for x86 and amd64
  • The DLL are available with (TS) and without (NTS) Thread Safe mode.

But the work was far from done, and the first version really usable for PHP 7.0 was version 0.2.0, released on March 23 2017.

The work for version 0.2 span over 10 months during my free time. I’m really proud of my work.

Since the 0.2 version, I have released one other version in 2017, two in 2018, three in 2019 (four versions soon)…

I have added some features asked by users in the old PHP documentation comments, on the PHP bug tracker or directly.

However, I have just received a little bit of feedback despite my calls for it.

Of course, I use Twitter to send my calls and the world is not only on Twitter, however, my network is so small, and my contacts don’t have an interests to forward my calls…

One can ask who in 2017, 2018, 2019, works on the Windows platform to write a PHP application when needing to run a script in the background? Who?

You would be surprised by the amount of people on Windows running PHP scripts, it is far greater than what you imagine.

The download statistics available from the Pecl web site show the interest for this extension.

The most downloaded version (v0.1. excluded) is version 0.2.1. The next one is 0.3.0, not 0.3.1 nor the last one: 0.3.2. Why? Surely because version 0.3.0 is the last version available for PHP 7.0!

Dear PHP developers, why don’t you update PHP? (This is a genuine question, please answer in the comments.)

So, as version 7.4 of PHP will be coming soon and I will release a new version. It is time to migrate to the latest version!

I need to thank you for your trust and if you want some help to upgrade your application, you can contact me in the comments.

Win32Service 0.4 pour PHP 7.4

Peut-être savez-vous que la prochaine version de PHP sortira en novembre 2019 ! Il s’agit de la version 7.4 !

La bonne nouvelle c’est que l’extension Win32Service (que je gère) compile avec la version de développement de cette future version !

Cependant, il ne m’est pas possible de réaliser des tests plus poussés, car j’ai maintenant un accès limité à Windows.

Pour ceux que cela intéressent, vous pouvez télécharger la version alpha1 snapshot (ou plus récent) de PHP 7.4 puis le dernier artéfact généré par AppVeyor pour la version actuelle de l’extension Win32Service.

Un grand merci pour vos retours (via les issues de GitHub ou les commentaires) qui me sont bien utiles pour améliorer l’extension.

Modification du 15 juin : La DLL disponible sur github n’est utilisable qu’avec les versions récentes des constructions de PHP 7.4 disponibles dans la section snapshot du site de PHP ou la version 7.4alpha2 qui sortira prochainement.

Win32Service 0.4 for PHP 7.4

Do you know the time to release the next PHP version ? Yes, the PHP version 7.4 will be released in November 2019 !

I have some good news for the extension Win32Service. The latest version built for the next PHP version.

Otherwise, I have a restricted access to Windows and I cannot test more the build.

If you want, you can download the PHP 7.4 alpha1 snapshot (or newer) and the last artifact generated by AppVeyor for the actual version of Win32Service extension.

A big thanks for your feedback (in GitHub issues or in comment here). It’s very useful to enhance this extension.

June 15 update: The DLL available from github can be working only with the recent snapshots releases available from the snapshot section of the PHP website or the PHP 7.4 alpha2 coming soon.

[Win32Service] PHP 7.0 and 7.1 support

For all popular free software project, it is necessary to manage the supported versions.

The community (or the editor) in charge of the project release a new version for fix bugs and security vulnerabilities only for the supported versions.

For PHP, all supported version by the community is available here.

What is the link with Win32Service? The link is easy, to build the extension for each change the project uses the AppVeyor service. This service allows building, run automated tests, and keep the DLL for download. The DLL is used by you to test your projects with the new version and send feedback from the result of your tests.

But, to build this extension, I need to use some tools necessary for the PHP build on Windows. There tools are managed by the PHP community. In fact, I can build this extension only for the supported PHP version with build tools.

Otherwise, you can download the older extension versions from the pecl.php.net website or the releases page from the GitHub project.

If you want the new version of this extension for an unsupported PHP 7 version, you must build yourself this extension.

[Win32Service] Support de PHP 7.0 et PHP 7.1

Comme pour tout projet libre et populaire, il est nécessaire de mettre en place une gestion des versions supportées.

Les versions supportées sont les versions dont l’éditeur ou la communauté chargés du projet propose des mises à jour pour corriger des dysfonctionnements (bugs) ou des vulnérabilités (failles de sécurité).

Pour le projet PHP, c’est le cas et vous pouvez en voir une représentation graphique et tabulaire sur la page dédiée.

Quel est le rapport avec Win32Service ? Le rapport est très simple, l’extension utilise le service en ligne AppVeyor pour construire et tester automatique l’extension pour toutes les modifications réalisées sur le projet. Il permet également le téléchargement des DLL pour les utiliser sur vos environnements et ainsi me fournir des retours d’expérience.

Pour que la construction de l’extension soit réalisée à chaque modification il est nécessaire de récupérer les outils nécessaires pour la compilation de PHP. Ces outils sont gérés par la communauté en charge du projet PHP. Ce fait ne me permet de construire l’extension que pour les versions de PHP actuellement supportées ayant les outils de construction disponible.

Cependant, vous avez toujours la possibilité de télécharger les anciennes versions de l’extension via le site pecl.php.net ou via le projet sur GitHub.

Si vous souhaitez disposer de la dernière version de l’extension sur une version de PHP 7 non supportée, vous avez la possibilité de réaliser vous-même la construction de l’extension.