简体   繁体   中英

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

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.

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