Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

SpidaWeb's avatar

Some Laravel Codes/Function/Method are not working in cPanel

I am new to web development and I have built a web application using Laravel. I am currently trying to deploy the project using Starter GoDaddy cPanel and using the primary domain. I have uploaded the project files inside /public_html. Initially, it returned a "403 Forbidden" error, but I found a solution by creating a new .htaccess file in the root (public_html). The code simply redirects requests to the public folder (public_html/public) and it worked fine. The CSS and scripts are working well, but I noticed that some scripts and parts of a controller function/method are not working. Specifically, there are JavaScript codes that auto-check a checkbox, and the controller method that sends an email using SMTP is not working in cPanel.

Regarding the email sending feature, my application can send mail twice every transaction, and the first one is sent successfully while the other one will not send, although it returns a success message. I have checked the error log and my Gmail SMTP credentials, but to no avail. I suspect that the way I uploaded the project could be the issue. I have read that storing your project in public_html is less secure even with redirection (.htaccess). I have also checked the PHP versions, modules, and extensions of both the cPanel server and my Laravel project.

I have spent a week looking for a solution online, but I have not found one yet. Do you have any ideas on how I can resolve these issues?

0 likes
5 replies
jlrdw's avatar

If you are correctly pointing to public as the document root all should work.

Do you have some HTTP instead of https links?

SpidaWeb's avatar

@jlrdw I'm not really sure what do you mean. However, I have installed temporary SSL certificate for three month use. My website can be accessed with both http:// or https://.

SpidaWeb's avatar

@Snapey It's not clear to me how to do the second step. Would it be possible for you to kindly provide me with a direct guide, specifically for cPanel? Thanks in advance.

Please or to participate in this conversation.