|
Re: using scripting languages to automate a browser [message #180399 is a reply to message #180398] |
Sun, 10 February 2013 04:03 |
M. Strobel
Messages: 386 Registered: December 2011
Karma: 0
|
Senior Member |
add to buddy list ignore all messages by this user
|
|
Am 10.02.2013 09:04, schrieb Cal Dershowitz:
> Hello newsgroup,
>
> I've been trying to use perl to automate processes that aren't much more than a few
> GUI events that a person would do if he had a browser.
>
> #!/usr/bin/perl -w
> use strict;
> use autodie;
> use utf8;
> use WWW::Mechanize;
>
> my $url = 'http://translate.google.com/';
--cut--
> print "URI\n";
> print $_->URI()."\n" foreach @links;
> print "text\n";
> print $_->text()."\n" foreach @links;
> print "forms\n";
> my @forms = $mech->forms();
> # print $_->text()."\n" foreach @forms;
> $mech->current_form()
>
> With the amount of difficulty that this has presented itself to be, I've started to
> wonder whether I'm not using a wrench to pound a nail. What I'm trying to do in this
> instance is to click a button to turn the language, enter the text that I would have
> in a file, click translate, and capture the output.
>
> Is this something that php can do in a way that involves less grief?
>
> Thanks for your comment, and cheers.
In PHP you would have to issue more or less the same commands/use the same functions.
I think the approach is wrong. Most probably there is a way to encode the whole query
in the url, or there is a API/Service that does what you want.
If the API does not exist, or is too expensive, you could either just provide the
translation link, or you must go through all the "grief", and again when the layout
changes.
/Str.
|
|
|
|
|
Re: getting a php capability on ubuntu was Re: using scripting languages to automate a browser [message #180404 is a reply to message #180402] |
Mon, 11 February 2013 06:39 |
M. Strobel
Messages: 386 Registered: December 2011
Karma: 0
|
Senior Member |
add to buddy list ignore all messages by this user
|
|
Am 11.02.2013 03:58, schrieb Cal Dershowitz:
> On 02/10/2013 02:49 AM, Arno Welzel wrote:
>> Cal Dershowitz, 2013-02-10 09:04:
>
> [x-posted to alt.os.linux.ubuntu]
>
>
>>> I've been trying to use perl to automate processes that aren't much more
>>> than a few GUI events that a person would do if he had a browser.
>>>
>>> #!/usr/bin/perl -w
>>> use strict;
>>> use autodie;
>>> use utf8;
>>> use WWW::Mechanize;
>>>
>>> my $url = 'http://translate.google.com/';
>>> my $mech = WWW::Mechanize->new;
>>> my $result = $mech->get($url);
>>> die "GET failedn" unless $result->is_success;
>> [...]
>>
>>> Is this something that php can do in a way that involves less grief?
>>
>> I don't think so.
>>
>> But if you need to use Google Translate as a service, see here:
>>
>> <https://developers.google.com/translate/>
>>
>> Well - the service is not for free. Therefore i doubt that using
>> <http://translate.google.com/> as a "service" through scripts is legal.
>>
>>
>
> Thanks for your comments, Arno, I'm just trying to get used to websites from the
> point-of-view of machines. I don't want this as a "service" that I would put on my
> guinea pig 1and1 website. With all the reading I did, I do want to use php on my
> website now.
>
> I think we're all in agreement that php is the wrong tool for what I wanted to do,
> but I've always wanted to have more-sophisticated content on my own site, in
> particular the ability to host video.
>
> The tutorial I looked at wants me to install XAMPP. Is that the best idea for
> getting a php development environment squared away given that this
>
> $ uname -a
> Linux fred-desktop 3.2.0-33-generic-pae #52-Ubuntu SMP Thu Oct 18 16:39:21 UTC 2012
> i686 athlon i386 GNU/Linux
>
> is my platform? As I look through synaptic for packages that match php, there might
> be 2 hundred.
>
> Before I went ahead and fiddled with it, I thought I'd ask to see if someone has been
> around the block on this once, which is one more than me right now.
Linux/Unix is the native platform for PHP development. Get a decent IDE with syntax
checking, set all encodings to utf-8, start your local web server and there you go.
/Str.
|
|
|
|
|
Re: getting a php capability on ubuntu was Re: using scripting languages to automate a browser [message #180407 is a reply to message #180406] |
Mon, 11 February 2013 11:23 |
M. Strobel
Messages: 386 Registered: December 2011
Karma: 0
|
Senior Member |
add to buddy list ignore all messages by this user
|
|
Am 11.02.2013 15:29, schrieb Jerry Stuckle:
> On 2/11/2013 6:39 AM, M. Strobel wrote:
>> Am 11.02.2013 03:58, schrieb Cal Dershowitz:
>>> On 02/10/2013 02:49 AM, Arno Welzel wrote:
--
>>> The tutorial I looked at wants me to install XAMPP. Is that the best idea for
>>> getting a php development environment squared away given that this
>>>
>>> $ uname -a
>>> Linux fred-desktop 3.2.0-33-generic-pae #52-Ubuntu SMP Thu Oct 18 16:39:21 UTC 2012
>>> i686 athlon i386 GNU/Linux
>>>
>>> is my platform? As I look through synaptic for packages that match php, there might
>>> be 2 hundred.
>>>
>>> Before I went ahead and fiddled with it, I thought I'd ask to see if someone has been
>>> around the block on this once, which is one more than me right now.
>>
>> Linux/Unix is the native platform for PHP development. Get a decent IDE with syntax
>> checking, set all encodings to utf-8, start your local web server and there you go.
>>
>> /Str.
>>
>
> Incorrect. Linux is not the "native platform for PHP development". It is ONE
> platform for PHP development. PHP runs fine on Windows, also. And there are good
> IDE's on Windows, also.
>
Unix/Linux is the native platform for web development, because the first web server
was on *nix, and it is still the primary platform (http://news.netcraft.com/).
/Str.
|
|
|
|
|
Re: getting a php capability on ubuntu was Re: using scripting languages to automate a browser [message #180411 is a reply to message #180408] |
Mon, 11 February 2013 16:29 |
M. Strobel
Messages: 386 Registered: December 2011
Karma: 0
|
Senior Member |
add to buddy list ignore all messages by this user
|
|
Am 11.02.2013 20:13, schrieb Jerry Stuckle:
> On 2/11/2013 11:23 AM, M. Strobel wrote:
>> Am 11.02.2013 15:29, schrieb Jerry Stuckle:
>>>
>>> Incorrect. Linux is not the "native platform for PHP development". It is ONE
>>> platform for PHP development. PHP runs fine on Windows, also. And there are good
>>> IDE's on Windows, also.
>>>
>>
>> Unix/Linux is the native platform for web development, because the first web server
>> was on *nix, and it is still the primary platform (http://news.netcraft.com/).
>>
>> /Str.
>>
>
> It doesn't matter if the first web server was on *nix, nor that it is still the
> primary platform for web development. Linux is *not* the "native platform for PHP
> development".
>
> In fact, I would almost bet there is more PHP *development* done on Windows, even
> though *deployment* is done on *nix. Windows is, after all, the predominant system
> on the desktop (where most development is done).
yes, for the desktop, but not where most development is done.
Maybe I confound it with the question which desktop is best for *nix development, but
it just does not make sense develop for *nix on a MS Win desktop. You do not even
have a decent shell. MinGW and Cygwin are not THE REAL THING.
BTW I am not a MS hater, I had a Technet subscription with all MS operating systems
when I gave courses in MS Networking / Active Directory.
/Str.
|
|
|
Re: getting a php capability on ubuntu was Re: using scripting languages to automate a browser [message #180412 is a reply to message #180410] |
Mon, 11 February 2013 16:32 |
M. Strobel
Messages: 386 Registered: December 2011
Karma: 0
|
Senior Member |
add to buddy list ignore all messages by this user
|
|
Am 11.02.2013 21:20, schrieb Cal Dershowitz:
> On 02/11/2013 06:40 AM, Warren Post wrote:
>> On 02/10/2013 08:58 PM, Cal Dershowitz wrote:
>>> The tutorial I looked at wants me to install XAMPP. Is that the best
>>> idea for getting a php development environment squared away given that
>>> this
>>>
>>> $ uname -a
>>> Linux fred-desktop 3.2.0-33-generic-pae #52-Ubuntu SMP Thu Oct 18
>>> 16:39:21 UTC 2012 i686 athlon i386 GNU/Linux
>>>
>>> is my platform?
>>
>> I have a strong preference for using my distro's packages when available
>> rather than 3rd party products. In your case, that would be Ubuntu's
>> Apache, either MySQL or MariaDB, and PHP, installed and tested in that
>> order. This combination is called LAMP.
>>
>> I haven't had opportunity to set up a LAMP server on Ubuntu, but perhaps
>> the notes I took when doing it on Mandriva will help you get going:
>>
>> http://my.opera.com/wpost/blog/index.dml/tag/LAMP
>>
>
> Thx all for responses. The tutorial I looked at talked of XAAMP, where I was
> basically-ignorant of what the acronym might mean.
>
> http://my.opera.com/wpost/blog/install-php
>
> So I think I need the AMP part. I guess I'm assuming that the L was for Linux. As I
> look at Apache in the synaptic package manager, I see 200 choices again.
>
> You'd think that someone would have rolled the process togther a bit, as many times
> as it has to have been done.
There are generic packages with a good preselection for apache2, php, and mysql, no
need to go into package details for a starter.
/Str.
|
|
|
|
|
|
Re: getting a php capability on ubuntu was Re: using scripting languages to automate a browser [message #180417 is a reply to message #180415] |
Tue, 12 February 2013 03:38 |
M. Strobel
Messages: 386 Registered: December 2011
Karma: 0
|
Senior Member |
add to buddy list ignore all messages by this user
|
|
Am 12.02.2013 06:23, schrieb Cal Dershowitz:
> On 02/11/2013 02:40 PM, Jerry Stuckle wrote:
>> On 2/11/2013 4:29 PM, M. Strobel wrote:
>>> Am 11.02.2013 20:13, schrieb Jerry Stuckle:
>>>> On 2/11/2013 11:23 AM, M. Strobel wrote:
>>>> > Am 11.02.2013 15:29, schrieb Jerry Stuckle:
>>>> >>
>>>> >> Incorrect. Linux is not the "native platform for PHP
>>>> >> development". It is ONE
>>>> >> platform for PHP development. PHP runs fine on Windows, also. And
>>>> >> there are good
>>>> >> IDE's on Windows, also.
>>>> >>
>>>> >
>>>> > Unix/Linux is the native platform for web development, because the
>>>> > first web server
>>>> > was on *nix, and it is still the primary platform
>>>> > (http://news.netcraft.com/).
>>>> >
>>>> > /Str.
>>>> >
>>>>
>>>> It doesn't matter if the first web server was on *nix, nor that it is
>>>> still the
>>>> primary platform for web development. Linux is *not* the "native
>>>> platform for PHP
>>>> development".
>>>>
>>>> In fact, I would almost bet there is more PHP *development* done on
>>>> Windows, even
>>>> though *deployment* is done on *nix. Windows is, after all, the
>>>> predominant system
>>>> on the desktop (where most development is done).
>>>
>>> yes, for the desktop, but not where most development is done.
>>>
>>> Maybe I confound it with the question which desktop is best for *nix
>>> development, but
>>> it just does not make sense develop for *nix on a MS Win desktop. You
>>> do not even
>>> have a decent shell. MinGW and Cygwin are not THE REAL THING.
>>>
>>> BTW I am not a MS hater, I had a Technet subscription with all MS
>>> operating systems
>>> when I gave courses in MS Networking / Active Directory.
>>> /Str.
>>>
>>>
>>>
>>
>> Most development isn't done on a desktop? Horse Hockey! People don't
>> develop on servers. They may (and should) have development
>> environments, but like most I've seen, those are done on the same
>> desktop they write the code on. Some may have a separate "server", but
>> it generally isn't really a "server" - it's another desktop which
>> happens to be running Apache or something similar.
>>
>> It makes perfect sense to develop PHP scripts on a Windows desktop.
>> There are some great IDEs available for Windows, and unless you need
>> some rather esoteric *nix functions, the code is 100% portable.
>>
>> I do my do my development here on Windows (because I need Windows for
>> other things anyway) with Apache running on this system. Eclipse IDE
>> runs great and I can edit the files right in the local web directory.
>> When they are working like I want them to, I upload them to a test Linux
>> server for final checks. Then over to the live system.
>>
>> I would suggest many people use a similar process (perhaps without the
>> test Linux system - it's really not necessary but I like to be careful).
>>
>>
>
> I'm super happy that you guys are commenting on this thread, but I won't have that
> flame potential not focused on getting my bologna configured.
Flaming looks different, on Usenet. This is just an exchange of point of views.
>
> For the purpose of this thread, OP is developing on ubuntu and is a native american.
> I'm very invested in the tool-chain of linux now, My grandma had to pass herself off
That's it, the tool chain. Some say *nix is a development system by itself.
> as a mexican to marry a chicago cop. Her son, my dad, would never use linux, but made
> extraordinary calculation in then-available syntaxes computing a better house, with,
> for example, solar gains, referenced.
>
> I'm gonna try to get php as a two stepper, and if I fail, I'm coming right back here.
Just install the packages with the most generic names, and you are ready to start.
The thing is, there is more to it than just finding the right PHP functions,
everything works together: network, web server, database, file system,...
Good luck.
/Str.
|
|
|
Re: getting a php capability on ubuntu was Re: using scripting languages to automate a browser [message #180419 is a reply to message #180410] |
Tue, 12 February 2013 05:12 |
|
On Feb 11, 8:20 pm, Cal Dershowitz <c...@example.invalid> wrote:
> On 02/11/2013 06:40 AM, Warren Post wrote:
>
>
>
>
>
>
>
>
>
>> On 02/10/2013 08:58 PM, Cal Dershowitz wrote:
>>> The tutorial I looked at wants me to install XAMPP. Is that the best
>>> idea for getting a php development environment squared away given that
>>> this
>
>>> $ uname -a
>>> Linux fred-desktop 3.2.0-33-generic-pae #52-Ubuntu SMP Thu Oct 18
>>> 16:39:21 UTC 2012 i686 athlon i386 GNU/Linux
>
>>> is my platform?
>
>> I have a strong preference for using my distro's packages when available
>> rather than 3rd party products. In your case, that would be Ubuntu's
>> Apache, either MySQL or MariaDB, and PHP, installed and tested in that
>> order. This combination is called LAMP.
>
>> I haven't had opportunity to set up a LAMP server on Ubuntu, but perhaps
>> the notes I took when doing it on Mandriva will help you get going:
>
>> http://my.opera.com/wpost/blog/index.dml/tag/LAMP
>
> Thx all for responses. The tutorial I looked at talked of XAAMP, where
> I was basically-ignorant of what the acronym might mean.
Ahh well I have a tip to help you here. There's this thing called
Google. If you search for XAAMP, it will helpfully tell you that it
searched instead for XAMPP and on the first page of results, it will
say:
"XAMPP is an integrated server package of Apache, mySQL, PHP and Perl
(the AMPP in XAMPP) that all run from a removable drive."
|
|
|
Re: getting a php capability on ubuntu was Re: using scripting languages to automate a browser [message #180420 is a reply to message #180410] |
Tue, 12 February 2013 08:42 |
Warren Post
Messages: 2 Registered: February 2013
Karma: 0
|
Junior Member |
add to buddy list ignore all messages by this user
|
|
On 02/11/2013 02:20 PM, Cal Dershowitz wrote:
> The tutorial I looked at talked of XAAMP, where I was basically-ignorant
> of what the acronym might mean.
>
> http://my.opera.com/wpost/blog/install-php
>
> So I think I need the AMP part. I guess I'm assuming that the L was for
> Linux.
Correct: Linux, Apache, MySQL, PHP = LAMP. Sorry for not making that
explicit.
> As I look at Apache in the synaptic package manager, I see 200
> choices again.
>
> You'd think that someone would have rolled the process togther a bit, as
> many times as it has to have been done.
Most Linux distros that try to be newbie friendly do, called a
metapackage. I'm not on an Ubuntu box to check what it's called there,
but FWIW on Mageia its called task-lamp.
--
Warren Post
http://my.opera.com/wpost/
|
|
|
Re: getting a php capability on ubuntu was Re: using scripting languages to automate a browser [message #180421 is a reply to message #180411] |
Tue, 12 February 2013 08:50 |
Peter H. Coffin
Messages: 245 Registered: September 2010
Karma: 0
|
Senior Member |
add to buddy list ignore all messages by this user
|
|
On Mon, 11 Feb 2013 22:29:42 +0100, M. Strobel wrote:
> Am 11.02.2013 20:13, schrieb Jerry Stuckle:
>
>> On 2/11/2013 11:23 AM, M. Strobel wrote:
>>
>>> Am 11.02.2013 15:29, schrieb Jerry Stuckle:
>>>
>>>> Incorrect. Linux is not the "native platform for PHP development".
>>>> It is ONE platform for PHP development. PHP runs fine on Windows,
>>>> also. And there are good IDE's on Windows, also.
>>>
>>>
>>> Unix/Linux is the native platform for web development, because the
>>> first web server was on *nix, and it is still the primary platform
>>> (http://news.netcraft.com/).
>>>
>>> /Str.
>>
>>
>> It doesn't matter if the first web server was on *nix, nor that it is
>> still the primary platform for web development. Linux is *not* the
>> "native platform for PHP development".
>>
>> In fact, I would almost bet there is more PHP *development* done on
>> Windows, even though *deployment* is done on *nix. Windows is, after
>> all, the predominant system on the desktop (where most development is
>> done).
>
> yes, for the desktop, but not where most development is done.
>
> Maybe I confound it with the question which desktop is best for *nix
> development, but it just does not make sense develop for *nix on a MS
> Win desktop. You do not even have a decent shell. MinGW and Cygwin are
> not THE REAL THING.
I am not sure how this matters, since 99.9% of development doesn't
even touch a shell, and wouldn't need the facilities of even those
(MinGW/Cygwin) anyway. An IDE works with files, it may compile things,
it probably does some socket stuff connecting to a versioning system
or source repository, but all the capacities of the programs being
developed depend on the capacities of the languages that they're built
in, and all stuff outside that can easily be provided by the IDE itself.
(EG: Who cares if you've got a posix grep utility around if your IDE
would be built with a regexp library bound in anyway?)
--
40. I will be neither chivalrous nor sporting. If I have an unstoppable
superweapon, I will use it as early and as often as possible instead
of keeping it in reserve.
--Peter Anspach's list of things to do as an Evil Overlord
|
|
|
Re: getting a php capability on ubuntu was Re: using scripting languages to automate a browser [message #180422 is a reply to message #180417] |
Tue, 12 February 2013 08:54 |
Peter H. Coffin
Messages: 245 Registered: September 2010
Karma: 0
|
Senior Member |
add to buddy list ignore all messages by this user
|
|
On Tue, 12 Feb 2013 09:38:45 +0100, M. Strobel wrote:
> Am 12.02.2013 06:23, schrieb Cal Dershowitz:
>
>> I'm super happy that you guys are commenting on this thread, but I
>> won't have that flame potential not focused on getting my bologna
>> configured.
>
> Flaming looks different, on Usenet. This is just an exchange of point
> of views.
Flaming on USENET can frequently be noted to involve sexual tastes
and diagnosises of genetic disorders due to too-close parents. We'll
probably get there in time. (:
--
Mares eat oats, and does eat oats, and little lambs eat ivy,
A kid will eat ivy too, wouldn't you?
|
|
|
|
|
|
Re: getting a php capability on ubuntu was Re: using scripting languages to automate a browser [message #180426 is a reply to message #180421] |
Tue, 12 February 2013 09:29 |
M. Strobel
Messages: 386 Registered: December 2011
Karma: 0
|
Senior Member |
add to buddy list ignore all messages by this user
|
|
Am 12.02.2013 14:50, schrieb Peter H. Coffin:
> On Mon, 11 Feb 2013 22:29:42 +0100, M. Strobel wrote:
>
>> Am 11.02.2013 20:13, schrieb Jerry Stuckle:
>>
>>> On 2/11/2013 11:23 AM, M. Strobel wrote:
>>>
>>>> Am 11.02.2013 15:29, schrieb Jerry Stuckle:
>>>>
>>>> > Incorrect. Linux is not the "native platform for PHP development".
>>>> > It is ONE platform for PHP development. PHP runs fine on Windows,
>>>> > also. And there are good IDE's on Windows, also.
>>>>
>>>>
>>>> Unix/Linux is the native platform for web development, because the
>>>> first web server was on *nix, and it is still the primary platform
>>>> (http://news.netcraft.com/).
>>>>
>>>> /Str.
>>>
>>>
>>> It doesn't matter if the first web server was on *nix, nor that it is
>>> still the primary platform for web development. Linux is *not* the
>>> "native platform for PHP development".
>>>
>>> In fact, I would almost bet there is more PHP *development* done on
>>> Windows, even though *deployment* is done on *nix. Windows is, after
>>> all, the predominant system on the desktop (where most development is
>>> done).
>>
>> yes, for the desktop, but not where most development is done.
>>
>> Maybe I confound it with the question which desktop is best for *nix
>> development, but it just does not make sense develop for *nix on a MS
>> Win desktop. You do not even have a decent shell. MinGW and Cygwin are
>> not THE REAL THING.
>
> I am not sure how this matters, since 99.9% of development doesn't
> even touch a shell, and wouldn't need the facilities of even those
> (MinGW/Cygwin) anyway. An IDE works with files, it may compile things,
> it probably does some socket stuff connecting to a versioning system
> or source repository, but all the capacities of the programs being
> developed depend on the capacities of the languages that they're built
> in, and all stuff outside that can easily be provided by the IDE itself.
> (EG: Who cares if you've got a posix grep utility around if your IDE
> would be built with a regexp library bound in anyway?)
>
Then it looks like I am doing something completely wrong.
I have to: write helper scripts, distribute them on my servers into the search path,
version them, pump data out one database piping via ssh to remote servers, automate
remote server setup and management, set up remote versioning repos, testing PHP
snippets because of version differences and fine tuning, test HTML5 features and
javascript in browser versions, write DB consistency checks, ... and yes, brute force
grep through everything for refactoring.
It really helps to work within the same OS family.
/Str.
|
|
|
|
|
|
|
|
Re: getting a php capability on ubuntu was Re: using scripting languages to automate a browser [message #180439 is a reply to message #180432] |
Thu, 14 February 2013 11:15 |
Kim Andr Aker
Messages: 17 Registered: September 2010
Karma: 0
|
Junior Member |
add to buddy list ignore all messages by this user
|
|
På Thu, 14 Feb 2013 07:48:44 +0100, skrev Cal Dershowitz
<cal(at)example(dot)invalid>:
> On 02/13/2013 04:40 PM, The Natural Philosopher wrote:
>> On 13/02/13 04:09, Cal Dershowitz wrote:
>>> On 02/12/2013 07:27 AM, The Natural Philosopher wrote:
>>>
>>>> All here by the looks of it
>>>>
>>>> https://help.ubuntu.com/community/ApacheMySQLPHP
>>>>
>>>>
>>>>
>>>
>>> Thanks all for comments. I got as far in the process as to have a
>>> localhost that shows up in a browser and try to write test.php, and I
>>> don't want to get too far ahead of myself with enabling permissions.
>>>
>>> $ cat > test.php
>>> bash: test.php: Permission denied
>>> $ pwd
>>> /var/www
>>> $ cd ..
>>> $ ls -l
>>> total 48
>>> drwxr-xr-x 2 root root 4096 Feb 1 17:18 backups
>>> drwxr-xr-x 18 root root 4096 Feb 12 20:06 cache
>>> drwxrwsrwt 2 root whoopsie 4096 Dec 13 07:35 crash
>>> drwxr-xr-x 2 root root 4096 Apr 23 2012 games
>>> drwxr-xr-x 66 root root 4096 Feb 12 20:07 lib
>>> drwxrwsr-x 2 root staff 4096 Apr 19 2012 local
>>> lrwxrwxrwx 1 root root 9 Jan 23 02:33 lock -> /run/lock
>>> drwxr-xr-x 19 root root 4096 Feb 12 20:07 log
>>> drwxrwsr-x 2 root mail 4096 Apr 23 2012 mail
>>> drwxr-xr-x 2 root root 4096 Apr 23 2012 opt
>>> lrwxrwxrwx 1 root root 4 Jan 23 02:33 run -> /run
>>> drwxr-xr-x 8 root root 4096 Apr 23 2012 spool
>>> drwxrwxrwt 2 root root 4096 Feb 12 20:02 tmp
>>> drwxr-xr-x 2 root root 4096 Feb 12 20:08 www
>>> $
>>>
>>> Without any better notion, I would simply chmod a +w here for www, but
>>> I'd first like to ask if that's a good idea, as sometimes I've found
>>> that when I lack permission to do something, that it's more like
>>> keeping
>>> me from shooting myself in the foot.
>>>
>>> What would you do now?
>> I would make www owned by (IIRC) www-data or whatever apache runs under,
>> and group staff and leave the permissions alone.
>
> Can you elaborate?
Your /var/www folder is owned by the root user, and the permissions are
set to only allow the root user to create and write to files in that
folder.
From your list of users, I'd say the www-data user is the right one for
this scenario. Just run the following command:
sudo chown -R www-data:www-data /var/www
This will change the owner (chown) of the /var/www folder to the
"www-data" user (and the "www-data" group), and all files and folders
within it (-R = recursively). The sudo command is used to run the chown
command with elevated administrator privileges (ie. as the root user). You
may have to provide a password to run that command, though. If you're
already running the command as the root user, you don't need to run it
through "sudo".
The other privileges on the files inside /var/www (read/write/execute) can
stay as they are (no need to use the "chmod" command).
> [snip]
>
> Q,7) Are these the users of my ubuntu system?
>
> After the ellipses, I think all of that got added as I did a LAMP
> install. Now I have a quiver full of questions.
Yes, these are all users of your Ubuntu system, most of these are created
and used for various background services, especially those with a
userid/uid lower than 1000 - each line is in the following format (each
field is separated by ":" - a colon):
username:x:userid:groupid:real name (or description):homedir:shell
http://en.wikipedia.org/wiki/Passwd_(file)
The www-data user and group is the most common user/group created when
installing Apache2 on Ubuntu and Debian systems.
> Q1) Now that I have shown /etc/passwd on-line, have I laid out my cards
> to hackers who just have a lot of time their hands, be bored and want to
> do something interesting. Be aware that my machine and website might
> total one hundred bucks in assets.
The only "useful" information contained in the /etc/passwd file is mainly
the usernames - all the rest is mostly useless to outside attackers (the
password is not revealed in this file, and the homedir and shell paths are
only somewhat useful once the user has already gotten inside). It may
provide a starting point for brute-force hacking, though, but then they'd
also have to know the IP address of your server as well.
> Q2) Do I want to create a group that comprehends all these differing
> agents in apache?
All websites served by Apache run under the user that has been defined for
Apache (usually the user "www-data" and the group "www-data" - this can be
changed in the config files for Apache, though).
--
Kim André Akerø
- kimandre(at)NOSPAMbetadome(dot)com
(remove NOSPAM to contact me directly)
|
|
|
Re: getting a php capability on ubuntu was Re: using scripting languages to automate a browser [message #180448 is a reply to message #180426] |
Sun, 17 February 2013 02:48 |
Arno Welzel
Messages: 317 Registered: October 2011
Karma: 0
|
Senior Member |
add to buddy list ignore all messages by this user
|
|
M. Strobel, 2013-02-12 15:29:
> Am 12.02.2013 14:50, schrieb Peter H. Coffin:
>> On Mon, 11 Feb 2013 22:29:42 +0100, M. Strobel wrote:
[...]
>>> Maybe I confound it with the question which desktop is best for *nix
>>> development, but it just does not make sense develop for *nix on a MS
>>> Win desktop. You do not even have a decent shell. MinGW and Cygwin are
>>> not THE REAL THING.
>>
>> I am not sure how this matters, since 99.9% of development doesn't
>> even touch a shell, and wouldn't need the facilities of even those
>> (MinGW/Cygwin) anyway. An IDE works with files, it may compile things,
>> it probably does some socket stuff connecting to a versioning system
>> or source repository, but all the capacities of the programs being
>> developed depend on the capacities of the languages that they're built
>> in, and all stuff outside that can easily be provided by the IDE itself.
>> (EG: Who cares if you've got a posix grep utility around if your IDE
>> would be built with a regexp library bound in anyway?)
>>
>
> Then it looks like I am doing something completely wrong.
>
> I have to: write helper scripts, distribute them on my servers into the search path,
> version them, pump data out one database piping via ssh to remote servers, automate
> remote server setup and management, set up remote versioning repos, testing PHP
> snippets because of version differences and fine tuning, test HTML5 features and
> javascript in browser versions, write DB consistency checks, ... and yes, brute force
> grep through everything for refactoring.
>
> It really helps to work within the same OS family.
In *this* case - yes, for you.
But "PHP development" does not necessarily involve "helper scripts",
"piping via ssh to remote servers", "automate remote server setup and
management" etc. This is just a use case - and even a rare one compared
to the number of existing PHP installations and what they are used for.
There are a lot of PHP based applications which only need PHP itself and
probably a database like MySQL - and run fine on a Windows based system
as well.
Therefore i would not say that Linux is the "native" platform for PHP.
Apache is also not the "native" platform for web servers - other systems
like nginx or IIS exist and are used as well.
Of course - depending on what you want to do, it is important to have
the same environment for development as for production (same web server,
same libraries etc.). But this may also just be "Apache", "MySQL", "PHP"
- and nothing more.
--
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
|
|
|
|
|
|
Re: getting a php capability on ubuntu was Re: using scripting languages to automate a browser [message #180465 is a reply to message #180461] |
Tue, 19 February 2013 05:43 |
Arno Welzel
Messages: 317 Registered: October 2011
Karma: 0
|
Senior Member |
add to buddy list ignore all messages by this user
|
|
Cal Dershowitz, 2013-02-19 10:19:
> On 02/16/2013 11:48 PM, Arno Welzel wrote:
>> M. Strobel, 2013-02-12 15:29:
>
>>> It really helps to work within the same OS family.
>>
>> In *this* case - yes, for you.
>>
>> But "PHP development" does not necessarily involve "helper scripts",
>> "piping via ssh to remote servers", "automate remote server setup and
>> management" etc. This is just a use case - and even a rare one compared
>> to the number of existing PHP installations and what they are used for.
>>
>> There are a lot of PHP based applications which only need PHP itself and
>> probably a database like MySQL - and run fine on a Windows based system
>> as well.
>
> Arno,
>
> I'd like to stop you right here and ask you a question. It goes to
> overall architecture.
>
> I notice that the facebook I spend way too much time on is written in
> php. Am I correct to think that the images and vids we see on fb are
> accessed through being in that database?
Maybe - but this is pure speculation, since i don't know how Facebook
implemented the image storage. It may also be, that images are stored as
files in a directory which is not accessible to the public and
develivered using scripts which fetch the files.
> I ask, because with my current toolchain for uploading images to the
> net, I have to create a new, unique directory every time or risk that
> the content simply be there for the hacking.
>
> What I want to do is use my web domain to show photos and vids just like
> any other site can. Heck even the nra can do it. This is how I promote
> the projects I'm working on.
And what exactly is your problem? What do you mean by "risk that the
content simply be there for the hacking"?
--
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
|
|
|
Re: getting a php capability on ubuntu was Re: using scripting languages to automate a browser [message #180466 is a reply to message #180462] |
Tue, 19 February 2013 05:44 |
Arno Welzel
Messages: 317 Registered: October 2011
Karma: 0
|
Senior Member |
add to buddy list ignore all messages by this user
|
|
Cal Dershowitz, 2013-02-19 10:27:
> On 02/14/2013 08:15 AM, Kim André Akerø wrote:
>
>> sudo chown -R www-data:www-data /var/www
>
> Thx, Kim, this really helped me out of the mire, but I'm not quite
> squared-away yet.
>>
>> This will change the owner (chown) of the /var/www folder to the
>> "www-data" user (and the "www-data" group), and all files and folders
>> within it (-R = recursively). The sudo command is used to run the chown
>> command with elevated administrator privileges (ie. as the root user).
>> You may have to provide a password to run that command, though. If
>> you're already running the command as the root user, you don't need to
>> run it through "sudo".
>>
>> The other privileges on the files inside /var/www (read/write/execute)
>> can stay as they are (no need to use the "chmod" command).
>>
>
> ok. to run as a php script, a file only need to have read permission,
> though, right?
Yes - since you do not run a PHP script directly but use the PHP
interpeter to do this for you, either with a PHP module in your
Webserver or an external handler.
--
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
|
|
|
|
|
|