php-general Digest 26 Aug 2012 09:12:23 -0000 Issue 7937
Topics (messages 318849 through 318858):
A quick ereg translation
318849 by: Lester Caine
318850 by: Sebastian Krebs
318851 by: SagaciousDev PHP-Dev
318853 by: Lester Caine
syntax error breaking in and out of php into html code
318852 by: Ashley Sheridan
318854 by: Adam Richardson
318856 by: Duken Marga
318857 by: Ashley Sheridan
Re: set up mass virtual hosting with apache/nginx and PHP ... best practice
2012?
318855 by: Duken Marga
Re: UTC on php log bug
318858 by: tamouse mailing lists
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
ereg('<body>(.*)</body>', $phpinfo, $regs);
Pulls the body of phpinfo() to use with a tidy header of other system
information, but I'm struggling to get a pcre alternative. Anybody already
cracked this one?
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
--- End Message ---
--- Begin Message ---
Am 25.08.2012 23:06, schrieb Lester Caine:
ereg('<body>(.*)</body>', $phpinfo, $regs);
Pulls the body of phpinfo() to use with a tidy header of other system
information, but I'm struggling to get a pcre alternative. Anybody
already cracked this one?
usually it's just fine to wrap the pattern into delimiter.
| preg_match('~<body>(.*)</body>~i', $phpinfo, $regs);
--- End Message ---
--- Begin Message ---
You're correct in the fact that you've added delimiters to the pattern, however
you also need to specify the "s" pattern modifier so that the search spans over
multiple lines.
This should do the trick:
preg_match('#<body>(.*)</body>#is', $content, $matches);
---
> Date: Sat, 25 Aug 2012 23:10:08 +0200
> From: krebs....@gmail.com
> To: php-gene...@lists.php.net
> Subject: Re: [PHP] A quick ereg translation
>
> Am 25.08.2012 23:06, schrieb Lester Caine:
> > ereg('<body>(.*)</body>', $phpinfo, $regs);
> >
> > Pulls the body of phpinfo() to use with a tidy header of other system
> > information, but I'm struggling to get a pcre alternative. Anybody
> > already cracked this one?
> >
>
> usually it's just fine to wrap the pattern into delimiter.
>
> | preg_match('~<body>(.*)</body>~i', $phpinfo, $regs);
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
SagaciousDev PHP-Dev wrote:
This should do the trick:
preg_match('#<body>(.*)</body>#is', $content, $matches);
TA - That has got it ;)
That is tidier than what I had ended up with ...
#<body>([^\']*?)<\/body>#
from a 'tutorial'
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
--- End Message ---
--- Begin Message ---
I've just inherited some (pretty awful code) that I have to make some
edits to, and came across a bit of a problem. A lot of the code breaks
in and out of PHP and into HTML code:
<?php
while(condition)
{
?>
<li>some html here</li>
<?php
}
?>
But when I check this my PHP parser is saying that this is a syntax
error (checked in the browser and CLI). I know this is code from a
working site, so it must be a setting within my PHP configuration.
Now, I'm intending to re-write this anyway, as the logic is all over the
place (SQL queries within the HTML, no separation of code and content,
dozens of warnings all over the place) but I was wondering what setting
causes this. It's mostly a curiosity thing really, as this thing is
going to be re-written faster than an school project the eve before
hand-in.
--
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
On Sat, Aug 25, 2012 at 6:54 PM, Ashley Sheridan
<a...@ashleysheridan.co.uk> wrote:
> I've just inherited some (pretty awful code) that I have to make some
> edits to, and came across a bit of a problem. A lot of the code breaks
> in and out of PHP and into HTML code:
>
> <?php
> while(condition)
> {
> ?>
> <li>some html here</li>
> <?php
> }
> ?>
>
> But when I check this my PHP parser is saying that this is a syntax
> error (checked in the browser and CLI). I know this is code from a
> working site, so it must be a setting within my PHP configuration.
I honestly can't think of a config setting that would cause a syntax
error for this type of example.
Adam
--
Nephtali: A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com
--- End Message ---
--- Begin Message ---
Can you tell us what is the error shown in browser or CLI?
On Sun, Aug 26, 2012 at 5:54 AM, Ashley Sheridan
<a...@ashleysheridan.co.uk>wrote:
> I've just inherited some (pretty awful code) that I have to make some
> edits to, and came across a bit of a problem. A lot of the code breaks
> in and out of PHP and into HTML code:
>
> <?php
> while(condition)
> {
> ?>
> <li>some html here</li>
> <?php
> }
> ?>
>
> But when I check this my PHP parser is saying that this is a syntax
> error (checked in the browser and CLI). I know this is code from a
> working site, so it must be a setting within my PHP configuration.
>
> Now, I'm intending to re-write this anyway, as the logic is all over the
> place (SQL queries within the HTML, no separation of code and content,
> dozens of warnings all over the place) but I was wondering what setting
> causes this. It's mostly a curiosity thing really, as this thing is
> going to be re-written faster than an school project the eve before
> hand-in.
>
> --
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
--
Duken Marga
--- End Message ---
--- Begin Message ---
On Sun, 2012-08-26 at 09:41 +0700, Duken Marga wrote:
> Can you tell us what is the error shown in browser or CLI?
>
> On Sun, Aug 26, 2012 at 5:54 AM, Ashley Sheridan
> <a...@ashleysheridan.co.uk>wrote:
>
> > I've just inherited some (pretty awful code) that I have to make some
> > edits to, and came across a bit of a problem. A lot of the code breaks
> > in and out of PHP and into HTML code:
> >
> > <?php
> > while(condition)
> > {
> > ?>
> > <li>some html here</li>
> > <?php
> > }
> > ?>
> >
> > But when I check this my PHP parser is saying that this is a syntax
> > error (checked in the browser and CLI). I know this is code from a
> > working site, so it must be a setting within my PHP configuration.
> >
> > Now, I'm intending to re-write this anyway, as the logic is all over the
> > place (SQL queries within the HTML, no separation of code and content,
> > dozens of warnings all over the place) but I was wondering what setting
> > causes this. It's mostly a curiosity thing really, as this thing is
> > going to be re-written faster than an school project the eve before
> > hand-in.
> >
> > --
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> >
> >
> >
>
>
Through the browser I get:
Parse error: syntax error, unexpected $end
in /var/www/html/siteinquestion/index.php on line 356
Through the CLI I get:
PHP Parse error: syntax error, unexpected $end in index.php on line 356
Parse error: syntax error, unexpected $end in index.php on line 356
Errors parsing index.php
I've narrowed it down to the lines that used the breaking in and out of
PHP style. As soon as I comment out those it runs fine, albeit without
the content that code was intended to add.
--
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
On Sun, Aug 26, 2012 at 2:30 AM, D. Dante Lorenso <da...@lorenso.com> wrote:
>
> Using VirtualDocumentRoot, I was able to create a virtual host defined
> like this:
>
<VirtualHost *:80>
> ServerName student.sampledomain.edu
> ServerAlias *.student.sampledomain.edu
>
> DocumentRoot
> /mnt/web/student.sampledomain.**edu/docroot<http://student.sampledomain.edu/docroot>
> UseCanonicalName Off
> VirtualDocumentRoot /mnt/userwww/%-4+
>
> ErrorLog "|/usr/bin/logger -p local6.notice -t 'error-student'"
> CustomLog "|/usr/bin/logger -p local6.notice -t 'access-student'" full
> </VirtualHost>
>
> That maps domain names like
> <username>.student.**sampledomain.edu<http://student.sampledomain.edu>to
> directories in the /mnt/userwww/<username> directory. That gets me
> close, but isn't handling PHP yet. I think Apache also runs as 'apache'
> user when reading all the files, so users must chmod their files world
> readable still for this to work.
>
> I don't know what you means "isn't handling PHP yet". If you want Apache
handling a PHP program, you must integrate PHP and Apache, in FreeBSD and
Apache, these lines must be written in httpd.conf:
# Apache 2.x
LoadModule php5_module libexec/apache/libphp5.so
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
The above lines will tell apache to execute php file as a PHP program.
For your latest statement, Yes, default Apache will handling program as
'apache' user. But, if you use suPHP, suExec, or other similiar program,
the file will be execute as a user that own the files. So, in other words,
you must use 'chown' program to assure the php files is own by the right
user. The files still readable with that program if you use secure and
right mode with 'chmod' program. For security reason, you must always use
755 for directory and mode 644 for files.
> You reference "suPHP" as the way to go. The problem I have with that is
> this website:
> http://www.suphp.org/Home.html
>
> Looks like the last update was back in 2009. That's more than 3 years
> ago. I think that project has stalled. There must be something newer that
> has replaced it since then.
>
> I think the suPHP project is not dead yet. It's because the program is
small and just doing a simple task and if the suPHP program still work for
the latest Apache today, why do we must question it? Even small notepad
from 10 years ago can still be used today, right? If you want advanced and
simple task to manage files for each user, you must buy commercial program
like cPanel or Plesk.
--
Duken Marga
--- End Message ---
--- Begin Message ---
On Fri, Aug 24, 2012 at 8:48 PM, Martín Marqués
<martin.marq...@gmail.com> wrote:
> Whats up with this bug?: https://bugs.php.net/bug.php?id=60723
perhaps direct the query (such as it is) to php-development
--- End Message ---