cancel
Showing results for 
Search instead for 
Did you mean: 

Why can't I browse to files uploaded via FTP to magento/pub

Why can't I browse to files uploaded via FTP to magento/pub

We use shiprush (desktop version) for our shipping labels.  I'm supposed to upload 4 .PHP files to the root of my Magento install.  I have placed them in my magento/pub directory, which is my root.  My connection from my site to shiprush cannot be established.  Their tech support tried to browse to the PHP files and they come up as 404 page not found.  Do I need to run any commands after uploading the files?  I had the same issue when I first uploaded a .pdf document to the same location but it finally was able to be found in the browser.  I'm not sure what "fixed" the pdf because I had moved on to other things (installing extensions/modules, updating my CSS files, etc) so during that time had run a lot of the commands so I'm not sure which one did it, if any.

Thanks.

4 REPLIES 4

Re: Why can't I browse to files uploaded via FTP to magento/pub

Having php scripts in root is not a proper way of doing this with Magento. 

 

That being said, if you really insist on this implementation, it's your server (apache/nginx/whatever you're using) that's preventing you from accessing php files other than specific ones like index.php in that root. You'll need to update that on your specific server.

Founder at https://agency418.com

Re: Why can't I browse to files uploaded via FTP to magento/pub

@keystoneke3419 

 

Hey,

 

Can you check the file permission it should be 777 and also which server you used ? if support available from server side than ask them to just whitelisted the new uploaded files so these files can easily accessible via front.

Thank You!

Problem solved? Click Kudos and "Accept as Solution".
200+ Magento 2 Extensions for Enhanced Shopping Experience.

Re: Why can't I browse to files uploaded via FTP to magento/pub

Thanks for your replies.  The solution was that my host had to change how ngnix read the PHP files in the /pub folder.

Re: Why can't I browse to files uploaded via FTP to magento/pub

Files uploaded via FTP to Magento's pub directory won't be directly accessible through a web browser for security reasons. Magento uses a mechanism called "static file serving" to deliver these public files securely.

Here's why you're encountering 404 errors and how to resolve it:

  1. File Permissions: Double-check that the uploaded PHP files have the correct permissions on the server. They should be readable by the web server user (usually "apache" or "www-data"). Many FTP clients allow setting permissions during upload.

  2. Deployment Process: Magento relies on a deployment process to generate cache files that reference the uploaded files in the pub directory. This process can vary depending on your hosting setup. Here are some common methods: you can check here

    • Command Line: If you have SSH access, you can run php bin/magento setup:static-content:deploy This command will regenerate the cache files for static content.

    • Magento Admin Panel: Some Magento configurations allow deploying static content through the admin panel. Navigate to Stores > Settings > Configuration > Catalog > Front-End and look for options related to "Deploy Static Files".

Additional Considerations:

  • File Type: While Magento can technically handle PHP files in the pub directory, it's generally not recommended for security reasons. Shiprush might have a different integration method. Double-check their documentation for the correct way to integrate their software with Magento.

  • Module Integration: It's possible that Shiprush requires a dedicated module for Magento integration. This module might have specific installation instructions that involve uploading files and running deployment commands. Refer to Shiprush's documentation for details.

Here are some resources you can learn more about Magento's static file serving and deployment process:

By following these steps and checking the resources, you should be able to resolve the 404 errors and ensure Shiprush can locate the necessary files.