简体   繁体   中英

How to enable php-fpm on aws elastic beanstalk via ebextensions

I am trying to modify https://gist.github.com/mattzuba/430a3a0b4cd36a2cc1ac#file-01_httpd_phpfpm-config

to work on my aws beankstalk instance running php 7 and amazon linux.

Here is the modified version. https://pastebin.com/JM9DNcsa

But when I deploy, I get a lot of errors.

  [04-Feb-2020 17:22:28] ERROR: Unable to include /etc/php-fpm-7.1.d/www.conf from /etc/php-fpm.conf at line 5
  [04-Feb-2020 17:22:28] ERROR: failed to load configuration file '/etc/php-fpm.conf'
  [04-Feb-2020 17:22:28] ERROR: FPM initialization failed
  [FAILED] (ElasticBeanstalk::ExternalInvocationError)
caused by: Starting php-fpm-7.1: [04-Feb-2020 17:22:28] ERROR: [/etc/php-fpm-7.1.d/www.conf:5] unknown entry '#listen'
  [04-Feb-2020 17:22:28] ERROR: Unable to include /etc/php-fpm-7.1.d/www.conf from /etc/php-fpm.conf at line 5
  [04-Feb-2020 17:22:28] ERROR: failed to load configuration file '/etc/php-fpm.conf'
  [04-Feb-2020 17:22:28] ERROR: FPM initialization failed
  [FAILED] (Executor::NonZeroExitStatus)


[2020-02-04T17:22:28.532Z] ERROR [12942] : Command CMD-AppDeploy failed!
[2020-02-04T17:22:28.533Z] INFO  [12942] : Command processor returning results: 
{"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"(TRUNCATED)...4-Feb-2020 17:22:28] ERROR: Unable to include /etc/php-fpm-7.1.d/www.conf from /etc/php-fpm.conf at line 5\n[04-Feb-2020 17:22:28] ERROR: failed to load configuration file '/etc/php-fpm.conf'\n[04-Feb-2020 17:22:28] ERROR: FPM initialization failed\n[FAILED]. \nHook /opt/elasticbeanstalk/hooks/appdeploy/pre/27_phpfpm_start.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI","returncode":1,"events":[]}],"truncated":"true"}

If I ssh into ec2, Among many other files, I do see the following in /etc/

php-7.1.conf                     
php-7.1.d                        
php-7.1.ini                        
php.d                              
php-fpm-7.1.conf                   
php-fpm-7.1.d                      
php-fpm.conf                       
php-fpm.d                          
php.ini                            
php-zts-7.1.d 

Any help is appreciated.

It looks like you are using # to comment on line 5 (line 66 in your file) in /etc/php-fpm.d/www.conf . And you would just need to replace that with ; .

From https://www.php.net/manual/en/configuration.file.php 7.0.0 Hash marks (#) are no longer recognized as comments.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM