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

  • Home
  • SEARCH
  • 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 6655957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:35:04+00:00 2026-05-26T01:35:04+00:00

I have copied PHP files developed in windows to ubuntu, but when I want

  • 0

I have copied PHP files developed in windows to ubuntu, but when I want to browse these files on ubuntu, they don’t excute anything. why ?

edit

No error message, I open them in the browser but it seems that if they don’t have any code. for instance, if a file has the code <?php echo "hello"; ?> this file don’t do anything.

If I create a new file it works fine, but when I copy a similar file, it doesn’t do anything .

  • 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-05-26T01:35:04+00:00Added an answer on May 26, 2026 at 1:35 am

    In order for a php file to run automatically under Unix/Linux, it needs two things:

    1. the file must be executable
    2. the file must have a valid ‘hashbang’ line as the first line in the file.

    Files that you transfer from windows to Linux probably won’t have the correct permissions, and they almost certainly won’t have the correct hashbang line. Use ‘ls -l’ and chmod to view and change the permissions (I’ll leave this as an exercise to the reader).

    The hashbang line for php will looks like this on my Ubuntu box:

    #!/usr/bin/php
    

    So your example would actually look like this:

    #!/usr/bin/php
    <?php echo "hello"; ?>
    

    The actual path can be found using

    command -v php
    

    There is a subtle issue about the hashbang line that you do have to take in to account when transferring files from windows to unix, and it is in fact what skyline mentioned: Windows uses the ‘\r\n’ line feed combination, unix uses only ‘\n’. This means that the hashbang line from a file that was edited on a windows box will actually look like this:

    #!/usr/bin/php\r
    

    You won’t see the ‘\r’ character (it’s a carriage return after all), but the operating system will try to execute ‘php\r’ rather than ‘php’… so yes, you do have to use dos2unix or frdos to remove the carriage returns from the file.

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

Sidebar

Related Questions

How to copy PHP files from windows to ubuntu without causing problems ?(because of
We have a custom PHP/MySQL web application that gets updated and copied (using SFTP)
I have copied some files from project A to project B, both of which
I have three arrays and I have copied all these arrays into a single
I have the problem that when I try to copy some files from php
I have downloaded WebTechNick's PayPal plugin and copied the files into /app/plugins/paypal_ipn (exactly as
I have copied the files and database from BradPPresents.com to BradP.com . The .htaccess
I have two directories with hundreds of PHP files in each. The second directory
I have this PHP code to copy files from one directory to another and
I have copied class from net which inherits UIImageView. How to put that class

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.