[英]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.