php-general Digest 1 Mar 2010 23:21:09 -0000 Issue 6616
Topics (messages 302435 through 302461):
Re: inexplicable behaviour of pre- and post-increment operators
302435 by: Martin Zvarík
Re: Header function
302436 by: Ashley Sheridan
Re: Uninstalling PHP?
302437 by: Jochem Maas
Re: Excel Spreadsheets and PHP
302438 by: Andrew Ballard
Generating end user documentation for SOAP services.
302439 by: Richard Quadling
Custom php extension
302440 by: liveq
302441 by: liveq
When to use namespaces
302442 by: Auke van Slooten
302443 by: Ashley Sheridan
302445 by: Richard Quadling
302455 by: tedd
302456 by: Adam Richardson
how to download files require login
302444 by: Ryan Sun
302447 by: Ashley Sheridan
302448 by: Richard Quadling
session.entropy_file and hostname
302446 by: Sascha Wojewsky
Going from IIS6 to WAMP
302449 by: David Stoltz
302450 by: Robert Cummings
302451 by: David Stoltz
302452 by: Ashley Sheridan
302453 by: Jim Lucas
mysqli_connect problem
302454 by: Thomas H. George
302457 by: John Black
Best Practices Book, Document, Web Site?
302458 by: Hansen, Mike
302459 by: Shawn McKenzie
Is there a way to get PHP to release this file?
302460 by: Andrew Ballard
302461 by: Shawn McKenzie
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 ---
Mess
Dne 27.2.2010 5:01, [email protected] napsal(a):
A week ago Dasn asked a question about converting arrays, and I quoted one
possible way of
achieving his task, using the operation:
$i = 0; while ($i< $k) { $b[$a[$i++]] = $a[$i++]; }
I added the comment that "I have always been wary of using statements like this
because I
was unsure when the incrementing would occur, so I tried it."
I received several CC e-mails replying to this post, including one rather
critical comment
to the effect that pre-and post-increment were all quite simple, and I really
ought to
learn the fundamentals before I started trying to do anything elaborate.
I posted a reply to these e-mails, but as neither they, nor my reply, or any
follow-up
discussion ever appeared in the discussion group I will repost this reply. (I
did have a
power failure at this time, so it is conceivable that any follow-up was lost as
a result
of a glitch in my mailer, but I think it is more likely that there was a glitch
in the
discussion group server.)
Unfortunately things aren't nearly as simple as this writer believes. The rule
I have
always used is that if you use the same variable as an index on both sides of
an assign
statement it is not safe to change the value of the index within the statement.
While I
have achieved the result I wanted in the example above (using PHP 5.1.6 --
there is no
guarantee it would work with other implementations of PHP) the results of doing
this in
the general case can be quite inexplicable.
The particular case which prompted my comment was the one where you want to
copy part of
one array into the corresponding elements of another array. In accordance with
my rule, I
normally write:
$i = 0; $j=count($a); while ($i< $j) { $b[$i] = $a[$i]; ++$i; }
It is tempting to try to put the increment into the assignment statement.
Clearly the
value of $a[$i] has to be read before it can be written to $b[$i], so the
logical
expression would be:
while ($i< $j) { $b[$i++] = $a[$i]; } A.
However if you try this, you get $b[1] = $a[0], and so on. But if you try the
alternative:
while ($i< $j) { $b[$i] = $a[$i++]; } B.
You get $b[0] = $a[1], and so on (as you would expect).
Out of curiosity, I then tried:
$i = -1; $j=count($a) - 1; while ($i< $j) { $b[$i] = $a[++$i]; } C
This gave the desired result, and seemed moderately logical. However when I
tried:
$i = -1; $j=count($a) - 1; while ($i< $j) { $b[++$i] = $a[$i]; } D
This gave exactly the same result. It is quite impossible to explain the
results in cases
A and D from the definitions of the pre-and post-increment operator, so I think
I will
stick to my safe rule!
--- End Message ---
--- Begin Message ---
On Mon, 2010-03-01 at 12:14 +0100, Kim Madsen wrote:
> Ashley Sheridan wrote on 01/03/2010 07:13:
>
> > The HTTP header doesn't treat quoteation marks in the same way that PHP
> > does. It needs double quote marks to function correctly.
>
> How do you mean? And do you have a link to this information?
>
> Even if this is true, then the first Nick did should still be correct?
>
> header('Content-Disposition: attachment; filename="PurchaseReq.doc"');
>
> I'm using the same headers for downloads, allthough I use double qoutes
> for the header function aswell:
>
> header("Content-Disposition: attachment; filename=\"artist - title.mp3\"");
>
> --
> Kind regards
> Kim Emax - masterminds.dk
>
I only meant for the quotes around the filename. I'd tried
header("Content-Disposition: attachment; filename='artist -
title.mp3'");
before and it didn't work correctly. I hadn't run into the problem of
double quotes inside singe though, as the filenames I was generating
relied on a variable, and I found it easier to just escape the second
set of nested quotes and include the variable directly.
As far as I'm aware, the header() function shouldn't care whether it
uses single or double quotes, so I would assume it's something else
amiss.
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
Op 2/28/10 12:08 AM, Austin Powers schreef:
> ""Austin Powers"" <[email protected]> wrote in message
> news:[email protected]...
>> Three weeks ago I was working through the Lynda.com "PHP with MySQL
>> Training" because I wanted to begin using PHP (surprise, surprise).
>>
>> Anyway, on this video course the teacher explains that because installing
>> PHP and MySQL is so well understood on a Mac that we may as well just
>> follow
>> his steps and do it manually. Well, he is installing a different version
>> of
>> PHP and MySQL to the ones that I was able to download and while what he
>> was
>> saying way somewhat similar I am guessing that there is a difference
>> somewhere, and (well) it's not working.
>>
>> I AM A COMPLETE NOVICE WITH LINUX/FREEBSD. It had not been my intention
>> to
>> learn the intricacies of Linux. However, I am now neck deep in a mire of
>> confusion that even MAMP can't seem to sort out for me.
>>
>> It is purely a guess that I need to start again from a complete clean
>> setup
>> (reformatting my hard disk and reinstall OS X again) but that is pretty
>> much
>> out of the question.
>>
>> I guess my question is:
>>
>> "How can I completely uninstall PHP so that I can start again?"
>>
>> Thanks.
>>
>
>
> I did a:
>
> find / -name 'apachectl' 2. /dev/null
>
> and it came back with:
>
> /usr/sbin/apachectl
> /Applications/MAMP/Library/bin/apachectl
Mac OS X has an install of apache by default, the control script for that
is:
/usr/sbin/apachectl
if your installing MAMP (or a custom setup) you'll want to deactivate the
default
installation ... go to System Preferences > Sharing then turn off "Web Sharing"
if you want to deinstall MAMP there should be a deinstaller program in
/Application/MAMP,
once you've run that you can just delete that whole directory. then you can try
to install
again by mounting the MAMP .dmg file and running the installer.
>
> so I do:
>
> cd /Application/MAMP/Library/bin
>
> and then:
>
> ./apachectl graceful
>
> and it came back with:
>
> httpd not running, trying to start
> (13) permission denied: make_sock: could not bind to address {::]:80
> (13 permission denied: make_sock: could not bind to address 0.0.0.0:80
> no listening sockets available, shutting down
> Unable to open logs
this is a permissions thing - you need to run the command using sudo (as
explained in
another post)
>
> Does this mean that httpd is not running, and that I need to make some
> change to the httpd.conf file? If so, then what changes do I need to make?
>
>
>
--- End Message ---
--- Begin Message ---
On Fri, Feb 26, 2010 at 3:47 PM, Ian Robertson
<[email protected]> wrote:
> Thank you all very much for your replies.
>
> I learned about a few new approaches.
>
> I didn't see it come up yet, so I'll post the URL of what I have been using.
>
> php_writeexcel -
> http://www.bettina-attack.de/jonny/view.php/projects/php_writeexcel/
>
> I've been able to pull off quite a bit with this class and actually have
> referenced this Perl page for documentation since this PHP class was ported
> from a Perl class -
> http://cpansearch.perl.org/src/JMCNAMARA/Spreadsheet-WriteExcel-0.37/WriteExcel/doc/WriteExcel.html
>
Another option just occurred to me. You can attach to and read/write
to Excel sheets using an ODBC client. As long as you are building a
sheet/workbook with strictly tabular data, that should allow you to
issue SQL commands. I'm not sure whether you can create an Excel file
from scratch that way, but if not it would be trivial to have an empty
Excel file that you can use as a template.
Andrew
--- End Message ---
--- Begin Message ---
Hi.
I've got a webservice using Zend_Soap_Server (along with AutoDiscover
and WSDL from the Zend Framework).
I used DocBlocks to describe my code and I can happily produce the
developer level documentation for the classes (55 classes dealing with
authentication, supplying data and versioning).
I would like to be able to produce end-user documentation which is
pretty limited in scope as it only needs to document the calls/methods
that they can make via SOAP and not to show the internal workings
(which is what my developer level documentation is showing). I'd like
to be able to generate the documentation automatically (like
phpdocumentor).
So, can I build documentation from a WSDL file?
The WSDL file contains <documentation> tags. I'd like to be able to
add documentation to the complex types (not sure that is possible via
WSDL).
Ideas, suggestions, links, experience, etc. would be gratefully received.
Regards,
Richard Quadling.
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
--- End Message ---
--- Begin Message ---
Hello,
I've written a small extension, which helps me to debug weird code
behaviour in my framework. Anyway I want to improve it, and i'm stuck. I
need to get some informations about request in PHP_RINIT_FUNCTION and in
PHP_MSHUTDOWN_FUNCTION. I need to get info from _SERVER , _GET and _POST
arrays, but i'm unable to do it. Every result of use
PG(http_globals)[TRACK_VARS_SERVER] or on get/post is just NULL in
zend_print_zval_r (). Any suggestions how to do it?
Another question. My extension checks some php.ini settings, and if they
are set in wrong way ( register globals, safe mode, etc. ) I want to
kill execution of script with message "bad ini settings" ( or something
like that ), AND this also should occures in RINIT or MSHUTDOWN.
I'll be very appreciate for any help.
Best,
KA.
--- End Message ---
--- Begin Message ---
Hello,
I've written a small extension, which helps me to debug weird code
behaviour in my framework. Anyway I want to improve it, and i'm stuck. I
need to get some informations about request in PHP_RINIT_FUNCTION and in
PHP_MSHUTDOWN_FUNCTION. I need to get info from _SERVER , _GET and _POST
arrays, but i'm unable to do it. Every result of use
PG(http_globals)[TRACK_VARS_SERVER] or on get/post is just NULL in
zend_print_zval_r (). Any suggestions how to do it?
Another question. My extension checks some php.ini settings, and if they
are set in wrong way ( register globals, safe mode, etc. ) I want to
kill execution of script with message "bad ini settings" ( or something
like that ), AND this also should occures in RINIT or MSHUTDOWN.
I'll be very appreciate for any help.
Best,
KA.
--- End Message ---
--- Begin Message ---
Hi everyone,
I'm doing a small hobby project to better my understanding of php5,
specifically php5.3 and I'm wondering when a namespaced project is
better and when it is better to simply use a prefix to all class names.
I've been trying to get a feeling for what is considered the best
practice, but most of the pages dealing with namespaces start with the
assumption that you are building a complex application with lots of
modules and say things like:
Namespaces should be all lowercase and must follow the following conention:
<vendor>\<package_name>\
(thats from the php.standards mailing list btw)
In my case the project is a single module, single php file, with about 6
classes. It is an OO wrapper for PHP's xmlrpc methods (client and
server) and meant to be used in a number of different projects.
Is it considered a good idea to use a namespace in such a case? And if
so, what should that be? I've named the project 'ripcord', and used that
as a namespace as well. I could probably name it 'muze.ripcord', but
somehow that feels less 'open' to me.
Thanks in advance for any thoughts,
Auke van Slooten
Muze (www.muze.nl)
PS. The project is at http://code.google.com/p/ripcord/, the PHP5.3
version is at
http://code.google.com/p/ripcord/source/browse/#svn/branches/php5.3
--- End Message ---
--- Begin Message ---
On Mon, 2010-03-01 at 17:14 +0100, Auke van Slooten wrote:
> Hi everyone,
>
> I'm doing a small hobby project to better my understanding of php5,
> specifically php5.3 and I'm wondering when a namespaced project is
> better and when it is better to simply use a prefix to all class names.
>
> I've been trying to get a feeling for what is considered the best
> practice, but most of the pages dealing with namespaces start with the
> assumption that you are building a complex application with lots of
> modules and say things like:
>
> Namespaces should be all lowercase and must follow the following conention:
> <vendor>\<package_name>\
>
> (thats from the php.standards mailing list btw)
>
> In my case the project is a single module, single php file, with about 6
> classes. It is an OO wrapper for PHP's xmlrpc methods (client and
> server) and meant to be used in a number of different projects.
>
> Is it considered a good idea to use a namespace in such a case? And if
> so, what should that be? I've named the project 'ripcord', and used that
> as a namespace as well. I could probably name it 'muze.ripcord', but
> somehow that feels less 'open' to me.
>
> Thanks in advance for any thoughts,
> Auke van Slooten
> Muze (www.muze.nl)
>
> PS. The project is at http://code.google.com/p/ripcord/, the PHP5.3
> version is at
> http://code.google.com/p/ripcord/source/browse/#svn/branches/php5.3
>
To me, namespaces are primarily to avoid clashes with other classes of
the same name. I guess if your class has a really distinctive name, then
namespaces might be less important. If your class had a more generic
type of name then you should use namespaces to avoid collisions.
Having said that, by using namespaces, you do limit your app to
installations of PHP to that of >=5.3.0. Some shared hosting solutions
may not offer 5.3.0 (and I know one that still favours php 4!) so it may
be that using another mechanism for avoiding class name collision might
be better in the short term.
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
On 1 March 2010 16:14, Auke van Slooten <[email protected]> wrote:
> Hi everyone,
>
> I'm doing a small hobby project to better my understanding of php5,
> specifically php5.3 and I'm wondering when a namespaced project is better
> and when it is better to simply use a prefix to all class names.
>
> I've been trying to get a feeling for what is considered the best practice,
> but most of the pages dealing with namespaces start with the assumption that
> you are building a complex application with lots of modules and say things
> like:
>
> Namespaces should be all lowercase and must follow the following conention:
> <vendor>\<package_name>\
>
> (thats from the php.standards mailing list btw)
>
> In my case the project is a single module, single php file, with about 6
> classes. It is an OO wrapper for PHP's xmlrpc methods (client and server)
> and meant to be used in a number of different projects.
>
> Is it considered a good idea to use a namespace in such a case? And if so,
> what should that be? I've named the project 'ripcord', and used that as a
> namespace as well. I could probably name it 'muze.ripcord', but somehow that
> feels less 'open' to me.
>
> Thanks in advance for any thoughts,
> Auke van Slooten
> Muze (www.muze.nl)
>
> PS. The project is at http://code.google.com/p/ripcord/, the PHP5.3 version
> is at http://code.google.com/p/ripcord/source/browse/#svn/branches/php5.3
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
If you are intending to document your code using DocBlocks and then
build a manual using phpDocumentor, then the current version of
phpDocumentor does NOT support namespaces.
Add to that the 5.3.0+ issue, then maybe sensible prefixes may be the
easier choice for the time being.
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
--- End Message ---
--- Begin Message ---
At 5:14 PM +0100 3/1/10, Auke van Slooten wrote:
Hi everyone,
I'm doing a small hobby project to better my understanding of php5,
specifically php5.3 and I'm wondering when a namespaced project is
better and when it is better to simply use a prefix to all class
names.
I've been trying to get a feeling for what is considered the best
practice, but most of the pages dealing with namespaces start with
the assumption that you are building a complex application with lots
of modules and say things like:
Namespaces should be all lowercase and must follow the following conention:
<vendor>\<package_name>\
(thats from the php.standards mailing list btw)
In my case the project is a single module, single php file, with
about 6 classes. It is an OO wrapper for PHP's xmlrpc methods
(client and server) and meant to be used in a number of different
projects.
Is it considered a good idea to use a namespace in such a case? And
if so, what should that be? I've named the project 'ripcord', and
used that as a namespace as well. I could probably name it
'muze.ripcord', but somehow that feels less 'open' to me.
Thanks in advance for any thoughts,
Auke van Slooten
Muze (www.muze.nl)
Tie it to your url, such as:
ripcord.muze.nl
That would be sufficient and unique as a namespace under your control.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
I use namespaces within my web framework because the framework takes a more
functional approach (no objects are created within the framework other than
from existing classes such as PDO or Exception, immutability is promoted,
etc.), and in this context, the namespaces felt quite natural for breaking
up the various groupings of functions.
My framework does require PHP 5.3, and, honestly that has caused some pain
in some situations to get that supported.
However, using namespaces does offer some flexibility that naming
conventions can't. If the objects in your framework make use of frequent
static method calls, maybe it's worth it. For instance, if you've used the
naming convention, you might have to call a static method like below:
App_Util_DB_Query::Insert();
Namespaces allow you to shorten subsequent calls, such as:
use App\Util\DB\Query as Query;
Query::Insert();
Just a quick couple thoughts on the decision. Both have their strengths :)
Adam
On Mon, Mar 1, 2010 at 11:14 AM, Auke van Slooten <[email protected]> wrote:
> Hi everyone,
>
> I'm doing a small hobby project to better my understanding of php5,
> specifically php5.3 and I'm wondering when a namespaced project is better
> and when it is better to simply use a prefix to all class names.
>
> I've been trying to get a feeling for what is considered the best practice,
> but most of the pages dealing with namespaces start with the assumption that
> you are building a complex application with lots of modules and say things
> like:
>
> Namespaces should be all lowercase and must follow the following conention:
> <vendor>\<package_name>\
>
> (thats from the php.standards mailing list btw)
>
> In my case the project is a single module, single php file, with about 6
> classes. It is an OO wrapper for PHP's xmlrpc methods (client and server)
> and meant to be used in a number of different projects.
>
> Is it considered a good idea to use a namespace in such a case? And if so,
> what should that be? I've named the project 'ripcord', and used that as a
> namespace as well. I could probably name it 'muze.ripcord', but somehow that
> feels less 'open' to me.
>
> Thanks in advance for any thoughts,
> Auke van Slooten
> Muze (www.muze.nl)
>
> PS. The project is at http://code.google.com/p/ripcord/, the PHP5.3
> version is at
> http://code.google.com/p/ripcord/source/browse/#svn/branches/php5.3
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Nephtali: PHP web framework that functions beautifully
http://nephtaliproject.com
--- End Message ---
--- Begin Message ---
For URLs like
'http://download.fotolia.com/DownloadContent/1/h7G0bWGsGof8VvSqw32xFZ0KvD5eqbvN',
it requires user login to download.
Then how do I download it remotely via php server if I have the
username and password in hand?
--- End Message ---
--- Begin Message ---
On Mon, 2010-03-01 at 11:37 -0500, Ryan Sun wrote:
> For URLs like
> 'http://download.fotolia.com/DownloadContent/1/h7G0bWGsGof8VvSqw32xFZ0KvD5eqbvN',
> it requires user login to download.
> Then how do I download it remotely via php server if I have the
> username and password in hand?
>
This is a job for Curl. You create a Curl request that sends the login
information to the remote site in the form that it expects (usually via
some sort of post data from a form) and then you can receive the reply
back. You can then form your requests that you need to make for the
rest.
There are some great add-ons for Firefox for this sort of thing, to look
at what data is being sent to and from your browser.
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
On 1 March 2010 17:00, Ashley Sheridan <[email protected]> wrote:
> On Mon, 2010-03-01 at 11:37 -0500, Ryan Sun wrote:
>
>> For URLs like
>> 'http://download.fotolia.com/DownloadContent/1/h7G0bWGsGof8VvSqw32xFZ0KvD5eqbvN',
>> it requires user login to download.
>> Then how do I download it remotely via php server if I have the
>> username and password in hand?
>>
>
>
> This is a job for Curl. You create a Curl request that sends the login
> information to the remote site in the form that it expects (usually via
> some sort of post data from a form) and then you can receive the reply
> back. You can then form your requests that you need to make for the
> rest.
>
> There are some great add-ons for Firefox for this sort of thing, to look
> at what data is being sent to and from your browser.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
If the authentication style is basic you COULD use the
http://username:[email protected]/page.xxxxxx
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
--- End Message ---
--- Begin Message ---
Hi,
i'm new to this list...
Is it possible to set the session.entropy_file to /bin/hostname (or
something like this)?
I've to user server-unique SessionIDs...
Thanks
Sascha
--- End Message ---
--- Begin Message ---
Hi All,
I have a working application in PHP 5.3 under IIS6. I've created a WAMP server
(Windows, Apache, MySQL, PHP) on a dedicated server, and I'm trying to move the
application to the new, dedicated server.
My first problem, the new server doesn't like this line of code in the
default.php:
<?php include('force_ssl.php');?>
(It works fine on the current server)
If I remove the above line, the page shows fine. If the line is there, the page
cannot be displayed (not sure how to make it show the actual error, since error
logging is on, and error_reporting = E_ALL)
In the Apache httpd.conf file, I have the following:
<Directory "c:/wamp/www/myapplicationfolder">
DirectoryIndex default.php
Options FollowSymLinks Includes
Allow from all
</Directory>
I'm assuming this allows "includes"....
Does anyone have any idea?
--- End Message ---
--- Begin Message ---
What does it do? Force the connection to https? if so you need to
configure Apache to serve over https.
David Stoltz wrote:
Hi All,
I have a working application in PHP 5.3 under IIS6. I've created a WAMP server
(Windows, Apache, MySQL, PHP) on a dedicated server, and I'm trying to move the
application to the new, dedicated server.
My first problem, the new server doesn't like this line of code in the
default.php:
<?php include('force_ssl.php');?>
(It works fine on the current server)
If I remove the above line, the page shows fine. If the line is there, the page
cannot be displayed (not sure how to make it show the actual error, since error
logging is on, and error_reporting = E_ALL)
In the Apache httpd.conf file, I have the following:
<Directory "c:/wamp/www/myapplicationfolder">
DirectoryIndex default.php
Options FollowSymLinks Includes
Allow from all
</Directory>
I'm assuming this allows "includes"....
Does anyone have any idea?
--
http://www.interjinn.com
Application and Templating Framework for PHP
--- End Message ---
--- Begin Message ---
Even if I comment out what's in the include file, it still errors.
It's the actual "include" statement causing the error, not what's in it....
-----Original Message-----
From: Robert Cummings [mailto:[email protected]]
Sent: Monday, March 01, 2010 1:33 PM
To: David Stoltz
Cc: [email protected]
Subject: Re: [PHP] Going from IIS6 to WAMP
What does it do? Force the connection to https? if so you need to
configure Apache to serve over https.
David Stoltz wrote:
> Hi All,
>
> I have a working application in PHP 5.3 under IIS6. I've created a WAMP
> server (Windows, Apache, MySQL, PHP) on a dedicated server, and I'm trying to
> move the application to the new, dedicated server.
>
> My first problem, the new server doesn't like this line of code in the
> default.php:
> <?php include('force_ssl.php');?>
>
> (It works fine on the current server)
>
> If I remove the above line, the page shows fine. If the line is there, the
> page cannot be displayed (not sure how to make it show the actual error,
> since error logging is on, and error_reporting = E_ALL)
>
> In the Apache httpd.conf file, I have the following:
> <Directory "c:/wamp/www/myapplicationfolder">
> DirectoryIndex default.php
> Options FollowSymLinks Includes
> Allow from all
> </Directory>
>
> I'm assuming this allows "includes"....
>
> Does anyone have any idea?
--
http://www.interjinn.com
Application and Templating Framework for PHP
--- End Message ---
--- Begin Message ---
On Mon, 2010-03-01 at 13:37 -0500, David Stoltz wrote:
> Even if I comment out what's in the include file, it still errors.
>
> It's the actual "include" statement causing the error, not what's in it....
>
>
> -----Original Message-----
> From: Robert Cummings [mailto:[email protected]]
> Sent: Monday, March 01, 2010 1:33 PM
> To: David Stoltz
> Cc: [email protected]
> Subject: Re: [PHP] Going from IIS6 to WAMP
>
> What does it do? Force the connection to https? if so you need to
> configure Apache to serve over https.
>
>
>
>
> David Stoltz wrote:
> > Hi All,
> >
> > I have a working application in PHP 5.3 under IIS6. I've created a WAMP
> > server (Windows, Apache, MySQL, PHP) on a dedicated server, and I'm trying
> > to move the application to the new, dedicated server.
> >
> > My first problem, the new server doesn't like this line of code in the
> > default.php:
> > <?php include('force_ssl.php');?>
> >
> > (It works fine on the current server)
> >
> > If I remove the above line, the page shows fine. If the line is there, the
> > page cannot be displayed (not sure how to make it show the actual error,
> > since error logging is on, and error_reporting = E_ALL)
> >
> > In the Apache httpd.conf file, I have the following:
> > <Directory "c:/wamp/www/myapplicationfolder">
> > DirectoryIndex default.php
> > Options FollowSymLinks Includes
> > Allow from all
> > </Directory>
> >
> > I'm assuming this allows "includes"....
> >
> > Does anyone have any idea?
>
The only error that the include statement could cause would be if the
server couldn't find the path to the file you were referencing, so it's
more likely to be an error with the contents of the include. Have you
checked your error logs? You can find out where these are by running a
phpinfo() script.
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
David Stoltz wrote:
> Hi All,
>
> I have a working application in PHP 5.3 under IIS6. I've created a WAMP
> server (Windows, Apache, MySQL, PHP) on a dedicated server, and I'm trying to
> move the application to the new, dedicated server.
>
> My first problem, the new server doesn't like this line of code in the
> default.php:
> <?php include('force_ssl.php');?>
>
> (It works fine on the current server)
>
> If I remove the above line, the page shows fine. If the line is there, the
> page cannot be displayed (not sure how to make it show the actual error,
> since error logging is on, and error_reporting = E_ALL)
>
> In the Apache httpd.conf file, I have the following:
> <Directory "c:/wamp/www/myapplicationfolder">
> DirectoryIndex default.php
> Options FollowSymLinks Includes
> Allow from all
> </Directory>
>
> I'm assuming this allows "includes"....
>
> Does anyone have any idea?
First off, please start a new message instead of taking someones message
changing the subject and "trying" to call it your own.
Besides that...
Sounds like you have an include issue.
On the WAMP setup, modify your php.ini file so it will display_errors = on and
error_reporting = E_ALL
restart apache and you will see any errors that are being generated.
The directory block that you are showing us has nothing to do with PHP's include
process. The only thing that it does it set the DirectoryIndex to use
default.php instead of the index.htm, index.html, or index.php
Basically, with PHP, you need to make sure that anything you include is actually
in your include path. Check that and let us know what you find.
--
Jim Lucas
NOC Manager
541-323-9113
BendTel, Inc.
http://www.bendtel.com
--- End Message ---
--- Begin Message ---
I am a newbie. The following script works but the second one (below)
loads the variables from an html form and then fails. The connection
commands in the second sript are identical as the first script was copied
from the first. Only the variable values have been changed.
#!/usr/bin/php
#
<?php
$first_name = 'Harry';
$last_name = 'Potter';
$when_it_happened = 'This morning';
$how_long = '6 ms';
$how_many = 'millions';
$alien_description = 'angels';
$what_they_did = 'danced on the head of a pin';
$fang_spotted = 'No';
$other = 'There were bright flashing lights';
$email = '[email protected]';
$dbc = mysqli_connect('localhost', 'tom', 'fog^horn9', 'aliendatabase')
or die('Error connecting to MySQL server');
$query = "INSERT INTO aliens_abduction (first_name, last_name,
when_it_happened, how_long, " .
"how_many, alien_description, what_they_did, fang_spotted,
other, email) " .
"VALUES ('$first_name', '$last_name', '$when_it_happened',
'$how_long', '$how_many', " .
"'$alien_description', '$what_they_did', '$fang_spotted',
'$other', '$email')";
$result = mysqli_query($dbc,$query)
or die('Error Querying the database');
mysqli_close($dbc);
?>
The following program successfully loads the variables from an html form
and then fails.
<?php
$first_name = $_POST['firstname'];
$last_name = $_POST['lastname'];
$when_it_happened = $_POST['whenithappened'];
$how_long =$_POST['howlong'];
$how_many = $_POST['howmany'];
$alien_description = $_POST['aliendescription'];
$what_they_did = $_POST['whattheydid'];
$fang_spotted = $_POST['fangspotted'];
$other = $_POST['other'];
$email = $_POST['email'];
echo 'got to here, ';
echo "$last_name\n\n";
$dbc = mysqli_connect('localhost', 'tom', 'fog^horn9', 'aliendatabase')
or die('Error connecting to MySQL server');
$query = "INSERT INTO aliens_abduction (first_name, last_name,
when_it_happened, how_long, " .
"how_many, alien_description, what_they_did, fang_spotted,
other, email) " .
"VALUES ('$first_name', '$last_name', '$when_it_happened',
'$how_long', '$how_many', " .
"'$alien_description', '$what_they_did', '$fang_spotted',
'$other', '$email')";
$result = mysqli_query($dbc,$query)
or die('Error Querying the database');
mysqli_close($dbc);
?>
The echo entries confirm the variables a have been loaded from an html
form. The program just stops after the echo entries - no die message,
nothing in /var/log/mysql.err or mysql.log.
My system is Debian Squeeze, 64 bit. I have php5 version 5.3.1-5, php5-mysql
version 5.3.1-5, mysql-client-5 and mysql-server-5 version 5.1.41-3 installed.
Any suggestions?
Tom
--- End Message ---
--- Begin Message ---
On 03/01/2010 07:54 PM, Thomas H. George wrote:
<?php ...
$alien_description = $_POST['aliendescription'];
$what_they_did = $_POST['whattheydid'];
$email = $_POST['email'];
...
$query = "INSERT INTO aliens_abduction (first_name, last_name,
when_it_happened, how_long, " .
"how_many, alien_description, what_they_did, fang_spotted, other,
email) " .
"VALUES ('$first_name', '$last_name', '$when_it_happened',
'$how_long', '$how_many', " .
"'$alien_description', '$what_they_did', '$fang_spotted', '$other',
'$email')";
Any suggestions?
Tom
Yes I have one. Whatever book you are using, burn it then shoot it!
Without looking at the query, it is most likely failing because you are
inserting un-escaped data into your database.
So when you enter something like: Goa'uld into your alien database then
it will fail because you have an unescaped control character.
This code, when freely accessible, will ensure that your database will
be compromised quickly. Search for SQL Injection on Google.
Unfortunately I can not recommend a good beginners guide since most of
the ones I have seen teach this kind of stuff but hopefully someone else
on this list can.
BTW, you can do your mysql connection this way and get the error
returned plus the SQL query.
mysqli_query($link, $sql) or die("<p>$sql</p>".mysqli_error($link));
--
John
Gerechtigkeit entspringt dem Neid; denn ihr oberster Grundsatz ist:
Allen das Gleiche.
[Walther Rathenau]
--- End Message ---
--- Begin Message ---
Is there a PHP Best Practices Book, Document, or web site that has information
similar to Perl Best Practices but for PHP?
--- End Message ---
--- Begin Message ---
Hansen, Mike wrote:
> Is there a PHP Best Practices Book, Document, or web site that has
> information similar to Perl Best Practices but for PHP?
>
I'm not familiar with the Perl one, so I don't know specifically what
you mean, but there are many "coding standards". Probably the Zend one
would be the closest:
http://framework.zend.com/manual/1.10/en/coding-standard.overview.html
--
Thanks!
-Shawn
http://www.spidean.com
--- End Message ---
--- Begin Message ---
I am editing a data file via ODBC, and would like to be able to
download the updated file in the same transaction when finished. It
seems, however, that even after calling odbc_close(), PHP still
retains a lock on the file for the duration of the request. Is there a
way to get PHP to release the file? (Ideally, I'd prefer to work in
memory and/or streams altogether rather than saving the changes to a
file, but I'm not sure that's possible with odbc_connect.) I guess if
I have to I can issue a redirect to a second process that would
download the file, but I'd prefer having to pass a one-time URL to the
browser where it will end up in the history.
Andrew
--- End Message ---
--- Begin Message ---
Andrew Ballard wrote:
> I am editing a data file via ODBC, and would like to be able to
> download the updated file in the same transaction when finished. It
> seems, however, that even after calling odbc_close(), PHP still
> retains a lock on the file for the duration of the request. Is there a
> way to get PHP to release the file? (Ideally, I'd prefer to work in
> memory and/or streams altogether rather than saving the changes to a
> file, but I'm not sure that's possible with odbc_connect.) I guess if
> I have to I can issue a redirect to a second process that would
> download the file, but I'd prefer having to pass a one-time URL to the
> browser where it will end up in the history.
>
> Andrew
I would redirect back to the same script and use a get parameter or a
session var and an if to tell if you should update the file or download it.
--
Thanks!
-Shawn
http://www.spidean.com
--- End Message ---