diff --git a/Examples/CallPhpFunctions/Makefile b/Examples/CallPhpFunctions/Makefile index cd9ee434..9d675b8a 100644 --- a/Examples/CallPhpFunctions/Makefile +++ b/Examples/CallPhpFunctions/Makefile @@ -1,11 +1,9 @@ CPP = g++ RM = rm -f CPP_FLAGS = -Wall -c -I. -O2 -std=c++11 - -PREFIX = /usr -#Edit these lines to correspond with your own directories +PHP_CONFIG = $(shell which php-config) LIBRARY_DIR = $(shell ${PHP_CONFIG} --extension-dir) -PHP_CONFIG_DIR = /etc/php5/cli/conf.d +PHP_CONFIG_DIR = $(shell ${PHP_CONFIG} --ini-dir) LD = g++ LD_FLAGS = -Wall -shared -O2 @@ -28,5 +26,9 @@ ${OBJECTS}: ${CPP} ${CPP_FLAGS} -fpic -o $@ ${@:%.o=%.cpp} install: - cp -f ${RESULT} ${LIBRARY_DIR} - cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR} + cp -f ${RESULT} ${LIBRARY_DIR}/ + cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}/ + +uninstall: + rm ${LIBRARY_DIR}/${RESULT} + rm ${PHP_CONFIG_DIR}/${PHPINIFILE} diff --git a/Examples/ConstStaticProp/cpp/Makefile b/Examples/ConstStaticProp/cpp/Makefile index 7e951b4a..44789408 100644 --- a/Examples/ConstStaticProp/cpp/Makefile +++ b/Examples/ConstStaticProp/cpp/Makefile @@ -2,10 +2,9 @@ CPP = g++ RM = rm -f CPP_FLAGS = -Wall -c -I. -O2 -std=c++11 -PREFIX = /usr -#Edit these lines to correspond with your own directories +PHP_CONFIG = $(shell which php-config) LIBRARY_DIR = $(shell ${PHP_CONFIG} --extension-dir) -PHP_CONFIG_DIR = /etc/php5/cli/conf.d +PHP_CONFIG_DIR = $(shell ${PHP_CONFIG} --ini-dir) LD = g++ LD_FLAGS = -Wall -shared -O2 @@ -28,5 +27,9 @@ ${OBJECTS}: ${CPP} ${CPP_FLAGS} -fpic -o $@ ${@:%.o=%.cpp} install: - cp -f ${RESULT} ${LIBRARY_DIR} - cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR} + cp -f ${RESULT} ${LIBRARY_DIR}/ + cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}/ + +uninstall: + rm ${LIBRARY_DIR}/${RESULT} + rm ${PHP_CONFIG_DIR}/${PHPINIFILE} \ No newline at end of file diff --git a/Examples/CppClassesInPhp/Makefile b/Examples/CppClassesInPhp/Makefile index 581a50ee..36b7091c 100644 --- a/Examples/CppClassesInPhp/Makefile +++ b/Examples/CppClassesInPhp/Makefile @@ -29,7 +29,7 @@ NAME = cppclassinphp # one for each extension. Use this variable to specify this directory. # -INI_DIR = /etc/php5/conf.d +INI_DIR = $(shell php-config --ini-dir) # diff --git a/Examples/DlUnrestricted/Makefile b/Examples/DlUnrestricted/Makefile index 86cddfdf..36ace0b5 100644 --- a/Examples/DlUnrestricted/Makefile +++ b/Examples/DlUnrestricted/Makefile @@ -29,7 +29,7 @@ NAME = dlunrestricted # one for each extension. Use this variable to specify this directory. # -INI_DIR = /etc/php5/mods-available +INI_DIR = $(shell php-config --ini-dir) # diff --git a/Examples/EmptyExtension/Makefile b/Examples/EmptyExtension/Makefile index deb78f26..d5525910 100644 --- a/Examples/EmptyExtension/Makefile +++ b/Examples/EmptyExtension/Makefile @@ -29,7 +29,7 @@ NAME = yourextension # one for each extension. Use this variable to specify this directory. # -INI_DIR = /etc/php5/mods-available/ +INI_DIR = $(shell php-config --ini-dir) # diff --git a/Examples/Exceptions/ExceptionCatch/Makefile b/Examples/Exceptions/ExceptionCatch/Makefile index 83537dd2..e380c64c 100644 --- a/Examples/Exceptions/ExceptionCatch/Makefile +++ b/Examples/Exceptions/ExceptionCatch/Makefile @@ -2,10 +2,9 @@ CPP = g++ RM = rm -f CPP_FLAGS = -Wall -c -I. -O2 -std=c++11 -PREFIX = /usr -#Edit these lines to correspond with your own directories +PHP_CONFIG = $(shell which php-config) LIBRARY_DIR = $(shell ${PHP_CONFIG} --extension-dir) -PHP_CONFIG_DIR = /etc/php5/cli/conf.d +PHP_CONFIG_DIR = $(shell ${PHP_CONFIG} --ini-dir) LD = g++ LD_FLAGS = -Wall -shared -O2 @@ -28,5 +27,9 @@ ${OBJECTS}: ${CPP} ${CPP_FLAGS} -fpic -o $@ ${@:%.o=%.cpp} install: - cp -f ${RESULT} ${LIBRARY_DIR} - cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR} + cp -f ${RESULT} ${LIBRARY_DIR}/ + cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}/ + +uninstall: + rm ${LIBRARY_DIR}/${RESULT} + rm ${PHP_CONFIG_DIR}/${PHPINIFILE} diff --git a/Examples/Exceptions/ExceptionThrow/Makefile b/Examples/Exceptions/ExceptionThrow/Makefile index c8571ca3..8e8f7ba1 100644 --- a/Examples/Exceptions/ExceptionThrow/Makefile +++ b/Examples/Exceptions/ExceptionThrow/Makefile @@ -2,10 +2,9 @@ CPP = g++ RM = rm -f CPP_FLAGS = -Wall -c -I. -O2 -std=c++11 -PREFIX = /usr -#Edit these lines to correspond with your own directories +PHP_CONFIG = $(shell which php-config) LIBRARY_DIR = $(shell ${PHP_CONFIG} --extension-dir) -PHP_CONFIG_DIR = /etc/php5/cli/conf.d +PHP_CONFIG_DIR = $(shell ${PHP_CONFIG} --ini-dir) LD = g++ LD_FLAGS = -Wall -shared -O2 @@ -28,5 +27,9 @@ ${OBJECTS}: ${CPP} ${CPP_FLAGS} -fpic -o $@ ${@:%.o=%.cpp} install: - cp -f ${RESULT} ${LIBRARY_DIR} - cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR} + cp -f ${RESULT} ${LIBRARY_DIR}/ + cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}/ + +uninstall: + rm ${LIBRARY_DIR}/${RESULT} + rm ${PHP_CONFIG_DIR}/${PHPINIFILE} diff --git a/Examples/Extension/Makefile b/Examples/Extension/Makefile index a55b6c1d..dae0ef7b 100644 --- a/Examples/Extension/Makefile +++ b/Examples/Extension/Makefile @@ -2,10 +2,9 @@ CPP = g++ RM = rm -f CPP_FLAGS = -Wall -c -I. -O2 -std=c++11 -PREFIX = /usr -#Edit these lines to correspond with your own directories +PHP_CONFIG = $(shell which php-config) LIBRARY_DIR = $(shell ${PHP_CONFIG} --extension-dir) -PHP_CONFIG_DIR = /etc/php5/cli/conf.d +PHP_CONFIG_DIR = $(shell ${PHP_CONFIG} --ini-dir) LD = g++ LD_FLAGS = -Wall -shared -O2 @@ -28,5 +27,9 @@ ${OBJECTS}: ${CPP} ${CPP_FLAGS} -fpic -o $@ ${@:%.o=%.cpp} install: - cp -f ${RESULT} ${LIBRARY_DIR} - cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR} + cp -f ${RESULT} ${LIBRARY_DIR}/ + cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}/ + +uninstall: + rm ${LIBRARY_DIR}/${RESULT} + rm ${PHP_CONFIG_DIR}/${PHPINIFILE} diff --git a/Examples/FunctionNoParameters/Makefile b/Examples/FunctionNoParameters/Makefile index ccd4ac22..792784c5 100644 --- a/Examples/FunctionNoParameters/Makefile +++ b/Examples/FunctionNoParameters/Makefile @@ -2,10 +2,9 @@ CPP = g++ RM = rm -f CPP_FLAGS = -Wall -c -I. -O2 -std=c++11 -PREFIX = /usr -#Edit these lines to correspond with your own directories +PHP_CONFIG = $(shell which php-config) LIBRARY_DIR = $(shell ${PHP_CONFIG} --extension-dir) -PHP_CONFIG_DIR = /etc/php5/cli/conf.d +PHP_CONFIG_DIR = $(shell ${PHP_CONFIG} --ini-dir) LD = g++ LD_FLAGS = -Wall -shared -O2 @@ -28,5 +27,9 @@ ${OBJECTS}: ${CPP} ${CPP_FLAGS} -fpic -o $@ ${@:%.o=%.cpp} install: - cp -f ${RESULT} ${LIBRARY_DIR} - cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR} + cp -f ${RESULT} ${LIBRARY_DIR}/ + cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}/ + +uninstall: + rm ${LIBRARY_DIR}/${RESULT} + rm ${PHP_CONFIG_DIR}/${PHPINIFILE} \ No newline at end of file diff --git a/Examples/FunctionReturnValue/Makefile b/Examples/FunctionReturnValue/Makefile index 0a2e1c30..cccbbdaf 100644 --- a/Examples/FunctionReturnValue/Makefile +++ b/Examples/FunctionReturnValue/Makefile @@ -2,10 +2,9 @@ CPP = g++ RM = rm -f CPP_FLAGS = -Wall -c -I. -O2 -std=c++11 -PREFIX = /usr -#Edit these lines to correspond with your own directories +PHP_CONFIG = $(shell which php-config) LIBRARY_DIR = $(shell ${PHP_CONFIG} --extension-dir) -PHP_CONFIG_DIR = /etc/php5/cli/conf.d +PHP_CONFIG_DIR = $(shell ${PHP_CONFIG} --ini-dir) LD = g++ LD_FLAGS = -Wall -shared -O2 @@ -28,5 +27,9 @@ ${OBJECTS}: ${CPP} ${CPP_FLAGS} -fpic -o $@ ${@:%.o=%.cpp} install: - cp -f ${RESULT} ${LIBRARY_DIR} - cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR} + cp -f ${RESULT} ${LIBRARY_DIR}/ + cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}/ + +uninstall: + rm ${LIBRARY_DIR}/${RESULT} + rm ${PHP_CONFIG_DIR}/${PHPINIFILE} diff --git a/Examples/FunctionVoid/Makefile b/Examples/FunctionVoid/Makefile index fbf4bdd5..1fb4ac19 100644 --- a/Examples/FunctionVoid/Makefile +++ b/Examples/FunctionVoid/Makefile @@ -2,10 +2,9 @@ CPP = g++ RM = rm -f CPP_FLAGS = -Wall -c -I. -O2 -std=c++11 -PREFIX = /usr -#Edit these lines to correspond with your own directories +PHP_CONFIG = $(shell which php-config) LIBRARY_DIR = $(shell ${PHP_CONFIG} --extension-dir) -PHP_CONFIG_DIR = /etc/php5/cli/conf.d +PHP_CONFIG_DIR = $(shell ${PHP_CONFIG} --ini-dir) LD = g++ LD_FLAGS = -Wall -shared -O2 @@ -28,5 +27,9 @@ ${OBJECTS}: ${CPP} ${CPP_FLAGS} -fpic -o $@ ${@:%.o=%.cpp} install: - cp -f ${RESULT} ${LIBRARY_DIR} - cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR} + cp -f ${RESULT} ${LIBRARY_DIR}/ + cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}/ + +uninstall: + rm ${LIBRARY_DIR}/${RESULT} + rm ${PHP_CONFIG_DIR}/${PHPINIFILE} diff --git a/Examples/FunctionWithParameters/Makefile b/Examples/FunctionWithParameters/Makefile index bbebb43d..8ed62bae 100644 --- a/Examples/FunctionWithParameters/Makefile +++ b/Examples/FunctionWithParameters/Makefile @@ -2,10 +2,9 @@ CPP = g++ RM = rm -f CPP_FLAGS = -Wall -c -I. -O2 -std=c++11 -PREFIX = /usr -#Edit these lines to correspond with your own directories +PHP_CONFIG = $(shell which php-config) LIBRARY_DIR = $(shell ${PHP_CONFIG} --extension-dir) -PHP_CONFIG_DIR = /etc/php5/cli/conf.d +PHP_CONFIG_DIR = $(shell ${PHP_CONFIG} --ini-dir) LD = g++ LD_FLAGS = -Wall -shared -O2 @@ -28,5 +27,9 @@ ${OBJECTS}: ${CPP} ${CPP_FLAGS} -fpic -o $@ ${@:%.o=%.cpp} install: - cp -f ${RESULT} ${LIBRARY_DIR} - cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR} + cp -f ${RESULT} ${LIBRARY_DIR}/ + cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}/ + +uninstall: + rm ${LIBRARY_DIR}/${RESULT} + rm ${PHP_CONFIG_DIR}/${PHPINIFILE} diff --git a/Examples/Globals/Makefile b/Examples/Globals/Makefile index fec79f70..8872ed87 100644 --- a/Examples/Globals/Makefile +++ b/Examples/Globals/Makefile @@ -2,10 +2,9 @@ CPP = g++ RM = rm -f CPP_FLAGS = -Wall -c -I. -O2 -std=c++11 -PREFIX = /usr -PHP_CONFIG = php-config +PHP_CONFIG = $(shell which php-config) LIBRARY_DIR = $(shell ${PHP_CONFIG} --extension-dir) -PHP_CONFIG_DIR = /etc/php5/cli/conf.d +PHP_CONFIG_DIR = $(shell ${PHP_CONFIG} --ini-dir) LD = g++ LD_FLAGS = -Wall -shared -O2 @@ -28,5 +27,9 @@ ${OBJECTS}: ${CPP} ${CPP_FLAGS} -fpic -o $@ ${@:%.o=%.cpp} install: - cp -f ${RESULT} ${LIBRARY_DIR} - cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR} + cp -f ${RESULT} ${LIBRARY_DIR}/ + cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}/ + +uninstall: + rm ${LIBRARY_DIR}/${RESULT} + rm ${PHP_CONFIG_DIR}/${PHPINIFILE} diff --git a/Examples/ReturnObject/Makefile b/Examples/ReturnObject/Makefile index 526e4bc2..b154d389 100644 --- a/Examples/ReturnObject/Makefile +++ b/Examples/ReturnObject/Makefile @@ -29,7 +29,7 @@ NAME = returnobject # one for each extension. Use this variable to specify this directory. # -INI_DIR = /etc/php5/mods-available/ +INI_DIR = $(shell php-config --ini-dir) # diff --git a/Examples/simple/Makefile b/Examples/simple/Makefile index a85c7f8d..8e38e21e 100644 --- a/Examples/simple/Makefile +++ b/Examples/simple/Makefile @@ -2,12 +2,9 @@ CPP = g++ RM = rm -f CPP_FLAGS = -Wall -c -I. -I/home/work/include/ -O2 -std=c++11 -PREFIX = /home/work/ - -#Edit these lines to correspond with your own directories -LIBRARY_DIR = ${PREFIX}/local/php/lib/php/extensions/no-debug-non-zts-20090626/ - -PHP_CONFIG_DIR = /home/work/local/php/lib/ +PHP_CONFIG = $(shell which php-config) +LIBRARY_DIR = $(shell ${PHP_CONFIG} --extension-dir) +PHP_CONFIG_DIR = $(shell ${PHP_CONFIG} --ini-dir) LD = g++ LD_FLAGS = -Wall -Wl,-rpath,/home/work/lib -shared -O2 -L/home/work/lib @@ -30,5 +27,9 @@ ${OBJECTS}: ${CPP} ${CPP_FLAGS} -fpic -o $@ ${@:%.o=%.cpp} install: - cp -f ${RESULT} ${LIBRARY_DIR} - cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR} + cp -f ${RESULT} ${LIBRARY_DIR}/ + cp -f ${PHPINIFILE} ${PHP_CONFIG_DIR}/ + +uninstall: + rm ${LIBRARY_DIR}/${RESULT} + rm ${PHP_CONFIG_DIR}/${PHPINIFILE} diff --git a/README.md b/README.md index 6171477f..35fb0501 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,6 @@ The PHP-CPP library is a C++ library for developing PHP extensions. It offers a of well documented and easy-to-use classes that can be used and extended to build native extensions for PHP. The full documentation can be found on http://www.php-cpp.com. -**Watch out: PHP 7 only!** -This library has been updated to work with PHP versions 7.0 and up. If you wish to create -extensions for older PHP versions, use the [PHP-CPP-LEGACY](https://github.com/CopernicaMarketingSoftware/PHP-CPP-LEGACY) -library instead. The PHP-CPP and PHP-CPP-LEGACY library have (almost) identical API's, -so you can easily port extensions for PHP 5.* to PHP 7 and the other way around. - ABOUT =====