Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/245.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何修复';[stderr]和#x27;在写入php.ini文件以激活imagick php扩展名时,BeforeInstall脚本中sed命令的输出?_Php_Amazon Web Services_Imagick_Stderr_Aws Code Deploy - Fatal编程技术网

如何修复';[stderr]和#x27;在写入php.ini文件以激活imagick php扩展名时,BeforeInstall脚本中sed命令的输出?

如何修复';[stderr]和#x27;在写入php.ini文件以激活imagick php扩展名时,BeforeInstall脚本中sed命令的输出?,php,amazon-web-services,imagick,stderr,aws-code-deploy,Php,Amazon Web Services,Imagick,Stderr,Aws Code Deploy,正在尝试将AWS CodeDeploy用于PHP Symfony应用程序 安装前脚本遇到问题 安装前脚本(安装服务器依赖项)如下所示 脚本正在以root用户身份执行,因此不清楚是否存在权限问题 我尝试使用sudo sed…运行替代版本,但没有成功 appspec.yml 安装_server_dependencies.sh #/bin/bash #导航到公共web目录 cd/var/www/html/ #安装服务器依赖项 yum-y更新 yum-y安装httpd24 yum-y安装php73 yu

正在尝试将AWS CodeDeploy用于PHP Symfony应用程序

安装前脚本遇到问题

安装前脚本(安装服务器依赖项)如下所示

脚本正在以root用户身份执行,因此不清楚是否存在权限问题

我尝试使用
sudo sed…
运行替代版本,但没有成功

appspec.yml

安装_server_dependencies.sh

#/bin/bash
#导航到公共web目录
cd/var/www/html/
#安装服务器依赖项
yum-y更新
yum-y安装httpd24
yum-y安装php73
yum-y安装php73-devel
yum-y安装php73-mysql
yum-y安装php73-pgsql
yum-y安装php73-pdo
yum-y安装php73 mbstring
yum-y安装php73 mcrypt
yum-y安装php73-pecl-gd
yum-y安装php-pecl-imagick
yum-y安装ImageMagick
#存储PHP初始化文件位置
PHP_INI_PATH='/etc/PHP-7.3.d/PHP.INI'
#激活扩展
如果!grep-Fxq'extension=imagick.so'${PHP\u INI\u PATH};然后
模块设置=$(cat${PHP_INI_PATH}| grep-n';模块设置;'| grep-o'^[0-9]*'))
动态_扩展=$((模块_设置-2))
sed-i${dynamic_extensions}'i\'$'\n''extension=imagick.so'$'\n'${PHP_INI_PATH}
fi
在AfterInstall脚本执行composer安装之前,我希望输出能够安装服务器依赖项并激活imagick扩展

以下输出显示在CodeDeploy控制台中

Error code
ScriptFailed
Script name
scripts/install_server_dependencies.sh
Message
Script at specified location: scripts/install_server_dependencies.sh run as user root failed with exit code 4
[stderr]--遵循符号链接
[stderr]处理到位时遵循符号链接;硬链接
[stderr]仍将被破坏。
[stderr]-i[后缀],--in-place[=后缀]
[stderr]就地编辑文件(如果提供扩展名,则进行备份)。
[stderr]默认操作模式是断开符号链接和硬链接。
[stderr]这可以通过--follow symlinks和--copy来更改。
[stderr]-c,--copy
[stderr]在-i模式下洗牌文件时,使用复制而不是重命名。
[stderr]虽然这样可以避免断开链接(符号链接或硬链接),但是
[stderr]生成的编辑操作不是原子操作。这种情况很少发生
[stderr]所需的模式--遵循符号链接通常就足够了,并且
[stderr]它既快又安全。
[stderr]-ln,--线长度=N
[stderr]为'l'命令指定所需的换行长度
[stderr]--posix
[stderr]禁用所有GNU扩展。
[stderr]-r,--regexp扩展
[stderr]在脚本中使用扩展正则表达式。
[stderr]-s,--separate
[StDRR]将文件视为独立的而不是单个连续的
[stderr]长流。
[stderr]-u,--无缓冲
[stderr]从输入文件加载最小数量的数据并刷新
[stderr]输出缓冲更频繁
[stderr]--帮助显示此帮助并退出
[stderr]--版本输出版本信息并退出
[stderr]
[stderr]如果未给出-e、-expression、-f或--file选项,则第一个
[stderr]非选项参数作为sed脚本进行解释。全部的
[stderr]其余参数是输入文件的名称;如果没有输入文件
指定[stderr],则读取标准输入。
[stderr]
[stderr]基于GNU的主页:。
[stderr]使用GNU软件的一般帮助:。
Error code
ScriptFailed
Script name
scripts/install_server_dependencies.sh
Message
Script at specified location: scripts/install_server_dependencies.sh run as user root failed with exit code 4
[stderr] --follow-symlinks
[stderr] follow symlinks when processing in place; hard links
[stderr] will still be broken.
[stderr] -i[SUFFIX], --in-place[=SUFFIX]
[stderr] edit files in place (makes backup if extension supplied).
[stderr] The default operation mode is to break symbolic and hard links.
[stderr] This can be changed with --follow-symlinks and --copy.
[stderr] -c, --copy
[stderr] use copy instead of rename when shuffling files in -i mode.
[stderr] While this will avoid breaking links (symbolic or hard), the
[stderr] resulting editing operation is not atomic. This is rarely
[stderr] the desired mode; --follow-symlinks is usually enough, and
[stderr] it is both faster and more secure.
[stderr] -l N, --line-length=N
[stderr] specify the desired line-wrap length for the `l' command
[stderr] --posix
[stderr] disable all GNU extensions.
[stderr] -r, --regexp-extended
[stderr] use extended regular expressions in the script.
[stderr] -s, --separate
[stderr] consider files as separate rather than as a single continuous
[stderr] long stream.
[stderr] -u, --unbuffered
[stderr] load minimal amounts of data from the input files and flush
[stderr] the output buffers more often
[stderr] --help display this help and exit
[stderr] --version output version information and exit
[stderr]
[stderr]If no -e, --expression, -f, or --file option is given, then the first
[stderr]non-option argument is taken as the sed script to interpret. All
[stderr]remaining arguments are names of input files; if no input files are
[stderr]specified, then the standard input is read.
[stderr]
[stderr]GNU sed home page: <http://www.gnu.org/software/sed/>.
[stderr]General help using GNU software: <http://www.gnu.org/gethelp/>.