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
  •  | 
  •  

Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top