PHP

Which of PHP, ASP or Java is best for Maintenance Ease, Scalability and Uptime?

Planning to build a large portal? There are many large sites today that are on Php. Some believe J2EE or ASP.Net deliver the required performance. What is the best technology to go for scalability and uptime? My answer for scalability is that they all work great. Computers have become fast. It depends on who codes. Most of the technologies: php, asp.net, j2ee, perl, ruby all have large websites built with them.
2 answers

Can I delete asp.net cookies in an iframe with php?

9 points

I am able to log into the asp.net iframe, but when I log out I get an asp.net error logging back in until I delete all session cookies in the browser (Firefox) - then, I get redirected to the login screen the first attempt but on the 2nd attempt I can log in.

Is there a way to emulate the Firefox "delete all session cookies" with PHP? I have tried managing the individual session cookies with PHP and also session_unset() and session_destroy() but I think the problems are:

1. cookies are set by the domain in the iframe, not the domain of the PHP page

Read more »
Created by Anonymous 7 weeks 3 days ago
  Tags:
1 answers

Mod_gzip not compiling

-6 points

Hi

I am compiling mod_gzip. I made the required change in Makefile accompanying mod_gzip and I am getting following error:

cc1: error: unrecognized command line option "-Wall,-O3,-fomit-frame-pointer,-pipe"

Can anyone help?

Read more »
Created by Anonymous 7 weeks 4 days ago
  Tags:
5 answers

mod_gzip build failing

10 points

Hello,

I just tried to rebuild Apache so I could enable mod_gzip. The build went fine apart from adding mod_gzip. This is the error:

Fetching http://httpupdate.cpanel.net/buildapache/1/mod_gzip-1.3.26.1a.tar.gz (0)....@74.200.65.162......connected......receiving...2%...5%...8%...11%...14%...17%...20%...23%...26%...29%...32%...35%...38%...41%...44%...47%...50%...53%...56%...59%...62%...65%...68%...71%...74%...77%...80%...83%...86%...89%...92%...95%...98%...100%......Done
Untarring mod_gzip....Done
 
make [@mod_gzip-1.3.26.1a]...(-j 8).... Done

Read more »
Created by Anonymous 7 weeks 4 days ago
  Tags:

Fixing PHP Security Holes using PhpSecInfo

Lately, I have come across an amazing tool PHPSecinfo that allows us to fix PHP security holes by scanning and then recommending changes in php.ini. PhpSecInfo is an equivalent to the phpinfo() function that reports security information about the PHP environment, and offers suggestions for improvement. It does not do any kind of code auditing, but recommends loop in php configuration.
1 answers

Parsing Youtube in preg_replace in PHP?

9 points

Hi,

I am attempting to parse the video ID of a youtube URL using preg_match. I found a regular expression on this site that appears to work;

(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=[0-9]/)[^&\n]+|(?<=v=)[^&\n]+

My PHP code is as follows:

<?php
<?
 
$subject "http://www.youtube.com/watch?v=z_AbfPXTKms&NR=1";

 
preg_match("(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=[0-9]/)[^&\n]+|(?<=v=)[^&\n]+"$subject$matches);

 print 
"<pre>";
 
print_r($matches);
 print 
"</pre>";

?>

Read more »
Created by Anonymous 8 weeks 5 days ago
  Tags:

How to Create Thumbnails from Image using PHP

First Step: Install GD Image processing in PHP can be done powerfully with a library, GD. GD image library needs to be installed and activated on your PHP to be able to do image processing. To check if GD is installed, check your phpinfo: Open a file phptest.php (that contains following code) in your browser: <?phpphpinfo()?> If you find GD in the output of the browser, this means GD is installed on your server. If GD is not installed, install it.
1 answers

Settings for Drupal cacherouter with memcache

5 points

Following is a configuration to be put in drupal's settings.php on using drupal cacherouter with memcache:

$conf['cache_inc'] = './sites/all/modules/cacherouter/cacherouter.inc';
$conf['cacherouter'] = array(
'default' => array(
'engine' => 'memcache',
'server' => array('192.168.0.100:11211', '192.168.0.100:11212'),
'shared' => TRUE,
),
);

Read more »
Created by Anonymous 9 weeks 4 days ago
  Tags:

Manipulating PDF files with PHP using FPDF

In .NET, we have certain libraries that do pdf manipulation for us. In PHP, we have open source library for PDF file generation called FPDF. There is an extension of the library: FPDI that allows for manipulating PDF files. FPDI extracts the content of the pdf as a template, allows us to change the content and then output the changed pdf as a new pdf file. There is no install. We need to download and include fdpf.php and fdpi.php libraries in our php script as would be demonstrated in the examples below:

PHP array_splice

PHP array_splice is a nice, but not enough used function to limit an array to certain x number. Therefore, for example, there is a string with comma separate values that I want to limit or output to only 10 values. I can explode it from comma. This would also convert it into an array. Once converted, you can array splice it till 10th value and then implode the resultant array. As an example: <?php$string="string1, string2, ... string100"printten( $string )function printten( $string ){     $string = explode( ",", $string );     array_splice( $string, 10 );?>