简体   繁体   English

WordPress的-我可以通过URL到达正常的PHP文件,但没有上传的

[英]Wordpress - I can reach by url normal php files but no uploaded ones

I'm working on a Wordpress project, and I'm trying to create a product via woocommerce rest API, I made it work in local, but when I upload the files to the server, I just can't reach via URL my file, for example, If I write: 我正在开发一个Wordpress项目,并且正在尝试通过woocommerce rest API创建产品,我使其在本地工作,但是当我将文件上传到服务器时,我只是无法通过URL到达文件,例如,如果我写:

    $.get('http://example.com/wp-includes/option.php')
    .done(function() {
        alert('Correct');
    }).fail(function() {
        alert('Nope');
})

An alert with Correct appears, but, if I write: 出现带有正确的警报,但是,如果我这样写:

    $.get('http://example.com/wp-includes/createProduct.php')
    .done(function() {
        alert('Correct');
    }).fail(function() {
        alert('Nope');
})

An alert with Nope will be shown, so I don't get why it reaches all its 'native' files and not that one I uploaded. 将会显示“ Nope”警报,因此我不知道为什么它到达了所有“本地”文件,而不是我上传的那个文件。 Files like .js in the js folder are being read correctly, but this .php just can't be reached. 可以正确读取js文件夹中的.js之类的文件,但无法访问此.php。 And I need it for an AJAX :c 我需要它来进行AJAX:c

Hope someone can help me and thanks. 希望有人能帮助我,谢谢。

Check your directory/file permissions. 检查您的目录/文件权限。

On linux try running ll -h inside the wp-includes directory to compare the user and read/write permissions of the files being created. 在Linux上,请尝试在wp-includes目录中运行ll -h来比较用户和正在创建的文件的读/写权限。

For instance, you may be user ubuntu, ec2-user, something like that, but your files are being created and owned by root. 例如,您可能是ubuntu,ec2-user等用户,但是您的文件是由root创建和拥有的。

EDIT: 编辑:

Upload your files through cpanel's file manager. 通过cpanel的文件管理器上传文件。

Whether I upload the file using winscp or cpanel file manager, it doesn't affect the read/write permissions, it's always 0644, which should work. 无论我使用winscp还是cpanel文件管理器上传文件,它都不会影响读/写权限,它始终是0644,应该可以使用。 BUT uploading through cpanel's file manager, the ownership for the file is the same where as using winscp to upload the user is different. 但是通过cpanel的文件管理器进行上传时,文件的所有权与使用winscp来上传用户的所有权相同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 ckfinder 上选择时,如何将域 url 添加到上传文件的 url - How can i add domain url to the url of uploaded files when selected on ckfinder 如何在WordPress中添加.php和.js文件? - How can I add .php and .js files in WordPress? 干净的方法将URL中的所有“&#..”字符替换为普通字符 - Clean way to replace all “&#..” characters to normal ones in URL 在哪里可以找到“流星文件”中的上载文件? - Where can I get the uploaded file in Meteor Files? 如何从请求中获取上传的文件? - How can I get the uploaded files from the request? 在WordPress中编码上传的mp3文件 - Encode uploaded mp3 files in WordPress 在开发过程中,chrome devtools可以使用本地文件而不是网络文件。 - Can chrome devtools use local files instead of the network ones while I am developing. 使用 google 文件列表如何只显示我拥有的文件夹而不是共享文件夹? - with google files list how can I only show my owned folder instead of shared ones? 我如何在php中存储访问者信息,例如到达时间,访问时间和访问者的确切位置 - How can i store visitor infomation like reach time ,duration of visit,and exact location of visitor in php TypeScript的介入方式:我可以仅将Typescript与定义文件(和普通js文件)一起使用吗? - TypeScript the unintrusive way: Can I use typescript with definition files only (and normal js files)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM