WebFaction
Community site: login faq

I found an answer here https://community.webfaction.com/questions/19408/how-do-i-set-environment-variables-for-php

But when I tried it, my whole site become 400 Bad Request and broken.

My site is https://test.thesyne.com/fitnation/ and here are my files:

CGI (Permission already set to 711, and I already replaced MY_USERNAME)

#!/bin/sh

# set the env variables
export MY_ENV=HelloWorld

# run the original script via PHP CGI
exec /home/php-cgi/php70.cgi /home/MY_USERNAME/webapps/fitnation/index.php

HTACCESS

...
## End Wordpress


Action php_custom env.cgi
<FilesMatch .php$>
    SetHandler php_custom
</FilesMatch>

asked 02 Jul, 10:17

hrsetyono
133
accept rate: 0%

edited 02 Jul, 10:19


Try changing this...

exec /home/php-cgi/php70.cgi /home/MY_USERNAME/webapps/fitnation/index.php

... to this ...

exec /home/php-cgi/php70.cgi /home/MY_USERNAME/webapps/fitnation$SCRIPT_URL
permanent link

answered 02 Jul, 18:02

seanf
12.2k21736
accept rate: 37%

Hi, I still got 400 Bad Request. I'm leaving my site broken for you to see http://test.thesyne.com/fitnation/. I also changed php70 to php55 because that's the version I use. Still error

(03 Jul, 01:58) hrsetyono

The script containing the variable wasn't working because it had Windows line endings.

It started after using the dos2unix command on it.

permanent link

answered 03 Jul, 16:09

iliasr ♦♦
2.0k14
accept rate: 36%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×261

question asked: 02 Jul, 10:17

question was seen: 166 times

last updated: 03 Jul, 16:09

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2016 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM