Page 1 of 1

PHP DIO module

Posted: Sat 07 Jul 2018 11:43
by David Gibson
I want to use PHP's Direct IO functions (http://php.net/manual/en/book.dio.php ) on my local PC. So I have downloaded it from PECL (https://pecl.php.net/package/dio/0.1.0) but Im having problems installing it. I wondered if anyone has any experience of installing PEAR packages under XAMPP on Windows 10? Essentially, I think the problem is that my installation of XAMPP possibly has some paths that PEAR is not expecting - or is it something more subtle? When I try to install the package I get ERROR: failed to mkdir C:\php\pear\tests\dio\tests. There are some hints in various onlin esupport groups about changing some of XAMPP's paths, but I thought Id ask here first before wading my way through them all.

Details of what I did are as follows.

Firstly, I ran the following tests - as suggested at http://pear.php.net/manual/en/installation.checking.php.

Installation meets the dependency requirements? (yes)

Code: Select all

C:\xampp\php> pear version
PEAR Version: 1.10.1
PHP Version: 5.6.15
Zend Engine Version: 2.6.0
Running on: Windows NT RED-LAPTOP 10.0 build 16299 (Windows 10) i586
Location of config file...

Code: Select all

C:\xampp\php> php --ini
Configuration File (php.ini) Path: C:\WINDOWS
Loaded Configuration File:         C:\xampp\php\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)
Ran phpinfo() from web server, to see what the web server thought was happening...

Code: Select all

Configuration File (php.ini) Path	C:\WINDOWS
Loaded Configuration File       	 C:\xampp\php\php.ini
include_path	                     C:\xampp\php\PEAR
Checked PHP's include_path setting on the command line:

Code: Select all

C:\xampp\php> php -c php.ini -r "echo get_include_path();"
C:\xampp\php\PEAR
Created a file (which I named as check_pear.php) containing...

Code: Select all

<?php require_once 'System.php'; var_dump(class_exists('System', false)); ?>
and ran it from my localhost browser, producing an output of bool(true), which is correct. Also ran it from the command line and got the same answer...

Code: Select all

C:\xampp\php> php C:\ [...] public_html\check_pear.php
bool(true)
Next, I installed the package, resulting in ERROR: failed to mkdir C:\php\pear\tests\dio\tests

Code: Select all

C:\xampp\php> pear install dio
No releases available for package "pear.php.net/dio" - package pecl/dio can be installed with "pecl install dio"
install failed

C:\xampp\php> pecl install dio
Failed to download pecl/dio within preferred state "stable", latest release is version 0.1.0, stability "beta", use "channel://pecl.php.net/dio-0.1.0" to install
install failed

C:\xampp\php> pear install channel://pecl.php.net/dio-0.1.0
downloading dio-0.1.0.tgz ...
Starting to download dio-0.1.0.tgz (36,960 bytes)
..........done: 36,960 bytes
ERROR: failed to mkdir C:\php\pear\tests\dio\tests

Re: PHP DIO module

Posted: Sat 07 Jul 2018 13:22
by David Cooke
No direct experience.

Have you checked the process has permission to create that directory?

Try manually creating the directory for the process and see if that helps.

Re: PHP DIO module

Posted: Sun 08 Jul 2018 13:00
by David Gibson
David Cooke wrote: Have you checked the process has permission to create that directory?
Well, I wondered about that, but this is Windows we're talking about, so can permissions be an issue? But I will try what you suggested.

Although... perhaps permissions can be an issue after all? In an unrelated exercise, Im trying to install one very old piece of software to run with another very old piece of software (in Windows 10) and I get an error message something like "process needs to be elevated". So I tried holding my laptop up in the air, but it still didnt work. I think its saying that one or the other program needs admin privileges.

Re: PHP DIO module

Posted: Sun 08 Jul 2018 13:31
by David Cooke
Try taking it to America and putting it a lift (we don't have elevators here). :D

Windows definitely has permissions, a more complicated and unwieldy version than linux. Although in truth they are generally less likely to be a concern.

Re: PHP DIO module

Posted: Sun 08 Jul 2018 14:33
by David Gibson
Asking Google, (seehere) it seems that the error is because my files are not at C:\php, because XAMPP has put them somewhere else. Executing

Code: Select all

pear config-set doc_dir C:\xampp\php\pear
pear config-set cfg_dir C:\xampp\php\pear
pear config-set data_dir C:\xampp\php\pear
pear config-set test_dir C:\xampp\php\pear
pear config-set www_dir C:\xampp\php\pear
But I now get a different error...

Code: Select all

c:\xampp\php>pear install channel://pecl.php.net/dio-0.1.0
downloading dio-0.1.0.tgz ...
Starting to download dio-0.1.0.tgz (36,960 bytes)
..........done: 36,960 bytes
24 source files, building
WARNING: php_bin C:\xampp\php\php.exe appears to have a suffix .exe, but config variable php_suffix does not match
ERROR: The DSP dio.dsp does not exist.
Resorting to Google again, this fixed the warning...

Code: Select all

pecl config-set php_bin C:\xampp\php
pecl config-set php_suffix \php.exe
but the ERROR is still present. Further investigation shows that this is a known PEAR bug on the Windows installer, which nobody is going to fix. :-( That's rather a nuisance.

Re: PHP DIO module

Posted: Sun 08 Jul 2018 14:54
by David Cooke
Create a Linux virtual machine and do your development there?