2

I have followed all steps here to install zephir on windows 7 32bits I run php with wampserver 2.5, I have downloaded PHP5.6.33 and added it to wampserver successfully

I have installed visual studio 2012

I have created an extension namespace as that :

zephir init myapp

I have created this class for testing purpose

namespace Myapp;
class Coco{


    public function Harmos(double x){

        return x*x;    

    }
}

but when I call build from the namespace directory

zephir build

I have this error

the zephir parser is not loaded 
note: Zephir no longer distributed with internal parser

knowing that I have added php_zephir_parser.dll to php extension and I have Zephir Parser in phpinfo

khalil
  • 107
  • 2
  • 15

1 Answers1

1

In your cli php.ini you should add:

extension=zephir_parser.dll

not:

extension=php_zephir_parser.dll

Keep your php.ini open, then once you run zephir build, add your extension:

extension=myapp.dll

Then restart your web server each time you build.

If you will use your extension via a web server, remember to add to both the cli and the apache/fpm php.ini files.

Lawrence Cherone
  • 46,049
  • 7
  • 62
  • 106
  • thanks, I have added zephir extension to the wrong file before, but now after fix zephir_parser, i have this error : /* zephir_phpize_fix */ var PHP_ANALYZER = 'disabled'; var PHP_PGO = 'no'; var PHP_PGI = 'no'; – khalil Jan 16 '18 at 09:11
  • I think its related to, phpize on windows, https://github.com/php/php-src/commit/9a3af83ee2aecff25fd4922ef67c1fb4d2af6201 on windows you write a [configure.js](http://php.net/manual/en/wincache.win32build.building.php) when building, so I think according to line 228 here http://www.bvbcode.com/code/7mjpna8x-3164599 that is a fix for windows phpize and just a warning. Is it building the extension? – Lawrence Cherone Jan 16 '18 at 09:25
  • no the dll file is not created, here is a screenshot of error : https://s13.postimg.org/th7y0bbd3/error_zephir.jpg – khalil Jan 16 '18 at 10:11
  • I think your find its been built, it will be in `myu/ext/modules/myu.dll` the error is because on linux it says `Compiling... Installing... Extension installed!`, so it automatically adds it to the php extension dir. Which on windows I think your need to move it yourself. https://stackoverflow.com/questions/28848683/zephir-giving-error-on-windows-installation-is-not-implemented-for-windows-yet – Lawrence Cherone Jan 16 '18 at 10:20
  • If that's the case you could use a .bat file to run all the cmds [build and move], [I did something similar for an extension I built](https://github.com/plinker-rpc/php-ext/blob/master/build.sh), which watches for changes, build, starts php inbuilt server and then runs test script. As it does become a hassle building every 2 mins, though this is common pitfull for compiled code. – Lawrence Cherone Jan 16 '18 at 10:28
  • no dll file in extension directory, no 'modules' dir and no 'Release' dir, I have searched – khalil Jan 16 '18 at 10:31
  • You should have a folder called `ext` enter into it and run `nmake`, if it does not error out then it will be built. Also look in compile-errors.log to see if there is anything which broken, if its empty it built successfully. – Lawrence Cherone Jan 16 '18 at 10:41
  • I have entered into it and run nmake, I have this message : NMAKE : fatal error U1064: MAKEFILE not found and no target specified – khalil Jan 16 '18 at 10:48
  • Something's not right, start again `zephir init test` add your `test` class `./test/test/test.zep` go into `./test` run `zephir build` and then `./test/ext` will be there, the source and the nmake are all in that folder and once built your have `./test/ext/modules/test.dll` which you should move to your php ext dir. Then add to php.ini's – Lawrence Cherone Jan 16 '18 at 11:00
  • I have applied what you say, and ext dir is created but modules dir is not created and I have those error in command https://s13.postimg.org/ju4fqlq3b/error_zephir2.jpg – khalil Jan 16 '18 at 11:10