Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
名称image.php.jpg中带有.php的文件名出现问题_Php_Linux_.htaccess - Fatal编程技术网

名称image.php.jpg中带有.php的文件名出现问题

名称image.php.jpg中带有.php的文件名出现问题,php,linux,.htaccess,Php,Linux,.htaccess,刚刚将一个站点从运行IIS的Windows服务器移动到运行Apache的Linux服务器,有一些图像标题为image.php.jpg(它们是图像) 访问它们时,我会遇到以下错误: A file permissions error has occurred. Please check the permissions on the script and the directory it is in and try again. 通过阅读,我需要在.htaccess文件中添加一些内容,因为它不是Wi

刚刚将一个站点从运行IIS的Windows服务器移动到运行Apache的Linux服务器,有一些图像标题为image.php.jpg(它们是图像)

访问它们时,我会遇到以下错误:

A file permissions error has occurred. Please check the permissions on the script and the directory it is in and try again.
通过阅读,我需要在.htaccess文件中添加一些内容,因为它不是Windows服务器上的一个站点

请有人指出我需要在.htaccess文件中添加什么,以避免服务器将文件名中的.php作为.php页面处理“任何东西”


提前感谢。

文件夹和图像文件需要具有apache用户的“读取”权限

如果您可以访问操作系统上的shell,请尝试以下操作:

chmod 755 <folder name>
这将授予所有用户读取文件和更改文件的权限

如果您没有访问系统外壳程序的权限,请尝试使用FTP客户端授予这些权限…

这有效:

<FilesMatch \.jpg$>
SetHandler image/jpg
</FilesMatch> 

SetHandler图像/jpg

一个例子,说明如果文件名中没有表示文件扩展名,为什么在文件名中加点是个坏主意。@wumm-不,不是。
。htaccess
是Apache的东西,不是UNIX的东西,你可以在Windows服务器上使用。@Quentin,谢谢,我已经编辑了这篇文章,以正确指示它正在运行的服务器和Web服务器。Apache不应该将此文件作为PHP脚本处理,因为它以.jpg而不是.PHP结尾,您确定这是问题所在吗?您可以验证apache用户是否可以读取这些图像文件吗?嗨,Sergio,我可以确认文件夹是755,单个文件是644,但它仍然不起作用。
<FilesMatch \.jpg$>
SetHandler image/jpg
</FilesMatch>