Hosting problem

Hellow Good day! i seem to have encountered a problem in making my system to the web hosting. Before i deployed my system to the webhosting infinityfree (i’m a sutdent) my css/ links/ routes are all working fine. after i put all my files in there and open the site. all my css are working. then when i click login i get an error “Missing Helper” and want’s me to create urlHelper.php i the src/view/helper. after i created it i get too many warnings in my system but it will now redirect me to the login and i can login fine and do the main functionalities in my system add/edit/delete/view. here is an example of the warning when i made the urlHelper.php

[Warning (512) ](javascript:void(0);): Method App\View\Helper\urlHelper::image does not exist [in /home/vol1_7/infinityfree.com/if0_35085963/htdocs/vendor/cakephp/cakephp/src/View/Helper.php, line 103]

This is my first time using framework like cakephp and also my first time uploading it to web hosting using this framework. I’d be glad if someone can help me in this. Thank you!

Did you develop this on a Windows system, and now you’re deploying to a Linux host? There is no thing called “urlHelper”, it’s “UrlHelper”. Windows won’t differentiate between the two because it’s a case insensitive file system, but Linux definitely sees them as two different things.

yes you are correct im using windows for my development. should i use UrlHelper in folder? and change the class urlHelper extends Helper to UrlHelper? also should i change my codes

  • url->build(['controller'=>'Users', 'action'=>'login']);?>>Login
  • to

  • <a class=“getstarted scrollto” href=<?= $this->Url->build(['controller'=>'Users', 'action'=>'login']);?>>Login
  • ???
    thank you so much for giving time to comment on my problem. your advice would be a great help for me.

    my code is working properly before i go to hosting.
    i haven’t done any custom helpers also but I’m getting this error. i would be so glad if you can teach me where i did wrong.

    Update i have made them display without making another Urlhelper.php with this code

    <?php $this->Url->build('/posts', ['fullBase' => true]); ?> from the cakebook helper

    then when i get an email i just get this.

    my email shouldn’t be those. but with just a link instead like before i use hosting.

    i would be so thankful if someone can help me with this

    According to what it’s telling you in the error message, you’ve used a colon-prefixed route placeholder. If you’re not sure what that means, the output of bin/cake routes might help.

    hellow thank you for having time to reply to my post. here is my code to my forgot password as to what you said i was using colon-prefixed route.

    //Forgot Password function
    public function forgotPassword()
    {

            $this->Authorization->skipAuthorization();
    
            if ($this->request->is('post')) {
                $user = $this->Users->findByEmail($this->request->getData('email'))->first();
    
                if ($user) {
                    // Generate a unique token
                    $token = bin2hex(random_bytes(32));
                    $user->password_reset_token = $token;
                    $user->password_reset_expires = FrozenTime::now()->addHours(1);
    
                    if ($this->Users->save($user)) {
                        // Send the reset email
                        $mailer = new Mailer('default');
                        $mailer->setTo($user->email)
                            ->setSubject('Password Reset')
                            ->setViewVars(['token' => $token])
                            ->viewBuilder()
                                ->setTemplate('forgot_password')
                                ->setLayout('default'); // You can specify a layout if needed
                            
                        $mailer->setEmailFormat('both');
                        $mailer->deliver();
                      echo $this->Flash->success('An email with instructions to reset your password has been sent.');
                    } else {
                        $this->Flash->error('Could not save token.');
                    }
                } else {
                    $this->Flash->error('No user found with that email address.');
                }
            }
        }
    

    also is it possible to run the command bin/cake routes in an hosting environment already?

    It’s not in that code. Maybe your forgot_password template?

    You should be able to run bin/cake routes anywhere that you have shell access. Not all hosting environments provide that, but all good ones do. :slight_smile:

    Thank you for the help i manage to solve the error in my code.