php5

How do you configure Apache/PHP to accept slashes in query strings?

I have two Apache servers running PHP. One accepts forward-slashes in the query string and passes it along to PHP in the expected way, for example: http://server/index.php?url=http://foo.bar works and in PHP this expression is true: $_REQUEST['url'] == "http://foo.bar" However, in the other Apache server, the same URL results in a ...

CURL usages in PHP

Hi friends, I had a doubt in CURL (PHP) . I want to login directly into a site using CURL. Is it possible, if possible please guide me. I tried with the following but its not working http://username:password@myurl Please solve this.. Thanks in advance ...

Port a Ruby/Rails application to PHP 5

I have a very large Ruby on Rails application that I would like to port to PHP 5.2 or maybe PHP 5.3 (if 5.3 ever gets released). I've been looking for a some way of automatically converting the simple stuff like simple classes and the ERB templates. I would expect that I'd have to do the more complicated stuff myself in cases where the ...

Difference between php 4 and php 5?

I'm in search of the web hosting space, and got to know the PHP version is 4.3 and MySQL Version 4.1 But i developed my application in MySQL version 5.x and PHP version 5.x Can anyone give me the differences in versions ? what all i cannot access now ? Thanks... ...

Dynamic Naming of PHP Objects

How do i dynamically assign a name to a php object? for example how would i assign a object to a var that is the id of the db row that i am using to create objects. for example $<idnum>= new object(); where idnum is the id from my database. ...

Using __call with static classes?

Is it possible to use the __call magic method when calling functions statically? ...

Get PHP to read directories with quotes in their names?

I am using PHP 5's scandir($dir) function to iterate through a directory and print out an xml list of files. Only, when the directory has a single quote in the name, scandir returns no items! It doesn't return false (as it would if it failed) or generate warnings or errors - just empty. Any ideas? $items = scandir(stripslashes($dir)); /...

How to start writing a PHP5 extension in C++

I'm writing a PHP5 extension, and while I could write it in C, it would be easier to use C++ and take advantage of the STL and Boost. Trouble is, the tutorials I've seen only deal with C, and I'm looking for a basic example which uses C++ Here's what I've tried so far: config.m4 [ --enable-hello Enable Hello World support]) if tes...

Mail() problem in windows server2003

Hi all, I installed PHP in windows server 2003. All the files are working fine except the mail issue. There is no problem in SMTP. Because I run the JSP project in the same server.In that mail function working fine. So where is the problem? And how can i manage? I set the SMTP server in PHP as ; For Win32 only. SMTP = localhost smtp_po...

How do you store your scripts for cron jobs in Zend Framework?

Because ZF depends on mod rewrite for all it's URLs, it's not immediately apparent to me where I should store local scripts for use with a cron job. Does anyone have any recommendations, or is there an "officially accepted" way? ...

Mapping a subdomain to a Wordpress page

Any recommendations or best practices for mapping a subdomain to a Wordpress page: http://my-page.mydomain.com -> http://mydomain.com/my-page I don't want to do a redirect either, just keep the original subdomain URL until a different link is click, and then the subdomain is removed. I'm using Apache 2 with mod_rewrite, wordpress 2.7...

Does PHP evaluate variables when a function is defined?

I am creating a multipage form in PHP, using a session. The $stage variable tracks the user's progress in filling out the form, (UPDATE) and is normally set in $_POST at each stage of the form. On the second page (stage 2), the form's submit button gets its value like this: echo '<input type="hidden" name="stage" value="'; echo $stage ...

How can one run multiple versions of PHP 5.x on a development LAMP server?

(Sorry for the poorly-phrased title.) I need to test my PHP applications with multiple versions of PHP 5.x, such as PHP 5.0.0 and PHP 5.2.8. Is there a way that I can configure a development LAMP server so I can quickly test applications with multiple versions of PHP5? ...

When should I use "final"?

Is there any particular reason I should declare a class or a method final in day-to-day programming (web or otherwise)? Please provide a real-world example where it should be used. BTW, I'm asking because I'm trying to pick an 'obscure' keyword and master it. ...

PEAR vs PHP time functions

Hi All I'm looking into basic time functions (creating a UTC timestamp and converting into a local timezone). The first set of tutorials i encountered pointed toward PEAR as it's better at avoiding overspill errors in calculations. Now, mid-way through another, it appears that PEAR has issues with some of it's timezone functions running...

How do you refactor a Codeigniter controller function that is too long?

I have a function in my controller that has grown longer than I'd prefer and I'd like to refactor it to call a few discrete functions to make it easier to manage. How can I better organize a long function in a Codeigniter controller? What I've tried: I know you can create private functions in a controller by naming them with a leading ...

Inheritance of static members in PHP

In PHP, if a static attribute is defined in the parent class, it cannot be overridden in a child class. But I'm wondering if there's any way around this. I'm trying to write a wrapper for someone else's (somewhat clunky) function. The function in question can be applied to lots of different data types but requires different flags and o...

Search and replace multiple values with multiple/different values in PHP5?

Is there an inbuilt PHP function to replace multiple values inside a string with an array that dictates exactly what is replaced with what? For example: $searchreplace_array = Array('blah' => 'bleh', 'blarh' => 'blerh'); $string = 'blah blarh bleh bleh blarh'; And the resulting would be: 'bleh blerh bleh bleh blerh'. ...

Class variables, scope resolution operator and different versions of PHP

I tried the following code in codepad.org: class test { const TEST = 'testing 123'; function test () { $testing = 'TEST'; echo self::$testing; } } $class = new test; And it returned with: 1 2 Fatal error: Access to undeclared static property: test::$testing on line 6 I want to know whether referencing a class const...

how to print only a part of a webpage in php

I am trying to print a part of a page with a single button click without opening a different page . The part of the page that i need to print has been called using ajax so if anybody could help me i would be really thankful ...