Hello,
I have installed Magento2 and it installed witout any issues. But when I access my website and admin site, it's not loading CSS and JSS.
I have gone through with the forum and found found that I need to run
bin/magento setup:static-content:deploy
But I have installed it on shared server and I do not have Shell/SSH Access.
Now how can I run this command in cPanel? can I use cron to do this? If Yes how?
Thanks,
Raghavendra
You can ask your cPanel (Hosting) Provider to give yave Shell/SSH Access, because its needed to run commands.
if you run this command using cron as of now that might work , but every time when you change something from backend of Magento you also needs to run few commands like reindex , cache:clean and cache:flush etc.
so its quite difficult to manage all the commands run using cron. So better option would be ask your hosting provider to give you Shell/SSH access to run the commands.
I agree with @Manthan Dave that you will need SSH Access to run Magento 2 properly.
You can use a cron to run it and then remove the cron but it will make your life very difficult.
Thanks @Manthan Dave & @JLHC for your reply.
for temporary I want to use cron command to run statis:deploy command, so that my website should start running.
So can you please guide me what is cron command for it.
Meanwhile I will try to get Shell/SSH access from my hosting provider.
Thanks,
Raghavendra
Even though you would like to run command with cron , you still needed SSH/Shell access to add the values into crontab.
if you go with custom module for crontab you still required SSH/Shell access to run command php bin/magento setup:upgrade to install that module.
so wait for until you get SSH/Shell access , because its must required.
Create a one custom.php file in root and write below code to file.
<?php
$command = 'php bin/magento setup:upgrade';
echo '<pre>' . shell_exec($command) . '</pre>';
$command = 'php bin/magento setup:static-content:deploy -f';
echo '<pre>' . shell_exec($command) . '</pre>';
?>
Run custom.php file by http://yourbaseurl/custom.php
It will resolve you Css and Js loading issue.
if issue solved,Click "Kudos" or "Accept as Solution"