CPanel不允许使用脚本创建文件吗? [英] CPanel does not allow using script to create file?

查看:63
本文介绍了CPanel不允许使用脚本创建文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的php文件中具有以下功能,并且我的脚本放置在CPanel上.我确定脚本已执行,因为出现了最后的打印输出,但是我的csv文件却没有.我已经将文件夹Log_report的权限更改为755,但是仍然无法创建文件,如何进行更改?我确信用于创建csv的mysql脚本是正确的,因为我在XAMPP本地计算机中使用了相同的脚本,并且之前在我的计算机中成功创建了文件.

I have the following function in my php file, and my script is putting on CPanel. I am sure the script has been executed, as the last print out has appeared, however my csv file does not. I have changed the permission of folder Log_report to 755, but still file cannot be created, how can I make change? I am sure the mysql script to create csv is correct, as I used the same script in my XAMPP local machine and successfully created a file in my machine before.

function export($DB){
    $dbConnection = mysql_connect($DB['server'], $DB['loginName'], $DB['password']);
    if(!$dbConnection){
        die('Error! ' . mysql_error());
        }
    mysql_select_db($DB['database'], $dbConnection);
    $timezone = "Asia/Hong_Kong";
    if(function_exists('date_default_timezone_set')) 
        date_default_timezone_set($timezone);
    $Time = date('Y_m_d_H_i');
    $fileName = "/home/me/public_html/Log_Report/Report_".$Time.".csv";
    $result = mysql_query("SELECT TechName, ClientName, SiteName, LogTime, Type 
                            INTO OUTFILE '".$fileName."' 
                            FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED by '\"' 
                            LINES TERMINATED BY '\n' 
                            FROM tech AS T, client AS C, site AS S, log AS L 
                            WHERE T.TechID=L.TechID AND C.ClientID=L.ClientID AND S.SiteID=L.SiteID 
                            ORDER BY L.LogTime DESC");
    print "abcde";
}

推荐答案

该线程应有助于解释mysql权限问题:

This thread should be helpful in explaining the mysql permission issue:

http://lists.mysql.com/mysql/206422

我还应该问您正在运行查询的哪个mysql用户帐户,例如root或另一个可能受限的用户?

Also I should have asked what mysql user account you were running the query, as in root or another possibly limited user?

这篇关于CPanel不允许使用脚本创建文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆