将创建新的php.ini将覆盖原始文件

时间:2013-02-07 05:13:16

标签: .htaccess php

我有一个 linux 服务器。我无法从我的应用程序上传图像。我检查了 phpinfo(),因为我发现 upload_tmp_dir 被分配了无值。我觉得这就是问题的原因。

我尝试编辑 .htaccess ,但有人说这并不总是一个好方法。所以我尝试在我的服务器上搜索 php.ini 文件。令人惊讶的是我找到了它。

所以,如果我在根文件夹中创建一个新的php.ini文件,这会影响我的服务器吗?

我只是担心如果所有的php.ini覆盖我肯定会遇到大问题

我可以继续在我的新php.ini文件中添加此代码吗?

; Whether to allow HTTP file uploads.
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
;upload_tmp_dir = www/temp/uploads/

更新

它抛出这些警告

PHP Warning:  move_uploaded_file(xml/xm.jpg.asp) [<a href='function.move-uploaded-file'>function.move-uploaded-file</a>]: failed to open stream: No such file or directory in /home/appsimon/public_html/api/update_xml.php on line 31
     PHP Warning:  move_uploaded_file() [<a href='function.move-uploaded-file'>function.move-uploaded-file</a>]: Unable to move '/tmp/phpLP5q96' to 'xml/xm.jpg.asp' in /home/appsimon/public_html/api/update_xml.php on line 31
     PHP Warning:  fopen(xml/xm.jpg.asp) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory in /home/appsimon/public_html/api/update_xml.php on line 33
     PHP Warning:  file_get_contents(xml/xm.jpg.asp) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: No such file or directory in /home/appsimon/public_html/api/update_xml.php on line 35

2 个答案:

答案 0 :(得分:0)

您的问题与 .htaccess 文件无关。 .htaccess基本上由Apache处理,但PHP编译器使用 php.ini ,实际上是Apache模块。

如果您没有 php.ini ,可能是您的PHP安装出了问题。只需获取默认 php.ini 并将其放在 php.exe 旁边。

您还可以在 php.ini 中覆盖您在Web服务器根目录中而不是Linux根目录中所需的功能。

答案 1 :(得分:0)

通常,它会覆盖服务器上的 php.ini 。您只能在新的 php.ini 中指定一些值。只有指定的值才会被覆盖。

您还可以使用 PHP 覆盖某些 php.ini 值(仅当您的托管服务提供商允许此值时。)