Open atlaschiew opened 1 year ago
1846 cd /usr/local/src
1847 mkdir php_source
1848 cd /usr/local/src
1849 mkdir php_source
1850 cd php_source
1851 wget http://be.php.net/distributions/php-7.2.tar.gz
1852 wget http://be.php.net/distributions/php-7.3.8.tar.gz
1853 ls
1854 gunzip php-7.3.8.tar.gz
1855 tar xvf php-7.3.8.tar
1856 ls
1857 cd php-7.3.8
1858 ls
1859 cd ext
1860 ls
1861 cd dbase
1862 cd ..
1863 ls
1864 phpsize
1865 phpize
1866 apt install php7-dev
1867 ls
1868 cd ext
1869 ls
1870 cd date
1871 ls
1872 cd ..
1873 ls
1874 git clone https://github.com/do-aki/gophp_sample
1875 ls
1876 cd gophp_sample
1877 ls
1878 phpize
1879 ./configure
1880 ls
1881 CGO_CFLAGS="-g -O0 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -DPHP_ATOM_INC \
-I./include -I./main \
-Iphp-config --include-dir
\
-Iphp-config --include-dir
/main \
-Iphp-config --include-dir
/TSRM \
-Iphp-config --include-dir
/Zend \
-Iphp-config --include-dir
/ext \
-Iphp-config --include-dir
/ext/date/lib \
-DHAVE_CONFIG_H -DCOMPILE_DL_GOPHP -fPIC -DPIC" CGO_LDFLAGS="-Wl,--export-dynamic -Wl,--unresolved-symbols=ignore-all -Wl,-z,nodelete" go build -p 1 -gcflags "-l" -buildmode=c-shared -o modules/gophp.so gophp.go export.go
1882 ls
1883 cd modules
1884 ls
1885 cd ..
1886 time php
1887 pwd
1888 time php -d extension=pwd
/modules/gophp.so -r 'echo go_fib(40) . PHP_EOL;'
1889 $ time php -d extension=pwd
/modules/gophp.so -r 'echo go_fib(40) . PHP_EOL;'
1890 102334155
1891 php -d extension=pwd
/modules/gophp.so -r 'echo go_fib(40) . PHP_EOL;' 1.87s user 0.03s system 99% cpu 1.909 total
1892 php -d extension=pwd
/modules/gophp.so -r 'echo go_fib(40) . PHP_EOL;'
1893 php -v
1894 ls
1895 nano gophp.php
1896 nano run-tests.php
1897 cd ..
1898 ls
1899 ls pdo
1900 ls pdo_mysql
1901 ls
1902 cd curl
1903 ls
1904 phpize
1905 ./configure
1906 ls
1907 cd modules
1908 ls
1909 cd ..
1910 ls
1911 cd build
1912 ls
1913 cd ..
1914 ls
1915 make
1916 ls
1917 ls modules
1918 cd ..
1919 ls
1920 cd gophp_sample
1921 ls
1922 cd modules
1923 ls
1924 cd /etc
1925 cd php
1926 ls
1927 cd 7.0
1928 ls
1929 cd mods-available
1930 ls
1931 cd ..
1932 cd cli
1933 ls
1934 cd conf.d
1935 ls
1936 cd ..
1937 nano php.ini
1938 php -i | grep extension_dir
1939 cd /usr/lib/php/20151012
1940 ls
1941 ls build
1942 ls
1943 cp /usr/local/src/php_source/php-7.3.8/ext/gophp_sample/modules/gophp.so ./
1944 ls
1945 php -i | grep 'Configuration File'
1946 nano /etc/php/7.0/cli/php.ini
1947 php -v
1948 ls
1949 cd ~
1950 ls
1951 mkdir php
1952 ls
1953 cd php
1954 nano test.php
1955 php test.php
1956 nano test.php
1957 php test.php
1958 php -i | grep extension_dir
1959 history
root@pythonai:~/php#
in cpanel environment:
$ cd /usr/local/src/php-7.0.1/ext/gophp_sample
$ /opt/cpanel/ea-php70/root/usr/bin/phpize
$ ./configure --with-php-config=/opt/cpanel/ea-php70/root/usr/bin/php-config
$ CGO_CFLAGS="-g -O0 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -DPHP_ATOM_INC \
-I./include -I./main \
-I`/opt/cpanel/ea-php70/root/usr/bin/php-config --include-dir` \
-I`/opt/cpanel/ea-php70/root/usr/bin/php-config --include-dir`/main \
-I`/opt/cpanel/ea-php70/root/usr/bin/php-config --include-dir`/TSRM \
-I`/opt/cpanel/ea-php70/root/usr/bin/php-config --include-dir`/Zend \
-I`/opt/cpanel/ea-php70/root/usr/bin/php-config --include-dir`/ext \
-I`/opt/cpanel/ea-php70/root/usr/bin/php-config --include-dir`/ext/date/lib \
-DHAVE_CONFIG_H -DCOMPILE_DL_GOPHP -fPIC -DPIC" \
CGO_LDFLAGS="-Wl,--export-dynamic -Wl,--unresolved-symbols=ignore-all -Wl,-z,nodelete" \
go build -p 1 -gcflags "-l" -buildmode=c-shared -o modules/gophp.so gophp.go export.go
$ /usr/local/bin/ea-php70
# /opt/cpanel/ea-php70/root/etc/php.ini
/usr/local/src/php-7.0.1/ext/gophp_sample/modules/gophp.so
/usr/local/bin/ea-php70 -c /home/cpaneluser/.user.ini -r "echo go_fib(40);"
/opt/cpanel/ea-php73/root/usr/lib64/php/modules/
https://github.com/do-aki/gophp_sample
https://ma.ttias.be/how-to-compile-and-install-php-extensions-from-source/