php-general Digest 20 Dec 2008 15:22:32 -0000 Issue 5856
Topics (messages 284870 through 284883):
Using php in custom built http server
284870 by: Mr. Gecko
284872 by: Nathan Rixham
284875 by: Nathan Nobbe
284876 by: mike
284877 by: Nathan Nobbe
284878 by: mike
Re: de-bug no input file specified
284871 by: Nathan Rixham
284873 by: Nathan Rixham
284874 by: Nathan Rixham
284879 by: Gary Maddock-Greene
284880 by: Gary Maddock-Greene
Re: Require error
284881 by: Jochem Maas
Re: search for person by comparing his data with data in mysql
284882 by: Jochem Maas
filter function vs regular expression
284883 by: Alain Roger
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 ---
Hey, I built my own http server, and I'm wanting to add php to it. the
server is in Objective-C.
I know I can use terminal commands to do it, but if I was to do that
how would I get headers and stuff php sends, and how would I send php
HTTP_REMOTE_ADDRESS and stuff like that?
I would prefer doing it with terminal commands, but I am willing it do
it with a library or however I have to do it.
Thanks,
Mr. Gecko
--- End Message ---
--- Begin Message ---
Mr. Gecko wrote:
Hey, I built my own http server, and I'm wanting to add php to it. the
server is in Objective-C.
I know I can use terminal commands to do it, but if I was to do that how
would I get headers and stuff php sends, and how would I send php
HTTP_REMOTE_ADDRESS and stuff like that?
I would prefer doing it with terminal commands, but I am willing it do
it with a library or however I have to do it.
Thanks,
Mr. Gecko
I'd get the php source if i was you and go from there..
--- End Message ---
--- Begin Message ---
On Fri, Dec 19, 2008 at 5:58 PM, Mr. Gecko <[email protected]> wrote:
> Hey, I built my own http server, and I'm wanting to add php to it. the
> server is in Objective-C.
> I know I can use terminal commands to do it, but if I was to do that how
> would I get headers and stuff php sends, and how would I send php
> HTTP_REMOTE_ADDRESS and stuff like that?
there is a well known book, by sara golemon, extending & embedding
php<http://tinyurl.com/a75bbk>.
youll almost certainly want to grab that. there are also some nice pdf's
and articles online, mostly for writing extensions afaict. only a small
portion of the book about embedding php, but to give you a quick overview,
the most simple approach to embedding essentially boils down to including
libphp, and invoking it with a string of php & the C level eval(). the book
will get you going from there.
im sure if you know what youre doing, which if you could write a webserver
in objc, i suppose you would, should be able to get the eval-based approach
working 'pretty quickly'TM. from there you can experiment w/ the info the
book has and it would probly be good to find some smaller webserver projects
that support php, like lighttpd <http://www.lighttpd.net/download>.
lighttpd is stricly C tho, if im not mistaken, but im sure youll find some
nice example segments there.
I would prefer doing it with terminal commands, but I am willing it do it
> with a library or however I have to do it.
>
well, im not sure what you need to do, make-file-wise, to get C to compile
into an objective-C application, but i know it can be done, b/c i did it on
an iphone app where we used the C interface to sqlite3. im sure if youre
webserver is using objective-C classes, and some of its neat runtime
features, you might wind up writing some sort of OO wrapper around phps
embedding api, but thats just a guess.
btw, is this a private project or is the code out there somewhere ?
-nathan
--- End Message ---
--- Begin Message ---
Also could look at using fastcgi and would not have to embed libphp
and such.
On Dec 19, 2008, at 9:58 PM, "Nathan Nobbe" <[email protected]>
wrote:
On Fri, Dec 19, 2008 at 5:58 PM, Mr. Gecko <[email protected]>
wrote:
Hey, I built my own http server, and I'm wanting to add php to it.
the
server is in Objective-C.
I know I can use terminal commands to do it, but if I was to do
that how
would I get headers and stuff php sends, and how would I send php
HTTP_REMOTE_ADDRESS and stuff like that?
there is a well known book, by sara golemon, extending & embedding
php<http://tinyurl.com/a75bbk>.
youll almost certainly want to grab that. there are also some nice
pdf's
and articles online, mostly for writing extensions afaict. only a
small
portion of the book about embedding php, but to give you a quick
overview,
the most simple approach to embedding essentially boils down to
including
libphp, and invoking it with a string of php & the C level eval().
the book
will get you going from there.
im sure if you know what youre doing, which if you could write a
webserver
in objc, i suppose you would, should be able to get the eval-based
approach
working 'pretty quickly'TM. from there you can experiment w/ the
info the
book has and it would probly be good to find some smaller webserver
projects
that support php, like lighttpd <http://www.lighttpd.net/download>.
lighttpd is stricly C tho, if im not mistaken, but im sure youll
find some
nice example segments there.
I would prefer doing it with terminal commands, but I am willing it
do it
with a library or however I have to do it.
well, im not sure what you need to do, make-file-wise, to get C to
compile
into an objective-C application, but i know it can be done, b/c i
did it on
an iphone app where we used the C interface to sqlite3. im sure if
youre
webserver is using objective-C classes, and some of its neat runtime
features, you might wind up writing some sort of OO wrapper around
phps
embedding api, but thats just a guess.
btw, is this a private project or is the code out there somewhere ?
-nathan
--- End Message ---
--- Begin Message ---
On Fri, Dec 19, 2008 at 11:14 PM, mike <[email protected]> wrote:
> Also could look at using fastcgi and would not have to embed libphp and
> such.
actually, i think thats how lighttpd does it ;)
-nathan
--- End Message ---
--- Begin Message ---
Yep Nginx, lighttpd, Zeus it's the only way. Apache has the option
and I think a lot of people recommend it for various reasons.
I'd recommend nginx over lighttpd :)
On Dec 19, 2008, at 10:15 PM, "Nathan Nobbe" <[email protected]>
wrote:
On Fri, Dec 19, 2008 at 11:14 PM, mike <[email protected]> wrote:
Also could look at using fastcgi and would not have to embed libphp
and such.
actually, i think thats how lighttpd does it ;)
-nathan
--- End Message ---
--- Begin Message ---
Gary Maddock-Greene wrote:
Hi, is it possible to de-bug a 'no input file specified' error. I get
the error when trying to run my search script but do not know whats
causing it. Is it a common error?
PHP5 with MySQL adn IIS7
Thanks
- Gary
make a small php file called "info.php" with the following contents:
<?php
phpinfo();
?>
save it and run it through iis, if you get the same error then it's php
not being installed correctly
if it does run correctly then we'll need to let the debugging commence!
regards
--- End Message ---
--- Begin Message ---
Gary Maddock-Greene wrote:
Hi, is it possible to de-bug a 'no input file specified' error. I get
the error when trying to run my search script but do not know whats
causing it. Is it a common error?
PHP5 with MySQL adn IIS7
Thanks
- Gary
.. just did some more reading.. are you running php as a CGI app?
--- End Message ---
--- Begin Message ---
Gary Maddock-Greene wrote:
Hi, is it possible to de-bug a 'no input file specified' error. I get
the error when trying to run my search script but do not know whats
causing it. Is it a common error?
PHP5 with MySQL adn IIS7
Thanks
- Gary
.. just did some more reading.. are you running php as a CGI app?
--- End Message ---
--- Begin Message ---
hi .. info.php works fine ... php is installed and working ok. Its just this
connection to a database that throws the error.
Server API is ISAPI
I'm not sure that I'm running php as a cgi app. I was reading something that
was pointing me to that but tbh my knowledge level is very basic so I am not
sure what I am looking for. That's always a problem with trying to find or
understand a bug .. if you don't know what you should be looking at.
How can I check the cgi .. and why could this be causing the problem?
Many thanks guys
- Gary
"Nathan Rixham" <[email protected]> wrote in message
news:[email protected]...
Gary Maddock-Greene wrote:
Hi, is it possible to de-bug a 'no input file specified' error. I get the
error when trying to run my search script but do not know whats causing
it. Is it a common error?
PHP5 with MySQL adn IIS7
Thanks
- Gary
.. just did some more reading.. are you running php as a CGI app?
--- End Message ---
--- Begin Message ---
hi .. info.php works fine ... php is installed and working ok. Its just this
connection to a database that throws the error.
Server API is ISAPI
I'm not sure that I'm running php as a cgi app. I was reading something that
was pointing me to that but tbh my knowledge level is very basic so I am not
sure what I am looking for. That's always a problem with trying to find or
understand a bug .. if you don't know what you should be looking at.
How can I check the cgi .. and why could this be causing the problem?
Many thanks guys
- Gary
"Nathan Rixham" <[email protected]> wrote in message
news:[email protected]...
Gary Maddock-Greene wrote:
Hi, is it possible to de-bug a 'no input file specified' error. I get the
error when trying to run my search script but do not know whats causing
it. Is it a common error?
PHP5 with MySQL adn IIS7
Thanks
- Gary
.. just did some more reading.. are you running php as a CGI app?
--- End Message ---
--- Begin Message ---
sean greenslade schreef:
> So, I have this code in a php file called testing.php:
> $incl = '/webs/www.zootboy.com/sl/sql.inc';
> if(!is_readable($incl)) die('ERROR: MySQL Include file does not
> exist??!?');
> require $incl or die('MySQL page not found. Unable to continue.');
>
your require line is doing this:
require ($incl or die("foo");
the expression results in 1 which translates to the string "1"
which require then tries to include.
do something like:
if (!require $incl)
die("foo");
although you might consider just doing
require $incl;
and removing the is_readable() check, die()s, etc ... the script
will die anyway if the require failed.
>
> When I run the code in command line, it outputs this:
>
> [r...@localhost ~]# php -f /webs/www.zootboy.com/sl/testing.php
> PHP Warning: require(1): failed to open stream: No such file or directory
> in /webs/www.zootboy.com/sl/testing.php on line 13
> PHP Fatal error: require(): Failed opening required '1'
> (include_path='/var/php/inc/') in /webs/www.zootboy.com/sl/testing.php on
> line 13
>
> I have no idea what's going on. All the files have 777 perms.
>
--- End Message ---
--- Begin Message ---
[email protected] schreef:
> select
> first_name like '%$first_name%'
> + 3 * last_name like '%$last_name%'
> + 7 * email = '$email'
> as score,
that works?? I guess the expressions (e.g. email = '$email')
evaluate to bools and are auto-cast to ints.
Im guess there needs to be some parenthesis in there somewhere, no?
anyway nice snippet :-)
> first_name, last_name, email, person_id
> from person
> .
> .
> .
> order by score desc
> limit 10
>
>
--- End Message ---
--- Begin Message ---
Hi,
i'm reading a book about PHP and i was wondering why regular expressions are
so often used to check format of variables or emails while the function
filter exists since version 5.2.
What are the plus of regular expression while checking variable format ?
thx.
--
Alain
-----------------------------------------------------------
Windows XP x64 SP2
PostgreSQL 8.3.5 / MS SQL server 2005
Apache 2.2.10
PHP 5.2.6
C# 2005-2008
--- End Message ---