Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8503701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:49:38+00:00 2026-06-11T01:49:38+00:00

I have a file located in my CakePHP root folder placed under a folder

  • 0

I have a file located in my CakePHP root folder placed under a folder named cron. Path is:

c:/wamp/www/project/cron/daily.php

This file requires another file placed inside vendor folder of cake structure, like this:

require("/../vendors/phpMailer/class.phpmailer.php");

And i run this daily.php from task scheduler. This is the scenario in my development site.(Windows system). It works fine as expected. When i migrated the project to Ubuntu(production site), the require statement started causing issues; it cant find the required file. I made a small change there, like this:

require("../vendors/phpMailer/class.phpmailer.php"); <= removed the preceding slash

And it worked. So my doubt is, is there a difference in how parent directory notation work in widows and Linux? If so, how can i overcome this? Its not feasible to remove a slash every time I move the project from my development site(windows) to production site (Linux).


I tried this:

 require("./../vendors/phpMailer/class.phpmailer.php");

It worked in linux. But gave “no such file directory” error in windows. It seems windows works only with:

 require("/../vendors/phpMailer/class.phpmailer.php");

Solution

From @TWCrap’s help problem was solved as follows:

require(dirname(__FILE__)."/../vendors/phpMailer/class.phpmailer.php");

It works in both windows and linux(* tears of joy *). But in windows it produces path as:

C:\wamp\www\project\cron/../vendors/phpMailer/class.phpmailer.php

This path looks ugly and i hope it wont cause probs in future!

-Thanks guys!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T01:49:40+00:00Added an answer on June 11, 2026 at 1:49 am

    AS i remember, when you put 1 dot infront of the line, you start at the directory you are. So then the line must look like this:

    require("./../vendors/phpMailer/class.phpmailer.php");
    

    And that should work at windows and linux….

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background I have a PDF file located (under my Project) in an Assets >
I have a PHP file located in a folder (www.mysite.com/folder/test.php) which accepts a get
I have created following rule in the .htaccess file located at the root of
I have a relative path $base_path = input/myMock.TGZ; myMock.TGZ is the file name located
I have this .htaccess file in WordPress. It's located at /public_html/ (web root). I
I have this rule in an .htaccess file located in a directory named clips/
Lets say we have the following file and [folder] structure in a project with
I have an enum file located on src/java in a Grails project. This enum
I have an XML file located in the assets folder. The XML file is
I have a file located at [application]/config/routing.yml, when I change something in there, the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.