PHP version is 4.4.9 when using exec() How do I change it on media temple without using .htaccess

StackOverflow https://stackoverflow.com/questions/8316680

  •  25-10-2019
  •  | 
  •  

문제

I am using php version 5.3 on media temple's grid server, however when I call a file using exec() the page is executing in PHP version: 4.4.9

The reason I am using exec() is to process the file in the background.

This is probably a simple question, but how do I manually set the PHP version to 5.3 for this file without using .htaccess?

Thanks.

도움이 되었습니까?

해결책

The PHP interpreter you invoke via exec() is often a CGI version installed on the server as /usr/bin/php. You need to find out if a more contemporary version is available and then call the interpreter explicitly:

exec("/usr/bin/php-5.3  your-script.php  &");

# or just adapt your scripts shebang #!/usr/bin/php5

(Just an example, the filename will be different. Also you can usually leave out the path. It's mostly just security relevant for setuid binaries.)

You might find out about other versions via print_r(glob("/usr/bin/php*")). But asking your hoster might be a better idea.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top