kevinlekiller / simple_php_yenc_decode

Basic yEnc decoder extension for PHP5 written in c++ using swig.
GNU General Public License v3.0
4 stars 4 forks source link

Install issue, (Need help) #1

Closed Sweepr closed 9 years ago

Sweepr commented 9 years ago

> yum install boost-devel

Loaded plugins: fastestmirror Setting up Install Process Loading mirror speeds from cached hostfile

Initialized empty Git repository in /root/simple_php_yenc_decode/.git/

remote: Counting objects: 94, done. remote: Total 94 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (94/94), done.

> cd simple_php_yenc_decode

> swig -version

SWIG Version 1.3.40

> swig -php -c++ yenc_decode.i

>

> g++ php-config5 --includes -fpic -c yenc_decode_wrap.cpp

-bash: php-config5: command not found yenc_decode_wrap.cpp:742:18: error: zend.h: No such file or directory yenc_decode_wrap.cpp:743:22: error: zend_API.h: No such file or directory yenc_decode_wrap.cpp:744:17: error: php.h: No such file or directory yenc_decode_wrap.cpp:745:37: error: ext/standard/php_string.h: No such file or directory yenc_decode_wrap.cpp:1083:21: error: php_ini.h: No such file or directory yenc_decode_wrap.cpp:1084:31: error: ext/standard/info.h: No such file or directory yenc_decode_wrap.cpp:802: error: ‘E_ERROR’ was not declared in this scope yenc_decode_wrap.cpp:823: error: ISO C++ forbids declaration of ‘ZEND_RSRC_DTOR_FUNC’ with no type yenc_decode_wrap.cpp:823: error: ‘SWIG_landfill’ was not declared in this scope yenc_decode_wrap.cpp:823: error: expected ‘,’ or ‘;’ before ‘{’ token yenc_decode_wrap.cpp:829: error: variable or field ‘SWIG_ZTS_SetPointerZval’ declared void yenc_decode_wrap.cpp:829: error: ‘zval’ was not declared in this scope yenc_decode_wrap.cpp:829: error: ‘z’ was not declared in this scope yenc_decode_wrap.cpp:829: error: expected primary-expression before ‘void’ yenc_decode_wrap.cpp:829: error: expected primary-expression before ‘*’ token yenc_decode_wrap.cpp:829: error: ‘type’ was not declared in this scope yenc_decode_wrap.cpp:829: error: expected primary-expression before ‘int’ In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ios:40, from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ostream:40, from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/iostream:40, from yenc_decode.hpp:1, from yenc_decode_wrap.cpp:1091: /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/exception:35: error: expected declaration before end of line

The hell?

> g++ php-config --includes -fpic -c yenc_decode_wrap.cpp

yenc_decode_wrap.cpp: In function ‘void* SWIG_ZTSConvertResourcePtr(zval, swig_typeinfo, int)’: yenc_decodewrap.cpp:935: error: invalid conversion from ‘const char’ to ‘char_’

> g++ -fpic -c yenc_decode.cpp -lboost_regex

>

> g++ -shared *.o -o simple_php_yenc_decode.so -lboost_regex

>

Those error's what do they mean?

kevinlekiller commented 9 years ago

You need to resolve this issue. php-config5: command not found

This binary is included in the php5-dev package.

The binary can alternatively be called php-config.

Edit: On centos / red hat : yum install php-devel

Sweepr commented 9 years ago

Thank you, i tried but got this:

> yum install php-devel

Loaded plugins: fastestmirror Setting up Install Process Loading mirror speeds from cached hostfile

Dropped a ticket at hosting support for assistance,.

I'll update when i have new information.

Sweepr commented 9 years ago

Spoken with support and here what they said:

root@sp1r1t [~/simple_php_yenc_decode/source]# g++ /usr/local/bin/php-config --includes -fpic -c yenc_decode_wrap.cpp <- he ran the wrong command there

Must be: g++ '/usr/local/bin/php-config --includes' -fpic -c yenc_decode_wrap.cpp

cc1plus: error: unrecognized command line option "-fincludes" root@sp1r1t [~/simple_php_yenc_decode/source]#

I used php absolute path to run that command. You can also try to make a symlink of /usr/local/bin/php-config to php-config5 as you need.

What i did:

Creating symlink: (php-config -> php-config5)

root@sp1r1t [~/simple_php_yenc_decode/source]# ln -s /usr/local/bin/php-config /usr/local/bin/php-config5

Using absolute path:

root@sp1r1t [~/simple_php_yenc_decode/source]# g++ /usr/local/bin/php-config --includes -fpic -c yenc_decode_wrap.cpp

yenc_decode_wrap.cpp: In function ‘void* SWIG_ZTSConvertResourcePtr(zval, swig_typeinfo, int)’: yenc_decodewrap.cpp:935: error: invalid conversion from ‘const char’ to ‘char_’

root@sp1r1t [~/simple_php_yenc_decode/source]# g++ /usr/local/bin/php-config5 --includes -fpic -c yenc_decode_wrap.cpp yenc_decode_wrap.cpp: In function ‘void* SWIG_ZTSConvertResourcePtr(zval, swig_typeinfo, int)’: yenc_decodewrap.cpp:935: error: invalid conversion from ‘const char’ to ‘char_’

still something wrong here not sure what, does it matter if i use php-config or php-config5?

More from Support:

As it is a cpanel server, there is no need to install php-devel. The php-config command is working fine.

kevinlekiller commented 9 years ago

I'm guessing your swig is too old. I used version 2.

Sweepr commented 9 years ago

Alright.. i'll try to install a newer version and retry.

Keep you updated.

Sweepr commented 9 years ago

Installed swig -version

SWIG Version 3.0.5 Compiled with g++ [x86_64-unknown-linux-gnu] Configured options: +pcre

Retried the entire process and was succesfull this time!!

Thanks Kev.!

The yEnc decode was successful, you can now unzip yEnc.zip and run the html file in a browser to verify the result.

kevinlekiller commented 9 years ago

No problem, enjoy.