Score:0

Error when I specify multiple options in my PHP bash script

bj flag
#!/usr/bin/php -d register_argc_argv=1
...

At the top of my PHP script, I have the above and it works well. However, I need to add another -q and changed it to #!/usr/bin/php -q -d register_argc_argv=1.

But it results with the error

The following text was generated during the delivery attempt:

------ pipe to |/home/user/email_pipe.php /home/user
       generated by email@example.com ------

Error in argument 1, char 3: option not found 
Usage: php-cgi [-q] [-h] [-s] [-v] [-i] [-f <file>]
       php-cgi <file> [args...]
  -a               Run interactively
  -b <address:port>|<port> Bind Path for external FASTCGI Server mode
  -C               Do not chdir to the script's directory
  -c <path>|<file> Look for php.ini file in this directory

Any idea? My script has the correct LF endings.

Score:0
bj flag

I found an answer: #!/usr/bin/php -qd register_argc_argv=1

I'm pretty sure I tried this before posting, somehow it gave me the impression things were not working.

Also, multiple parameters are not supported based on my further googling

https://unix.stackexchange.com/questions/399690/multiple-arguments-in-shebang

Hope this helps anyone who is struggling with email piping

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.