Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unnecessary double quotes added to PHP binary path #7

Closed
jamesBFS opened this issue Oct 25, 2022 · 7 comments
Closed

Unnecessary double quotes added to PHP binary path #7

jamesBFS opened this issue Oct 25, 2022 · 7 comments
Assignees

Comments

@jamesBFS
Copy link

In lib\Model\ServiceInformations.php, line 48, I don't think that the surrounding double quotes to the php binary path are necessary.

When I have installed the service on Windows Server 2016, I have manually removed the quotes to leave line 48 as follows:-
$this->datas[WIN32_INFO_PATH] = dirname(PHP_BINARY).'\php-win.exe';

I suggest this change to the code, but this is my first exploration into contributing on github, so please let me know if I should have submitted this in a different way.

@macintoshplus
Copy link
Member

Hi @jamesBFS ,

Thank you for your feedback.

If the path to the PHP binary contains a space, you need to use the double quote to preserve the path. Otherwise, you need to use the short folder name (MS-DOS format).

If your path doesn't have any space, the double quote has no effect.

Have you a side effect cased by the double quote?

@jamesBFS
Copy link
Author

jamesBFS commented Oct 25, 2022 via email

@macintoshplus
Copy link
Member

Can you provide this information, please:

  • your service configuration (the PHP code executed to register the service, or Win32Service bundle configuration)
  • PHP installation path
  • PHP version
  • Win32Service version

@jamesBFS
Copy link
Author

The php to register the service is dependent on level-2\dice dependency injection container version 4.0.3 downloaded using composer. It may be that the problem I am experiencing is created by this, but I can't see where if that is the case.

From the command line, "php plugins.php PrintServiceInstall" is the installation command.

Versions of plugins.php, DiceConfigure.php and config.php are attached (with irrelevant code removed)

PHP Installation Path "C:\Program Files\PHP\v8.1.11"
PHP version 8.1.11 NTS x64
Win32Service version 1.0.1

I did have a similar issue prior to upgrading PHP versions:-
PHP Installation Path "C:\Program Files\PHP\v7.4.26"
PHP version 7.4.26 NTS x64
Win32Service version 0.4.2

config.php.txt
DiceConfigure.php.txt
plugins.php.txt

@macintoshplus
Copy link
Member

Hi,

When I run your code, I have this error:

Fatal error: Uncaught Error: Class "Dice\Dice" not found in C:\sites\DiceConfigure.php:82
Stack trace:
#0 C:\sites\plugins.php(13): BFSFertiliser\Fertiliser\DiceConfigure->getDice(Array)
#1 {main}
  thrown in C:\sites\DiceConfigure.php on line 82

@macintoshplus
Copy link
Member

I can reproduce the problem.

During the service registration, the path is automatically protected by a double quote if contains space.

I write a fix quickly

@jamesBFS
Copy link
Author

jamesBFS commented Nov 7, 2022

Thank you very much for both the fix and for the project as a whole.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants