<?php
/**
 * Created by PhpStorm.
 * User: 24965
 * Date: 2017/1/16
 * Time: 20:18
 */
    $data=$_GET["data"];
    $user=$_SERVER['REMOTE_ADDR'];
    $file_name=$user.".php";
    if(file_exists('php_file/'.$file_name))
    {
        $php_file=fopen("php_file/".$file_name,"w") or die("no access authority");
        fwrite($php_file,$data);
        fclose($php_file);
    }
    else
    {
        $php_file=fopen("php_file/".$file_name,"wb") or die("no access authority");
        fwrite($php_file,$data);
        fclose($php_file);
    }
    $result_file=fopen("result_file/".$user.".txt","w") or die("no access authority");
$shell ="php php_file/$file_name >>"."result_file/$user.txt";    
system($shell);   //编译php文件
    echo "<script>
        document.getElementById('text').value=$result;
    </script>";
在hhvm上会出现“Failed to initialize central HHBC repository:
  Failed to open /var/www/.hhvm.hhbc: 14 - unable to open database file”的错误,我想问一下这是为什么,需要如何修改呢

解决方案 »

  1.   

    unable to open database file :无法打开数据库文件
      

  2.   

     Failed to open /var/www/.hhvm.hhbc: 14 - unable to open database file”的错误
    表示hhvm没办法打开数据库文件,你给出的代码并没有需要连接数据库的。$shell ="php php_file/$file_name >>"."result_file/$user.txt";  
    估计你这句里面的php需要连接数据库吧,可以检查以下连接数据库的部分。
      

  3.   

    但是为什么我写的这个shell命令在主机上可以执行
      

  4.   

    $shell ="php php_file/$file_name >>"."result_file/$user.txt";  你这个路径是相对路径。既然你在cli下可以执行,估计是路径问题了
    把这个改为/home/xxx/xxx的绝对路径试试。