質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
PHP

PHPは、Webサイト構築に特化して開発されたプログラミング言語です。大きな特徴のひとつは、HTMLに直接プログラムを埋め込むことができるという点です。PHPを用いることで、HTMLを動的コンテンツとして出力できます。HTMLがそのままブラウザに表示されるのに対し、PHPプログラムはサーバ側で実行された結果がブラウザに表示されるため、PHPスクリプトは「サーバサイドスクリプト」と呼ばれています。

Q&A

解決済

1回答

1408閲覧

PECL :: Package :: uuid ライブラリの導入方法が知りたい。

退会済みユーザー

退会済みユーザー

総合スコア0

PHP

PHPは、Webサイト構築に特化して開発されたプログラミング言語です。大きな特徴のひとつは、HTMLに直接プログラムを埋め込むことができるという点です。PHPを用いることで、HTMLを動的コンテンツとして出力できます。HTMLがそのままブラウザに表示されるのに対し、PHPプログラムはサーバ側で実行された結果がブラウザに表示されるため、PHPスクリプトは「サーバサイドスクリプト」と呼ばれています。

0グッド

0クリップ

投稿2022/02/15 01:59

編集2022/02/15 02:11

提示コードですが参考サイト参考にPECLライブラリを導入してphp.iniに下記を最後に記述したのですがecho で試しに出力してみると以下の構文エラーが表示されますこれな何が原因なのでしょうか?

You should add "extension=uuid.so" to php.ini

参考サイト: https://blog.katty.in/5124#toc1
Github: https://github.com/ramsey/uuid

shigurechan@shigurechan-System-Product-Name:~/ダウンロード/uuid-1.2.0$ sudo pecl install uuid WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update downloading uuid-1.2.0.tgz ... Starting to download uuid-1.2.0.tgz (16,270 bytes) ......done: 16,270 bytes 6 source files, building running: phpize Configuring for: PHP Api Version: 20190902 Zend Module Api No: 20190902 Zend Extension Api No: 320190902 uuid installation directory? [autodetect] : ~../../ building in /tmp/pear/temp/pear-build-rootKyr0Vf/uuid-1.2.0 running: /tmp/pear/temp/uuid/configure --with-php-config=/usr/bin/php-config --with-uuid=~../../ checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for a sed that does not truncate output... /usr/bin/sed checking for pkg-config... /usr/bin/pkg-config checking pkg-config is at least version 0.9.0... yes checking for cc... cc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether cc accepts -g... yes checking for cc option to accept ISO C89... none needed checking how to run the C preprocessor... cc -E checking for icc... no checking for suncc... no checking for system library directory... lib checking if compiler supports -R... no checking if compiler supports -Wl,-rpath,... yes checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking target system type... x86_64-pc-linux-gnu checking for PHP prefix... /usr checking for PHP includes... -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib checking for PHP extension directory... /usr/lib/php/20190902 checking for PHP installed headers prefix... /usr/include/php/20190902 checking if debug is enabled... no checking if zts is enabled... no checking for gawk... no checking for nawk... nawk checking if nawk is broken... no checking whether uuid is available... yes, shared checking for the location of libuuid... found in /usr checking for uuid_type in -luuid... yes checking for uuid_variant in -luuid... yes checking for uuid_generate_md5 in -luuid... yes checking for uuid_generate_sha1 in -luuid... yes checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking uuid/uuid.h usability... yes checking uuid/uuid.h presence... yes checking for uuid/uuid.h... yes checking for a sed that does not truncate output... /usr/bin/sed checking for ld used by cc... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for /usr/bin/ld option to reload object files... -r checking for BSD-compatible nm... /usr/bin/nm -B checking whether ln -s works... yes checking how to recognize dependent libraries... pass_all checking dlfcn.h usability... yes checking dlfcn.h presence... yes checking for dlfcn.h... yes checking the maximum length of command line arguments... 1572864 checking command to parse /usr/bin/nm -B output from cc object... ok checking for objdir... .libs checking for ar... ar checking for ranlib... ranlib checking for strip... strip checking if cc supports -fno-rtti -fno-exceptions... no checking for cc option to produce PIC... -fPIC checking if cc PIC flag -fPIC works... yes checking if cc static flag -static works... yes checking if cc supports -c -o file.o... yes checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... no creating libtool appending configuration tag "CXX" to libtool configure: patching config.h.in configure: creating ./config.status config.status: creating config.h running: make /bin/bash /tmp/pear/temp/pear-build-rootKyr0Vf/uuid-1.2.0/libtool --mode=compile cc -I. -I/tmp/pear/temp/uuid -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootKyr0Vf/uuid-1.2.0/include -I/tmp/pear/temp/pear-build-rootKyr0Vf/uuid-1.2.0/main -I/tmp/pear/temp/uuid -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/uuid/uuid.c -o uuid.lo mkdir .libs cc -I. -I/tmp/pear/temp/uuid -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootKyr0Vf/uuid-1.2.0/include -I/tmp/pear/temp/pear-build-rootKyr0Vf/uuid-1.2.0/main -I/tmp/pear/temp/uuid -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/uuid/uuid.c -fPIC -DPIC -o .libs/uuid.o /bin/bash /tmp/pear/temp/pear-build-rootKyr0Vf/uuid-1.2.0/libtool --mode=link cc -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootKyr0Vf/uuid-1.2.0/include -I/tmp/pear/temp/pear-build-rootKyr0Vf/uuid-1.2.0/main -I/tmp/pear/temp/uuid -I/usr/include/php/20190902 -I/usr/include/php/20190902/main -I/usr/include/php/20190902/TSRM -I/usr/include/php/20190902/Zend -I/usr/include/php/20190902/ext -I/usr/include/php/20190902/ext/date/lib -DHAVE_CONFIG_H -g -O2 -o uuid.la -export-dynamic -avoid-version -prefer-pic -module -rpath /tmp/pear/temp/pear-build-rootKyr0Vf/uuid-1.2.0/modules uuid.lo -luuid cc -shared .libs/uuid.o -luuid -Wl,-soname -Wl,uuid.so -o .libs/uuid.so creating uuid.la (cd .libs && rm -f uuid.la && ln -s ../uuid.la uuid.la) /bin/bash /tmp/pear/temp/pear-build-rootKyr0Vf/uuid-1.2.0/libtool --mode=install cp ./uuid.la /tmp/pear/temp/pear-build-rootKyr0Vf/uuid-1.2.0/modules cp ./.libs/uuid.so /tmp/pear/temp/pear-build-rootKyr0Vf/uuid-1.2.0/modules/uuid.so cp ./.libs/uuid.lai /tmp/pear/temp/pear-build-rootKyr0Vf/uuid-1.2.0/modules/uuid.la PATH="$PATH:/sbin" ldconfig -n /tmp/pear/temp/pear-build-rootKyr0Vf/uuid-1.2.0/modules ---------------------------------------------------------------------- Libraries have been installed in: /tmp/pear/temp/pear-build-rootKyr0Vf/uuid-1.2.0/modules If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-Wl,--rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- Build complete. Don't forget to run 'make test'. running: make INSTALL_ROOT="/tmp/pear/temp/pear-build-rootKyr0Vf/install-uuid-1.2.0" install Installing shared extensions: /tmp/pear/temp/pear-build-rootKyr0Vf/install-uuid-1.2.0/usr/lib/php/20190902/ running: find "/tmp/pear/temp/pear-build-rootKyr0Vf/install-uuid-1.2.0" | xargs ls -dils 3540812 4 drwxr-xr-x 3 root root 4096 2月 15 10:53 /tmp/pear/temp/pear-build-rootKyr0Vf/install-uuid-1.2.0 3540834 4 drwxr-xr-x 3 root root 4096 2月 15 10:53 /tmp/pear/temp/pear-build-rootKyr0Vf/install-uuid-1.2.0/usr 3540835 4 drwxr-xr-x 3 root root 4096 2月 15 10:53 /tmp/pear/temp/pear-build-rootKyr0Vf/install-uuid-1.2.0/usr/lib 3540836 4 drwxr-xr-x 3 root root 4096 2月 15 10:53 /tmp/pear/temp/pear-build-rootKyr0Vf/install-uuid-1.2.0/usr/lib/php 3540837 4 drwxr-xr-x 2 root root 4096 2月 15 10:53 /tmp/pear/temp/pear-build-rootKyr0Vf/install-uuid-1.2.0/usr/lib/php/20190902 3540832 92 -rwxr-xr-x 1 root root 90632 2月 15 10:53 /tmp/pear/temp/pear-build-rootKyr0Vf/install-uuid-1.2.0/usr/lib/php/20190902/uuid.so Build process completed successfully Installing '/usr/lib/php/20190902/uuid.so' install ok: channel://pecl.php.net/uuid-1.2.0 configuration option "php_ini" is not set to php.ini location You should add "extension=uuid.so" to php.ini shigurechan@shigurechan-System-Product-Name:~/ダウンロード/uuid-1.2.0$ echo uuid_create(UUID_TYPE_RANDOM); bash: 予期しないトークン `(' 周辺に構文エラーがあります shigurechan@shigurechan-System-Product-Name:~/ダウンロード/uuid-1.2.0$ echo uuid_create(UUID_TYPE_RANDOM); bash: 予期しないトークン `(' 周辺に構文エラーがあります shigurechan@shigurechan-System-Product-Name:~/ダウンロード/uuid-1.2.0$ echo uuid_create(UUID_TYPE_RANDOM); bash: 予期しないトークン `(' 周辺に構文エラーがあります shigurechan@shigurechan-System-Product-Name:~/ダウンロード/uuid-1.2.0$

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

以下のサイトを見て解決しました。
原因:使いたいプロジェクトのフォルダ内でcomposer require ramsey/uuidコマンドを入力する
参考サイト:https://mebee.info/2020/08/17/post-13494/

投稿2022/02/15 02:16

退会済みユーザー

退会済みユーザー

総合スコア0

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問