php

PHP Async Web Services

How do I make an asynchronous call to a web service using the PHP SOAP Extension? ...

When do I use the PHP constant "PHP_EOL"?

When is it a good idea to use PHP_EOL? I sometimes see this in code samples of PHP. Does this handle DOS/Mac/Unix endline issues? Most of the PHP I write is for generating HTML, and I use <br/> instead of actual newlines, so haven't used this constant before. ...

Generated image using PHP and GD is being cut off

This is only happening on the live server. On multiply development servers the image is being created as expected. LIVE: Red Hat $ php --version PHP 5.2.6 (cli) (built: May 16 2008 21:56:34) Copyright (c) 1997-2008 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies GD Support => enabled GD Version => bundled...

What's the best method for sanitizing user input with PHP?

Is there a catchall function somewhere that works well for sanitizing user input for sql injection and XSS attacks, while still allowing certain types of html tags? ...

Parse Fast Infoset documents in PHP?

Is there a library which allows PHP to decode application/fastinfoset binary XML? ...

Is it possible to do a SVN export without shell access?

Hello, I started using subversion for one of my projects and it would be absolutely amazing if I could just export the latest version from the repository on my production server by for example running a php or perl script. The production site is hosted with a shared hosting provider who doesn't allow shell access or for example the php...

Can I use a generated variable name in PHP?

I have a bunch a values I would like to add together which are entered into a form. Right now, the form has 11 lines but it could get larger in the future. I can easily add all the values together with something like: $total = $value1 + $value2 + ... + $value11; All the values I want to add together are coming from an HTML form. I want...

PHP: Current encoding used to send data to the browser

How can I know what encoding will be used by PHP when sending data to the browser? I.e. with the Cotent-Type header, for instance: iso-8859-1. ...

Can PHP handle enterprise level sites as well as Java

PLEASE NO FLAMING! I really would love a few objective opinions about the issue. I have a project that has been strongly developed in PHP but have clients that are concerned that Java would be a better solution. I know sites such as Flickr and Digg are run on PHP, but I am concerned that PHP's lack of a running environment may destroy ...

Global or Singleton for database connection?

What is the benefit of using singleton instead of global for database connections in PHP? I feel using singleton instead of global makes the code unnecessarily complex. Code with Global $conn = new PDO(...); function getSomething() { global $conn; . . . } Code with Singleton class DB_Instance { private static $d...

Securing DB and session-data on a PHP shared host

I wrote a PHP web-application using SQLite and sessions stored on filesystem. This is functionally fine and attractively low maintenance. But, now it needs to run on a shared host. All web-applications on the shared host run as the same user, so my users' session data is vulnerable, as is the database, code, etc. Many recommend stori...

Is there a Dependency Injection framework for PHP4?

I'm stuck on a PHP 4 server, and I would like to start moving an old legacy project to modern Design Patterns, including Dependency Injection. Are there any dependency injection frameworks that will work with PHP 4? ...

Common CRUD functions in PHP

Hi, Is there a simple way to write a common function for each of the CRUD (create, retreive, update, delete) operations in php WITHOUT using any framework. For example I wish to have a single create function that takes the table name and field names as parameters and inserts data into a mySQL database. Another requirement is that the f...

What are the security concerns of evaluating user code in PHP?

Hi, I am wondering what security concerns there are to implementing a PHP evaluator like this: <?php eval($_POST['codeInput']); %> This is in the context of making a PHP sandbox so sanitising against DB input etc. isn't a massive issue. Users destroying the server the file is hosted on is. I've seen Ruby simulators so I was curious...

What is the best PHP MVC framework for scalability?

There are a lot of MVC frameworks for PHP. Which one is the best in terms of scalability? Is there any framework that supports splitting applications on many front end and database servers? Sharding? Other enterprise features? Ideally the framework should support sites with thousands of concurrent users per server. I would greatly...

PHP - Security

What is the best way to secure an intranet website developed using PHP from outside attacks? ...

PHP: Storing 'objects' inside the $_SESSION.

I just figured out that I can actually store objects in the $_SESSION and I find it quite cool because when I jump to another page I still have my object. Now before I start using this approach I would like to find out if it is really such a good idea or if there are potential pitfalls involved. I know that if I had a single point of e...

What to use for XML parsing / reading in PHP4

Unfortunatly I have to work in a older web application on a PHP4 server; It now needs to parse a lot of XML for calling webservices (custom protocol, no SOAP/REST); Under PHP5 I would use SimpleXML but that isn't available; There is Dom XML in PHP4, but it isn't default any more in PHP5. What are the other options? I'm looking for a so...

Testing form inputs in PHPUnit

What's the best way to test $_GET and $_POST inputs in PHPUnit? I have a class that sanitises input and want to check that it works correctly when processing bogus data. Is there an easy way to set up the form variables in PHPUnit or should I just pass off the validation to a secondary class/functions that are fed the form variables so...

php - proc_open (or other function that works)

I need to do some command lines through a browser. What I need to do in a command-line would be: $login <login name> <password> $passwd <old password> <new password> <retype new password> So, how can I do this using the proc_open function? Or should I use another function to do this? Thanks ...