php-general Digest 13 Oct 2011 22:08:30 -0000 Issue 7518
Topics (messages 315267 through 315288):
Re: Local variable protection
315267 by: Benjamin Coddington
315272 by: Tedd Sperling
315273 by: Tim Streater
Compile PHP with MySQL support
315268 by: Nick Khamis
315287 by: Simon J Welsh
Compile PHP with MySQLi (With MySQL on a remote server)
315269 by: Nick Khamis
315270 by: Nilesh Govindarajan
315271 by: Ian
Re: parse error
315274 by: David Savage
315275 by: Stuart Dallas
315276 by: Robert Williams
315277 by: Ken Robinson
315279 by: Steve Staples
315281 by: Ken Robinson
315286 by: Stuart Dallas
Introducting CRUDsader : a new PHP ORM Framework
315278 by: jean-baptiste verrey
Stuck on undefined function mysql_connect()
315280 by: Nick Khamis
315282 by: Daniel Brown
315283 by: Daniel Brown
315284 by: Nick Khamis
315285 by: Nick Khamis
Dennis Ritchie, Father of Unix and C programming language, dead at 70
315288 by: Daevid Vincent
Administrivia:
To subscribe to the digest, e-mail:
[email protected]
To unsubscribe from the digest, e-mail:
[email protected]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
On Oct 13, 2011, at 5:05 AM, Stuart Dallas wrote:
> On 12 Oct 2011, at 21:06, Benjamin Coddington wrote:
>
>> Are there any assurances that function local variables are protected from
>> code calling the function?
>>
>> For example, I would like to provide some cryptographic functions such as
>>
>> function org_secure_string($string) {
>> $org_key = "a very random key";
>> return hash($string, $key);
>> }
>>
>> function org_reveal_string($hash) {
>> $org_key = "a very random key";
>> return unhash($hash, $key);
>> }
>>
>> I'd like to protect $org_key from any code following or using these
>> functions. I've not yet found a way that it can be revealed, but I wonder
>> if anyone here can give me a definitive answer whether or not it is possible.
>
> Maybe I'm missing something, but whatever protection might exist within a
> running PHP process, they'll simply be able to open your PHP file and see it
> there. Even if you're using something like Zend Guard, the string literal
> will not be difficult to extract.
We'll get around this by defining the functions in php's auto_prepend_file
where we'll also restrict access to the file with open_basedir.
Ben
--- End Message ---
--- Begin Message ---
>> On Oct 12, 2011, at 4:24 PM, Ken Robinson wrote:
>> Yes, but scope does not necessarily protect a value. Within a function
>> globals are out of scope, but their values can still be accessed through
>> $GLOBALS.
Tangental to the main point (and probably obvious to many) but I used to
believe (until recently) that variables within a $GLOBAL had to be defined
before being used, such as:
$GLOBAL['myVar'] = 'test';
echo($GLOBAL['myVar']);
But that is not true.
You can do this:
$myVar = 'test';
echo($GLOBAL['myVar']);
And reach the same result.
What is true (which I found surprising) was that any variable defined within
the main script are automatically included in the $GLOBAL array.
So, if in your main script you have the statement:
$myVar = 'test';
Then the $GLOBAL['myVar'] has also been created and will hold the value of
'test' without any additional coding.
While many of you will say "But of course, that's the way it works." I actually
said "What?!?" You see, I seldom use globals in my scripts and this runs
counter to my 'keep the globals to an absolute minimum' practice. So while I
was thinking my scripts didn't have globals, it was a surprise to me to find
out that in the background they were present anyway.
So, if you want a main script variable (i.e., $myVar) to be accessed by a
function, you can do it by stating:
myFunction
{
global $myVar;
// and then using $myVar
}
or
myFunction
{
$myVar = $GLOBAL['myVar']
// and then using $myVar
}
or via the standard ways by sending the value (or reference) to the function.
I hope my ignorance helps someone.
Cheers,
tedd
_____________________
[email protected]
http://sperling.com
--- End Message ---
--- Begin Message ---
On 13 Oct 2011 at 16:25, Tedd Sperling <[email protected]> wrote:
> So, if in your main script you have the statement:
>
> $myVar = 'test';
>
> Then the $GLOBAL['myVar'] has also been created and will hold the value of
> 'test' without any additional coding.
>
> While many of you will say "But of course, that's the way it works." I
> actually said "What?!?" You see, I seldom use globals in my scripts and this
> runs counter to my 'keep the globals to an absolute minimum' practice. So
> while I was thinking my scripts didn't have globals, it was a surprise to me
> to find out that in the background they were present anyway.
>
> So, if you want a main script variable (i.e., $myVar) to be accessed by a
> function, you can do it by stating:
>
> myFunction
> {
> global $myVar;
> // and then using $myVar
> }
>
> or
>
> myFunction
> {
> $myVar = $GLOBAL['myVar']
> // and then using $myVar
> }
But presumably these are not *quite* equivalent, as modifying $myVar will
change the global in the first but not in the second.
--
Cheers -- Tim
--- End Message ---
--- Begin Message ---
Hello Everyone,
I am trying to compile php from source using the following config:
./configure --prefix=/usr/local/php
--with-apxs2=/usr/local/apache/bin/apxs
--with-config-file-path=/usr/local/php
--with-mcrypt=/usr/local/bin/mcrypt --with-mysqli
--with-gettext=./ext/gettext --with-pear
--with-libxml-dir=/usr/include/libxml2 --with-zlib --with-gd
--enable-pcntl
Note the mysqli without pointing to /usr/local/mysql/bin/mysql_config.
The problem is MySQL is not installed on the machine, it is actually
installed on another server.
MySQLi Suport:
mysqli
MysqlI Support enabled
Client API library version 5.1.49
Active Persistent Links 0
Inactive Persistent Links 0
Active Links 0
Client API header version 5.1.49
MYSQLI_SOCKET /var/run/mysqld/mysqld.sock
Directive Local Value Master Value
mysqli.allow_local_infile On On
mysqli.allow_persistent On On
mysqli.default_host no value no value
mysqli.default_port 3306 3306
mysqli.default_pw no value no value
mysqli.default_socket no value no value
mysqli.default_user no value no value
mysqli.max_links Unlimited Unlimited
mysqli.max_persistent Unlimited Unlimited
mysqli.reconnect Off Off
The machine I compiled PHP on does not have mysqli.so, and so I am
recieving the "fatal call to undefined function mysql_connect()"
error. Can someone tell me how to compile php from source with mysql
support, but actually mysql is installed on a different server?
Can I download a precompile mysqli anywhere? The PHP version is 5.1.49
as noted earlier.
Thanks in Advance,
Nick
--- End Message ---
--- Begin Message ---
On 14/10/2011, at 1:27 AM, Nick Khamis wrote:
> Hello Everyone,
>
> I am trying to compile php from source using the following config:
>
> ./configure --prefix=/usr/local/php
> --with-apxs2=/usr/local/apache/bin/apxs
> --with-config-file-path=/usr/local/php
> --with-mcrypt=/usr/local/bin/mcrypt --with-mysqli
> --with-gettext=./ext/gettext --with-pear
> --with-libxml-dir=/usr/include/libxml2 --with-zlib --with-gd
> --enable-pcntl
>
> Note the mysqli without pointing to /usr/local/mysql/bin/mysql_config.
> The problem is MySQL is not installed on the machine, it is actually
> installed on another server.
>
> MySQLi Suport:
>
> mysqli
> MysqlI Support enabled
> Client API library version 5.1.49
> Active Persistent Links 0
> Inactive Persistent Links 0
> Active Links 0
> Client API header version 5.1.49
> MYSQLI_SOCKET /var/run/mysqld/mysqld.sock
>
> Directive Local Value Master Value
> mysqli.allow_local_infile On On
> mysqli.allow_persistent On On
> mysqli.default_host no value no value
> mysqli.default_port 3306 3306
> mysqli.default_pw no value no value
> mysqli.default_socket no value no value
> mysqli.default_user no value no value
> mysqli.max_links Unlimited Unlimited
> mysqli.max_persistent Unlimited Unlimited
> mysqli.reconnect Off Off
>
> The machine I compiled PHP on does not have mysqli.so, and so I am
> recieving the "fatal call to undefined function mysql_connect()"
> error. Can someone tell me how to compile php from source with mysql
> support, but actually mysql is installed on a different server?
>
> Can I download a precompile mysqli anywhere? The PHP version is 5.1.49
> as noted earlier.
>
> Thanks in Advance,
>
> Nick
You've only compiled in MySQLi. You also need to pass --with-mysql to
configure. As you can compile in MySQLi, you should have no problems with MySQL.
---
Simon Welsh
Admin of http://simon.geek.nz/
--- End Message ---
--- Begin Message ---
Hello Everyone,
I am trying to compile php from source using the following config:
./configure --prefix=/usr/local/php
--with-apxs2=/usr/local/
apache/bin/apxs
--with-config-file-path=/usr/local/php
--with-mcrypt=/usr/local/bin/mcrypt --with-mysqli
--with-gettext=./ext/gettext --with-pear
--with-libxml-dir=/usr/include/libxml2 --with-zlib --with-gd
--enable-pcntl
Note the mysqli without pointing to /usr/local/mysql/bin/mysql_config.
The problem is MySQL is not installed on the machine, it is actually
installed on another server.
MySQLi Suport:
mysqli
MysqlI Support enabled
Client API library version 5.1.49
Active Persistent Links 0
Inactive Persistent Links 0
Active Links 0
Client API header version 5.1.49
MYSQLI_SOCKET /var/run/mysqld/mysqld.sock
Directive Local Value Master Value
mysqli.allow_local_infile On On
mysqli.allow_persistent On On
mysqli.default_host no value no value
mysqli.default_port 3306 3306
mysqli.default_pw no value no value
mysqli.default_socket no value no value
mysqli.default_user no value no value
mysqli.max_links Unlimited Unlimited
mysqli.max_persistent Unlimited Unlimited
mysqli.reconnect Off Off
The machine I compiled PHP on does not have mysqli.so, and so I am
recieving the "fatal call to undefined function mysql_connect()"
error. Can someone tell me how to compile php from source with mysql
support, but actually mysql is installed on a different server?
Can I download a precompile mysqli anywhere? The PHP version is 5.1.49
as noted earlier.
Thanks in Advance,
Nick
--- End Message ---
--- Begin Message ---
On 10/13/2011 05:59 PM, Nick Khamis wrote:
> Hello Everyone,
>
> I am trying to compile php from source using the following config:
>
> ./configure --prefix=/usr/local/php
> --with-apxs2=/usr/local/
> apache/bin/apxs
> --with-config-file-path=/usr/local/php
> --with-mcrypt=/usr/local/bin/mcrypt --with-mysqli
> --with-gettext=./ext/gettext --with-pear
> --with-libxml-dir=/usr/include/libxml2 --with-zlib --with-gd
> --enable-pcntl
>
> Note the mysqli without pointing to /usr/local/mysql/bin/mysql_config.
> The problem is MySQL is not installed on the machine, it is actually
> installed on another server.
>
> MySQLi Suport:
>
> mysqli
> MysqlI Support enabled
> Client API library version 5.1.49
> Active Persistent Links 0
> Inactive Persistent Links 0
> Active Links 0
> Client API header version 5.1.49
> MYSQLI_SOCKET /var/run/mysqld/mysqld.sock
>
> Directive Local Value Master Value
> mysqli.allow_local_infile On On
> mysqli.allow_persistent On On
> mysqli.default_host no value no value
> mysqli.default_port 3306 3306
> mysqli.default_pw no value no value
> mysqli.default_socket no value no value
> mysqli.default_user no value no value
> mysqli.max_links Unlimited Unlimited
> mysqli.max_persistent Unlimited Unlimited
> mysqli.reconnect Off Off
>
> The machine I compiled PHP on does not have mysqli.so, and so I am
> recieving the "fatal call to undefined function mysql_connect()"
> error. Can someone tell me how to compile php from source with mysql
> support, but actually mysql is installed on a different server?
>
> Can I download a precompile mysqli anywhere? The PHP version is 5.1.49
> as noted earlier.
>
> Thanks in Advance,
>
> Nick
>
You don't need the mysql server to compile mysql{,i} modules, the client
library is enough.
Any special reason for not using mysqlnd, which will compile without
needing the mysql client library? Or I guess it's not there in php 5.1
--
Nilesh Govindarajan
http://nileshgr.com
--- End Message ---
--- Begin Message ---
On 13/10/2011 13:29, Nick Khamis wrote:
> Hello Everyone,
>
> I am trying to compile php from source using the following config:
>
> ./configure --prefix=/usr/local/php
> --with-apxs2=/usr/local/
> apache/bin/apxs
> --with-config-file-path=/usr/local/php
> --with-mcrypt=/usr/local/bin/mcrypt --with-mysqli
> --with-gettext=./ext/gettext --with-pear
> --with-libxml-dir=/usr/include/libxml2 --with-zlib --with-gd
> --enable-pcntl
>
> Note the mysqli without pointing to /usr/local/mysql/bin/mysql_config.
> The problem is MySQL is not installed on the machine, it is actually
> installed on another server.
>
> MySQLi Suport:
>
> mysqli
> MysqlI Support enabled
> Client API library version 5.1.49
> Active Persistent Links 0
> Inactive Persistent Links 0
> Active Links 0
> Client API header version 5.1.49
> MYSQLI_SOCKET /var/run/mysqld/mysqld.sock
>
> Directive Local Value Master Value
> mysqli.allow_local_infile On On
> mysqli.allow_persistent On On
> mysqli.default_host no value no value
> mysqli.default_port 3306 3306
> mysqli.default_pw no value no value
> mysqli.default_socket no value no value
> mysqli.default_user no value no value
> mysqli.max_links Unlimited Unlimited
> mysqli.max_persistent Unlimited Unlimited
> mysqli.reconnect Off Off
>
> The machine I compiled PHP on does not have mysqli.so, and so I am
> recieving the "fatal call to undefined function mysql_connect()"
> error. Can someone tell me how to compile php from source with mysql
> support, but actually mysql is installed on a different server?
>
> Can I download a precompile mysqli anywhere? The PHP version is 5.1.49
> as noted earlier.
>
> Thanks in Advance,
>
> Nick
>
Hi Nick,
You only need the mysql development libraries to compile mysql/mysqli
support into php.
If you are on an rpm based system use (Red Hat / CentOS / SuSE etc):
yum install mysql-devel
There may be other dependencies required to install this, but yum should
tell you what they are.
If you are using a different package manager then google will be able to
help.
Regards
Ian
--
--- End Message ---
--- Begin Message ---
please read the following chain of emails...I'm at my wits end.
________________________________
From: David Savage
Sent: Thu 10/13/2011 11:09 AM
To: [email protected]
Subject: FW: parse error
How can I find the answer to the following php issue? I am not sure how to
post a question to the general digest from php.net. The email address who I
initially sent this email to, is not valid, and I cannot find any details on
what the following PHP Parse error: parse error refers to, in the context of
the line that the error points to.
________________________________
From: David Savage
Sent: Thu 10/13/2011 9:56 AM
To: [email protected]
Subject: parse error
I'm sorry....I need help with php v. 4.3.9 (cgi). I don't know where else to
turn. I've looked on the php.net web site for details on this particular
error, but am unable to find any.
this is the version I use.
php -v
PHP 4.3.9 (cgi) (built: Jun 26 2006 09:46:03)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
I run the following command, and getting the following compile error on a linux
environment:
php -l voip_cdrs.php
PHP Parse error: parse error, unexpected T_STRING in
/usr/local/cytrex/voip_cdrs.php on line 1050
Errors parsing voip_cdrs.php
here is a portion of the code that includes the line number mentioned:
if ($destlen==11) {
$start_from_which_offset=1;
}
if ($destlen==10) {
$start_from_which_offset=0;
}
$termnum10=substr($dest, $start_from_which_offset,10);
$alias_sql_stmt="SELECT ani FROM ldrates WHERE
ani='$termnum10'"; // <-----this is line 1050
print "$alias_sql_stmt\n";
$alias_result = $db->sql_query($alias_sql_stmt);
if ($alias_result==TRUE) {
if($db->sql_numrows($alias_result) > 0) {
print "Found alias...\n";
continue;
}
} else {
die("problem with sql: $alias_sql_stmt");
}
Could you please tell me what's wrong with the line 1050 ? I've been pulling
my hair out (figuratively speaking) trying to understand why the compiler sees
this line as a problem. Thanks for whatever help you can give.
--- End Message ---
--- Begin Message ---
On 13 Oct 2011, at 18:06, David Savage wrote:
> I'm sorry....I need help with php v. 4.3.9 (cgi). I don't know where else to
> turn. I've looked on the php.net web site for details on this particular
> error, but am unable to find any.
>
> this is the version I use.
> php -v
> PHP 4.3.9 (cgi) (built: Jun 26 2006 09:46:03)
> Copyright (c) 1997-2004 The PHP Group
> Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
>
> I run the following command, and getting the following compile error on a
> linux environment:
> php -l voip_cdrs.php
> PHP Parse error: parse error, unexpected T_STRING in
> /usr/local/cytrex/voip_cdrs.php on line 1050
> Errors parsing voip_cdrs.php
>
> here is a portion of the code that includes the line number mentioned:
> if ($destlen==11) {
> $start_from_which_offset=1;
> }
> if ($destlen==10) {
> $start_from_which_offset=0;
> }
> $termnum10=substr($dest, $start_from_which_offset,10);
> $alias_sql_stmt="SELECT ani FROM ldrates WHERE
> ani='$termnum10'"; // <-----this is line 1050
> print "$alias_sql_stmt\n";
> $alias_result = $db->sql_query($alias_sql_stmt);
> if ($alias_result==TRUE) {
> if($db->sql_numrows($alias_result) > 0) {
> print "Found alias...\n";
> continue;
> }
> } else {
> die("problem with sql: $alias_sql_stmt");
> }
>
> Could you please tell me what's wrong with the line 1050 ? I've been
> pulling my hair out (figuratively speaking) trying to understand why the
> compiler sees this line as a problem. Thanks for whatever help you can give.
There is nothing wrong with the code you've posted...
stuart@willow:~$ php -l test.php
No syntax errors detected in test.php
Which means the error is likely above that in the file.
-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--- End Message ---
--- Begin Message ---
On 10/13/11 10:06, "David Savage" <[email protected]> wrote:
>php -l voip_cdrs.php
>PHP Parse error: parse error, unexpected T_STRING in
>/usr/local/cytrex/voip_cdrs.php on line 1050
>Errors parsing voip_cdrs.php
>
> $alias_sql_stmt="SELECT ani FROM ldrates WHERE
>ani='$termnum10'"; // <-----this is line 1050
>
>Could you please tell me what's wrong with the line 1050 ? I've been
>pulling my hair out (figuratively speaking) trying to understand why the
>compiler sees this line as a problem. Thanks for whatever help you can
>give.
My suspicion is that there's is an unmatched curly brace earlier in the
file. With this type of error, you'll generally get a report of a bad line
further down the file--sometimes way down--because the parser can't
recognize until it hits the later point that something is wrong. Try
double-checking that the {Š} blocks prior to line 1050 properly balance,
and you'll probably find there's an extra one, or that one is missing, etc.
If nothing else, just start stripping code from the file until you find
the line that's actually at fault. If you do this in a binary search
fashion, it won't take more than a few minutes.
Regards,
Bob
--
Robert E. Williams, Jr.
Associate Vice President of Software Development
Newtek Businesss Services, Inc. -- The Small Business Authority
https://www.newtekreferrals.com/rewjr
http://www.thesba.com/
Notice: This communication, including attachments, may contain information that
is confidential. It constitutes non-public information intended to be conveyed
only to the designated recipient(s). If the reader or recipient of this
communication is not the intended recipient, an employee or agent of the
intended recipient who is responsible for delivering it to the intended
recipient, or if you believe that you have received this communication in
error, please notify the sender immediately by return e-mail and promptly
delete this e-mail, including attachments without reading or saving them in any
manner. The unauthorized use, dissemination, distribution, or reproduction of
this e-mail, including attachments, is prohibited and may be unlawful. If you
have received this email in error, please notify us immediately by e-mail or
telephone and delete the e-mail and the attachments (if any).
--- End Message ---
--- Begin Message ---
At 01:26 PM 10/13/2011, Robert Williams wrote:
On 10/13/11 10:06, "David Savage" <[email protected]> wrote:
>php -l voip_cdrs.php
>PHP Parse error: parse error, unexpected T_STRING in
>/usr/local/cytrex/voip_cdrs.php on line 1050
>Errors parsing voip_cdrs.php
>
> $alias_sql_stmt="SELECT ani FROM ldrates WHERE
>ani='$termnum10'"; // <-----this is line 1050
>
>Could you please tell me what's wrong with the line 1050 ? I've been
>pulling my hair out (figuratively speaking) trying to understand why the
>compiler sees this line as a problem. Thanks for whatever help you can
>give.
My suspicion is that there's is an unmatched curly brace earlier in the
file. With this type of error, you'll generally get a report of a bad line
further down the file--sometimes way down--because the parser can't
recognize until it hits the later point that something is wrong. Try
double-checking that the {} blocks prior to line 1050 properly balance,
and you'll probably find there's an extra one, or that one is missing, etc.
It's more likely an unterminated quoted string.
It looks like PHP is giving up after finding
unrecognizable stuff after either the first
double or single quote on that line. If you're
using an editor that doesn't do syntax high lighting, get one.
Ken
--- End Message ---
--- Begin Message ---
-----Original Message-----
From: Ken Robinson [mailto:[email protected]]
Sent: Thursday, October 13, 2011 1:33 PM
To: [email protected]
Subject: Re: [PHP] FW: parse error
At 01:26 PM 10/13/2011, Robert Williams wrote:
>On 10/13/11 10:06, "David Savage" <[email protected]> wrote:
>
>
> >php -l voip_cdrs.php
> >PHP Parse error: parse error, unexpected T_STRING in
> >/usr/local/cytrex/voip_cdrs.php on line 1050 Errors parsing
> >voip_cdrs.php
> >
> > $alias_sql_stmt="SELECT ani FROM ldrates WHERE
> >ani='$termnum10'"; // <-----this is line 1050
> >
> >Could you please tell me what's wrong with the line 1050 ? I've been
> >pulling my hair out (figuratively speaking) trying to understand why
> >the compiler sees this line as a problem. Thanks for whatever help
> >you can give.
>
>My suspicion is that there's is an unmatched curly brace earlier in the
>file. With this type of error, you'll generally get a report of a bad
>line further down the file--sometimes way down--because the parser
>can't recognize until it hits the later point that something is wrong.
>Try double-checking that the {Š} blocks prior to line 1050 properly
>balance, and you'll probably find there's an extra one, or that one is
>missing, etc.
It's more likely an unterminated quoted string.
It looks like PHP is giving up after finding unrecognizable stuff after either
the first double or single quote on that line. If you're using an editor that
doesn't do syntax high lighting, get one.
Ken
I would suggest that you figure out what is the value of the variable your
passing into your query.... is it possible that the value is getting a '
character, in which case it would be crapping out the line...
For now, try adding [addslashes]:
$termnum10=addslashes(substr($dest, $start_from_which_offset,10));
$alias_sql_stmt="SELECT ani FROM ldrates WHERE ani='$termnum10'"; //
<-----this is line 1050
Steve.
--- End Message ---
--- Begin Message ---
At 02:06 PM 10/13/2011, Steve Staples wrote :
[snip]
It's more likely an unterminated quoted string.
It looks like PHP is giving up after finding unrecognizable stuff
after either the first double or single quote on that line. If
you're using an editor that doesn't do syntax high lighting, get one.
Ken
I would suggest that you figure out what is the value of the
variable your passing into your query.... is it possible that the
value is getting a ' character, in which case it would be crapping
out the line...
That would only occur when the script is actually executed. It's not
getting that far yet, since it's dying on a syntax error during the parse.
For now, try adding [addslashes]:
$termnum10=addslashes(substr($dest, $start_from_which_offset,10));
$alias_sql_stmt="SELECT ani FROM ldrates WHERE
ani='$termnum10'"; // <-----this is line 1050
No, mysql_real_escape_string
(http://php.net/mysql_real_escape_string) should be used, not
addslashes, although there are some people who have suggested that
even that function is not enough and that only using stored
procedures is good enough.
Ken
--- End Message ---
--- Begin Message ---
Please include the list when replying.
On 13 Oct 2011, at 19:44, David Savage wrote:
> ok thanks for the quick reply. Still trying to figure out the line that is
> causing the problem above that line 1050....I'm a novice at php, and
> currently use it just for console programming, though I want to eventually
> learn how to place html code in it, and make it simpler to run this program
> in a web browser, instead of by the command line.
Are you using an editor that does syntax highlighting? If not, find one and
load up the file. If you have an unterminated string or similar error, the
highlighting should tell you where that problem is.
-Stuart
> From: Stuart Dallas [mailto:[email protected]]
> Sent: Thu 10/13/2011 12:04 PM
> To: David Savage
> Cc: [email protected]
> Subject: Re: [PHP] FW: parse error
>
> On 13 Oct 2011, at 18:06, David Savage wrote:
>
> > I'm sorry....I need help with php v. 4.3.9 (cgi). I don't know where else
> > to turn. I've looked on the php.net web site for details on this
> > particular error, but am unable to find any.
> >
> > this is the version I use.
> > php -v
> > PHP 4.3.9 (cgi) (built: Jun 26 2006 09:46:03)
> > Copyright (c) 1997-2004 The PHP Group
> > Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
> >
> > I run the following command, and getting the following compile error on a
> > linux environment:
> > php -l voip_cdrs.php
> > PHP Parse error: parse error, unexpected T_STRING in
> > /usr/local/cytrex/voip_cdrs.php on line 1050
> > Errors parsing voip_cdrs.php
> >
> > here is a portion of the code that includes the line number mentioned:
> > if ($destlen==11) {
> > $start_from_which_offset=1;
> > }
> > if ($destlen==10) {
> > $start_from_which_offset=0;
> > }
> > $termnum10=substr($dest, $start_from_which_offset,10);
> > $alias_sql_stmt="SELECT ani FROM ldrates WHERE
> > ani='$termnum10'"; // <-----this is line 1050
> > print "$alias_sql_stmt\n";
> > $alias_result = $db->sql_query($alias_sql_stmt);
> > if ($alias_result==TRUE) {
> > if($db->sql_numrows($alias_result) > 0) {
> > print "Found alias...\n";
> > continue;
> > }
> > } else {
> > die("problem with sql: $alias_sql_stmt");
> > }
> >
> > Could you please tell me what's wrong with the line 1050 ? I've been
> > pulling my hair out (figuratively speaking) trying to understand why the
> > compiler sees this line as a problem. Thanks for whatever help you can
> > give.
>
> There is nothing wrong with the code you've posted...
>
> stuart@willow:~$ php -l test.php
> No syntax errors detected in test.php
>
> Which means the error is likely above that in the file.
>
> -Stuart
>
> --
> Stuart Dallas
> 3ft9 Ltd
> http://3ft9.com/
>
--- End Message ---
--- Begin Message ---
hi everyone,
I have been developing an ORM framework for the last year (at least) and I
have finally released a beta that is worth of being on internet^^
so if you have some time to spare have a look at http://www.crudsader.com/.
The novelty of the framework lies in object automatic forms, configuration
and the Object query language (which is very simple and uses string instead
of object methods).
It's missing cache and performance improvement at the moment but I'm working
on it.
I will gladly appreciate any comments to make it better, or about anything
that the framework is missing or where I could have been completely wrong!
Regards,
Jean-Baptiste Verrey
ps: I'm working hard on checking that the examples of the doc are actually
working, and to add more content to the docs
--- End Message ---
--- Begin Message ---
I have been stuck on this, and have no idea what is causing it. I have
compiled PHP with mysqli support:
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs
--with-config-file-path=/usr/local/php --with-mcrypt=/usr/local/bin/mcrypt
--with-mysqli --with-gettext=./ext/gettext --with-pear
--with-libxml-dir=/usr/include/libxml2 --with-zlib --with-gd --enable-pcntl
mysqli MysqlI Supportenabled Client API library version 5.1.49 Active
Persistent Links 0 Inactive Persistent Links 0 Active Links 0 Client API
header version 5.1.49 MYSQLI_SOCKET /var/run/mysqld/mysqld.sock
DirectiveLocal ValueMaster Value mysqli.allow_local_infileOnOn
mysqli.allow_persistentOnOn mysqli.default_host*no value**no value*
mysqli.default_port33063306 mysqli.default_pw*no value**no value*
mysqli.default_socket*no value**no value* mysqli.default_user*no value**no
value* mysqli.max_linksUnlimitedUnlimited mysqli.max_persistentUnlimited
Unlimited mysqli.reconnectOffOff
However, there is no mysqli.so or mysql.so found anywhere? Please help, I
have fallen behind because of this.
Nick.
--- End Message ---
--- Begin Message ---
On Thu, Oct 13, 2011 at 14:19, Nick Khamis <[email protected]> wrote:
> I have been stuck on this, and have no idea what is causing it. I have
> compiled PHP with mysqli support:
Right.... which will use mysqli_connect(), et al. If you didn't
compile it with straight MySQL support, then the mysql_*() functions
won't be there.
> However, there is no mysqli.so or mysql.so found anywhere? Please help, I
> have fallen behind because of this.
It's compiled into the core, not as an extension.
--
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/
--- End Message ---
--- Begin Message ---
On Thu, Oct 13, 2011 at 14:33, Nick Khamis <[email protected]> wrote:
> I was just going to try recompilign with mysql instead of mysqli... I hope
> this fixes it.
> In terms of mysql being compiled into the core, does this mean I do not have
> to add
>
> extension=mysqli.so
> extension_dir=/usr/local/php/include/php/ext/
(Please don't top-post, and be sure to click "reply-all" so that
the discussion remains on the list for the benefit of others as well.)
Correct. Extensions, such as those found in the PECL repository,
are added in that manner. Things compiled into the core, such as what
you're doing with MySQLi, are automatically loaded regardless, because
they're statically-built into the PHP binary itself.
--
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/
--- End Message ---
--- Begin Message ---
I was just going to try recompilign with mysql instead of mysqli... I hope
this fixes it.
In terms of mysql being compiled into the core, does this mean I do not have
to add
extension=mysqli.so
extension_dir=/usr/local/php/
include/php/ext/
Thanks in Advance,
--- End Message ---
--- Begin Message ---
Correct. Extensions, such as those found in the PECL repository,
are added in that manner. Things compiled into the core, such as what
you're doing with MySQLi, are automatically loaded regardless, because
they're statically-built into the PHP binary itself.
--- End Message ---
--- Begin Message ---
#include <stdio.h>
int main()
{
printf("R.I.P. Dennis Ritchie: 1941-2011\n");
return 0;
}
http://www.networkworld.com/news/2011/101311-ritchie-251936.html
--- End Message ---