Jump to content

php code not working - php.ini settings?


jakeZ200

Recommended Posts

A developer put together an image gallery that uses rss feeds to load image content for a client of mine. The code works fine on the developers server and my server. It is not working on the clients server. I assume it has something to do with either the php.ini file setting, or some other server settings since the code works fine on two other servers.

 

My server is running PHP Version 5.2.17 - Linux linhost123.prod.mesa1.secureserver.net 2.6.18-238.19.1.el5PAE #1 SMP Fri Jul 15 08:15:44 EDT 2011 i686

 

The clients server is running PHP Version 5.3.8 - Linux vux113 3.2.1-gentoo #1 SMP Tue Jan 17 07:30:40 EST 2012 x86_64

 

 

The following code gets the rss feed from the url bar and feeds it to the php page below.

 

<?php

if(isset($_GET['gallery']))
{

$feedUrl= $_GET['gallery'];
}


?>

 

 

The following parses the rss feed.

 

<?php
error_reporting(0);

///function toi test If IE is being used
function ae_detect_ie()
{
    if (isset($_SERVER['HTTP_USER_AGENT']) && 
    (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false))
        return true;
    else
        return false;
}

$rss = simplexml_load_file( $feedUrl);

$title =  $rss->channel->title;
echo '<h2>'.$title.'</h2>';
$regx = "<img.+?src=[\"'](.+?)[\"'].+?>";
$matches = array();
foreach( $rss->channel->item as $img ) {
    preg_match( $regx, $img->description, $matches);

    $imageZen = str_replace("img src=","",$matches[ 0 ]);

$imageSize =
$replacement="";
$final = substr($imageZen, 0, -1).$replacement;
}
  
// the loop that displays the image tags from the feed
foreach( $rss->channel->item as $img ) {
    preg_match( $regx, $img->description, $matches );

    $imageZen = str_replace("img src=","",$matches[ 0 ]);
$replacement="";
$final = substr($imageZen, 0, -1).$replacement;
//change image sizes
$finalEdit = str_replace('-3','-4', $final);
$finalEdit_small = str_replace('-3','-11', $final);
//secho '<a href='.$finalEdit.'><img src='.$finalEdit_small.'width="" height="" /></a>';
// echo '<li class="stylePic" ><a href='.$finalEdit.' rel="markjasonphotography[gallery]"><img src='.$finalEdit_small.' width="" height="" alt="" /></a></li>';

//ANd Finally we echo out the results


if (ae_detect_ie())
{
echo '<div class="mask"><a href='.$finalEdit.' rel="markjasonphotography[gallery]"><img src='.$finalEdit_small.' width="200" height="133" alt="" /></a></div>';  

}
else
{
echo '<div class="mask"><a href='.$finalEdit.' rel="markjasonphotography[gallery]"><img src='.$finalEdit_small.' width="" height="" alt="" /></a></div>';  

}

}

?>

 

The empty html shell is rendered, but none of the of the content from the rss feed is loaded. I'm also not receiving any errors.

Thanks for any help.

 

The content of my .ini file is below.

 

;

;  Including file: /data/templates/web/user/domain.com/cgi-bin/php.default.ini

;

 

upload_tmp_dir = /data/tmp

asp_tags = On

register_globals = On

safe_mode = Off

upload_max_filesize = 25M

post_max_size = 25M

output_buffering = 1024

mime_magic.magicfile = /usr/share/misc/file/magic.mime

memory_limit = 32M

include_path = .:/usr/services/vux/lib/php

disable_functions = shell_exec,passthru,exec,system,pcntl_exec

allow_url_include = 0

allow_url_fopen = 0

extension_dir = /usr/services/vux/php5/lib/php/extensions

zend_extension = /usr/services/vux/php5/lib/php/extensions/ioncube_loader_lin_5.2_real.so

zend_extension = /usr/services/vux/php5/lib/php/extensions/ZendOptimizer_real.so

 

realpath_cache_size = 64K

realpath_cache_ttl = 600

 

 

;

;  Suhosin Configuration

;

 

; Disable suhosin for now

;extension = suhosin.so

;suhosin.simulation = On

;suhosin.executor.disable_eval = On

;suhosin.executor.eval.blacklist = popen

 

session.gc_probability = 1

session.gc_divisor = 100

session.gc_maxlifetime = 3600

 

date.timezone = America/New_York

 

error_reporting = (E_ALL & ~E_WARNING & ~E_DEPRECATED & ~E_NOTICE)

 

;

;  User-based Defaults

;

 

session.save_path=/data/23/2/64/151/2227966/user/2448153/cgi-bin/.php/sessions

 

 

 

;

;  Including file: /data/templates/web/user/domain.com/cgi-bin/php.override.ini

;

 

error_reporting = (E_ALL & ~E_WARNING & ~E_DEPRECATED & ~E_NOTICE)

 

Link to comment
Share on other sites

I know a fair amount about web development. The contractor was hired to develop the code and did aid in implementation to a point. Being that it works on several other servers, I'm guessing that it has to be a server, or php.ini file setting.

 

 

Link to comment
Share on other sites

I'm also not receiving any errors.

 

Your code is specifically setting error_reporting to zero, so of course you are not seeing any errors. Your php.ini error_reporting setting is also turning off the reporting of E_WARNING and E_NOTICE errors, the two most common types of errors that would help you determine when and where your code is having a problem.

 

You need to have php's error_reporting always set to E_ALL and on a development system you need to have display_errors set to ON (output reported errors to the browser) and on a live site you need to have display_errors set to OFF and log_errors set to ON (write reported errors to the error log file.) By having these settings in the php.ini, there's no need to have them in your code files (the times you have seen it suggested to add error_reporting/display_errors settings in a code file to show php detected errors, were strictly for debugging purposes.)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.