Best Practices For Bundling PHP Runtime Libs?
My company makes a tool which generates (among other things) PHP
client-side bindings to WebServices. We have also implemented a
collection of PHP-code required by these bindings ("runtime
libraries"). Our tool creates a file containing the PHP-bindings, but
the runtime libraries should also be placed somewhere where it will be
picked up by the PHP-engine.
Is there a common/standard way or to do this in the PHP-community? I do
not like the idea of installing the runtime libraries in system-folders
or something like that. Would someone offer their recommendations?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
OS X Install Can't See Libs In /sw
I've installed several libraries required by PHP5 using Fink but when I specify '=/sw' or '=/sw/lib' in 'configure' PHP claims the libs don't exist. I have my PATH environment setup correctly too.
Wrao C Libs On Php
Is it possible to use C libraries under PHP? I'm pretty sure I can't (otherwise there would be no PHP-GTK+ right) but perhaps someboby knows a dirty hack for it.
Runtime Validation
I wana do some runtime validation. For example, i have a form with some check boxes. like : Select Toys Cat: Airoplanes checkbox1, Cars checkbox2 if someone checks airoplanes then all different types of airoplanes names should come in a multiple selection listbox below in the following format. Suppose: Selected toys : fighter plane resuce plane passenger plane etc..... Any idea! How can i do this thing. If this thing was to be done in a software like Vb.net etc then it was a piece of cake, i m wondering how can i do such thing in php?
PHP Best Practices
I have a basic design question, in terms of what is "better" programming. I have a web site, and am using php pages as includes. some of the php pages have php tags, and "echo" or "print" the php variables and html. Like this: <div id="body"> <?php include("phpincludes/server-nav.php"); ?> </div> the php page has code like this: <div id="header"> <ul> <li class="tab" <?php if ($thisPage=="Home") echo " id="currentpage""; ?>> <a href="http://abf966/LBA/index.php">Home</a> </li> <li class="tab" <?php if ($thisPage=="Introduction") echo " id="currentpage""; ?>> <a href="http://abf966/LBA/intro.php">Introduction</a></li... etc
Some PHP Best Practices
I'm starting a new project, and I was wondering what is considered best practise in the following cases: * Connecting to multiple databases using the PEAR library. * Triggering your archive script from within the project without cron on the server It doesn't looks right to start archiving each time a user visits a page. * Providing some sort of login authorization over XML-RPC. If you work on a user-based permissions site, how do you continue that to XML-RPC.
Compile Time -vs- Runtime?
Just curious and I haven't really seen anything about this anywhere. Is there an explanation of the stages PHP goes through in compiling -vs- parsing a PHP script? google resulted in lots of pages about how to compile PHP itself, but couldn't find anything about the stages of php "compilation" If I do a require_once("somefile.php"); does somefile.php get loaded and parsed once for each web request? (Guess I'm wondering what PHP's equivelant of perl's 'use' is) Is there some way one could do this (psuedo code): // This would run ONLY once during (or just after) the file is parsed. // it would not run on each web request, but it's variables are usable // across multiple requests. perhaps things like $_SERVER and // $_POST/$_GET wouldn't be available (or usable) // compile_time: { $conf = parse_ini_file(); $doc = parse_xml_document(); $obj = new Expensive_Object(); // Other "expensive" things. require_once,_no_really_this_time("some_library.php"); } Now share $conf, $doc, $obj and other variables with each web request. The big question is the require_once() stuff.
Edit All_url_fopen In Runtime
Currently in PHP, you cannot use ini_set() to edit allow_url_fopen during runtime. Has anyone found a workaround or has any other ideas so that I can use fopen() and file_get_contents() on a file hosted somewhere else?
Setting Php.ini Vars During Runtime
im a little unsure of how todo the following and where to place the code... a) set the max execution time for a script b) the max uploaded file size How do I set these via run time, what code should I use. Secondly, do I just bung them at the top of my script?
How To Remove Blanks At Runtime??
Is there any way to remove automatically all blank chars from the html sent to the client?? Example: ---------------------------------------------------------------- <? echo "HTML tags here<br>" ; ?> more HTML here <div> <div> Some text </div> </div> <? ---------------------------------------------------------------- after running this php script the client should receive: ---------------------------------------------------------------- HTML tags here<br> more HTML here <div> <div> Some text </div> </div> ----------------------------------------------------------------
General OOP Practices..
I'm newer to the OOP in php world, but my questions revolve around good practices when programming OO in PHP rather than can this be done. So, I have a class with 7 functions in it, and I set in my constructor 7 variables. Is it better to pass the variables as needed through the functions for example:
Bad PHP Coding Practices?
I'm just wondering what are some bad (inefficient / resource intensive) PHP coding practices. For example, in Visual Basic string concatenation in a loop can really slow things down since a new string is created each time. Object creation has overhead and only so many objects can be created before it bogs down. Any significant problems with $a .= $a + "text" or objects in PHP? Any other bottlenecks?
Best Practices - GUI Standards
I hope this is on topic this looks like a pretty generic PHP group. If not I'm a nooB so be gentle. Question: Could anyone recommend a "best practice" for maintaining commonality of what the user sees on a medium scale PHP application? For example: button size, color, font, alignment, labels, etc. My intent is to build an application that has been pre-designed in phases, piece by piece and outsource most of the coding. There must be a common look and feel. Is there a better way then me simply listing them out? Ex: all buttons are 10px by 20px, all font arial 10pt, etc.
Programming Practices
Which are considered to be the best programming practices? for example i prefer to not store sessions into files (as done by default by php), but in a database as this gives me the possibility to use the same session on multiple servers, this is possible because of the session_set_save_handler() function! So which do you use (non-oop)? To enlarge the topic a bit: which threads are all out there and how do you solve them (e.g.: cross site scripting)?
Best Practices For Sortable Columns
I have several forms that display information from the database after users log in. I would like the column titles to be sortable so that when the user clicks on a column heading, the data re-displays in sorted order of that column. Next time they click on it, it toggles the order from ascending to descending, and then back to ascending again. Since I have many forms and each form has different columns, I was wondering if there was a method that would be better than a brute force approach. What are the best practices for this functionality?
Include() & Paths - Best Practices
I have a question regarding paths and the include() statement in PHP. I develop in a Windows environment and will be publishing to a Linux server. I would like to do the following: 1. Setup my include references in such a way that I don't have to change them all every time I have to publish to the production server 2. Setup above in such a way that won't involve php.ini (& LInux equivalent), as I have access to edit this file locally, but won't be able to do so in the production environment My file structure is such: wwwroot subdir global inc I tried Windows-styled virtual references such as "/" to refer to the wwwroot, but that didn't work in the production evironment. I switched to relative paths (eg include("global/inc/config.inc") or include ("../global/inc/config"). I guess what I'm looking for here is a best practice for how to set the includes up for maximum portability across servers with different file systems as well as different platforms. Can you, for instance, incorporate a variable that defines the root path into the include statement above? If so, where do you define this variable globally without having to add to every file? (b/c you can't use an include statement if you haven't gotten the includes to work) Is there an equivalent of global.asa for the PHP world? I'm just raising some issues with my experience thus far. I know there's a solution and a best practice that I'm just missing to the point--I would appreciate any wisdom that could be shared.
PHP Default Host Best Practices
I've got my dev and production environments all setup, and the mysql DBs working fine. What need to do is set the mysql.default_host option in php.ini to be one thing on dev, and something different on production. Unfortunately, my web host doesn't allow me to mess with php.ini. So, what's the best way to specify a different host to mysql_connect() on dev and production. Yes, I could manually edit the variable everything I FTP, but I'd rather not. Should I use a global variable in a separate include file? Other options?
Change File Upload Size At Runtime
Is there any way to set the Maximum File upload size at runtime. I have 2 form . one should allow to upload 4mb and the other should allow upto 10 MB. Is there any way other tha setting the value in php.ini.
Change File Upload Size At Runtime
Is there any way to set the Maximum File upload size at runtime. I have 2 form . one should allow to upload 4mb and the other should allow upto 10 MB. Is there any way other tha setting the value in php.ini..
|