Jump to content

[eclipse] open php file without extension


Recommended Posts

Without a file extension, your system has to guess what type of file it is based on the data. Apparently, it guessed "map-path". And your PHP Editor doesn't know what to do with "map-path" files.

Give your PHP files the .php extension. It's what you're supposed to do.

Link to comment
Share on other sites

19 hours ago, requinix said:

You're saying that you don't believe programmers should be using file extensions?

Programmers yes.
End users don't: they should have as simple an interface as possible, which hides unnecessary details.

16 hours ago, Strider64 said:

They don't have to if you design and develop the website correct.

websiite?

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

Strider is probably on the right subject.

URLs don't have to match files. You can have a file named "whatever.php" and show it in a URL as "whatever" - or anything else you want.
So keep the file extension, and if you want your URLs to look a certain way then make the URLs look the certain way.

Link to comment
Share on other sites

Making a file without an extension work with any sort of serverside language, requires configuration to associate those files with the serverside language.  The same sort of association can be made in an editor, but as previously commented, using the rewrite capability in apache mod_rewrite or nginx is the best practice. 

Link to comment
Share on other sites

17 hours ago, requinix said:

Strider is probably on the right subject.

URLs don't have to match files. You can have a file named "whatever.php" and show it in a URL as "whatever" - or anything else you want.
So keep the file extension, and if you want your URLs to look a certain way then make the URLs look the certain way.

...

16 hours ago, gizmola said:

Making a file without an extension work with any sort of serverside language, requires configuration to associate those files with the serverside language.  The same sort of association can be made in an editor, but as previously commented, using the rewrite capability in apache mod_rewrite or nginx is the best practice. 

...

You are taking for granted that he is writing a web app.
I thought you knew that, with php, can be write both web apps and cli apps :(

Link to comment
Share on other sites

1 hour ago, rick645 said:

You are taking for granted that he is writing a web app.

Taking for granted who is writing a web app? Is it someone other than the person who started this thread?

 

1 hour ago, rick645 said:

I thought you knew that, with php, can be write both web apps and cli apps :(

What? Really? PHP can do other things than serve websites? I had no idea!

🙄

So if this isn't for a website then would you kindly explain what this is all about?

Link to comment
Share on other sites

tmp.FdTgUEMZjh$ cat rsync-map-path
#!/bin/bash
rsync -n "$1" "$(./map-path "$1")"

tmp.FdTgUEMZjh$ cat map-path
#!/usr/bin/php
<?php
$paths = [
    'bin' => "remote:/bin",
    'lib' => "remote:/lib",
    'config' => "remote:/etc",
    'config2' => "remote:/config",
    //...
];
echo $paths[$argv[1]];

tmp.FdTgUEMZjh$ ./rsync-map-path lib
RSYNC OUTPUT...

 

Link to comment
Share on other sites

35 minutes ago, rick645 said:
tmp.FdTgUEMZjh$ cat rsync-map-path
#!/bin/bash
rsync -n "$1" "$(./map-path "$1")"

tmp.FdTgUEMZjh$ cat map-path
#!/usr/bin/php
<?php
$paths = [
    'bin' => "remote:/bin",
    'lib' => "remote:/lib",
    'config' => "remote:/etc",
    'config2' => "remote:/config",
    //...
];
echo $paths[$argv[1]];

tmp.FdTgUEMZjh$ ./rsync-map-path lib
RSYNC OUTPUT...

 

RSYNC OUTPUT...

rsync -n ... it shouldn't produce output, I apologize

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.