473,800 Members | 2,497 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Disabling Zend optimizer, ionCube loader, etc

93 New Member
Hi, I'm having a problem with what appears to be a bug in php, where one of my scripts runs fine on my own server, and it runs fine *sometimes* on my webhost's server, but I call it from within a certain script on my webhsot then php just dies, no error message, nothing. It's all a bit complex, but basically I want to know how to disable ANYTHING that might be causing php to behave strangely on the webshost.

Baring in mind that it's shared hosting so I can't change the php.ini file or uninstall things etc.
I've already added these 2 lines to the .htaccess file:
php_flag eaccelerator.en able 0
php_flag eaccelerator.op timizer 0

I know that my webhost has got the ionCube Loader on it, but would that make any difference if I'm not using any encoded php files? If it might make a difference, how do I disable it?

Here's the phpinfo for my webserver:
http://phpinfo.hostult ra.com/

Here's the phpinfo for my own server:
http://uk.geocities.co m/adz999/phpinfo.php.htm l

Can anyone see any other differences that might be making php behave differently? (I know my webhost is php 5.2.3 and mine is 5.2.1, but my webhost was 5.2.1 a until a couple of days ago, and when they upgraded it made no difference.)

Any help greatly appreciated.
Jul 20 '07 #1
9 5470
pbmods
5,821 Recognized Expert Expert
Heya, adamalton.

What is the code that causes the crash?
Jul 21 '07 #2
adamalton
93 New Member
Well...I've got a script which processes some search queries to another website using cURL (let's call it 'processor.php' ). I've then got a 'master script' which includes various scripts, each one of which generates some search queries to be processed, and then includes processor.php to perform the searches.

When processor.php is called from some of the scripts it works fine, and when it's called from other scripts it just stops dead, the connection to the web browser dies, no error message is displayed, it just stops. I've tried printing out a message in between each line of code and then flush()ing the buffer so that I can monitor its progress as it goes. It dies at this line: [PHP]if(curl_multi_s elect($mh) != -1){[/PHP]
With so many scripts involved it's a bit hard to determine what the factor is that's causing to fail. The code is fine syntax wise because it works (when called from some of the scripts), and if it wasn't then I would get an error message. Oh and it works on my own computer, so it's DEFINITELY fine in terms of coding. So there must be a difference between my php and my web host's php, which is why I'm trying to figure out how to disable any add-ons and stuff.

I've submitted a bug report to php, which is here (and show's some example code):
http://bugs.php.net/bug.php?id=4202 0

Thanks
Jul 21 '07 #3
adamalton
93 New Member
Here's the code if you want a gander (it's not very easy to read on the php site):
[PHP]//$arr_request_da ta is a multi-dimentional array in the format $arr_request_da ta[]=array(post data for form , PHPSESSID cookie , Tracker cookie);
foreach ($arr_request_d ata as $i =>$request_data )
{
$arr_requests[$i] = curl_init("http ://www.example.com ");
curl_setopt($ar r_requests[$i], CURLOPT_RETURNT RANSFER, 1);
curl_setopt($ar r_requests[$i], CURLOPT_HEADER, 1);
curl_setopt($ar r_requests[$i], CURLOPT_NOBODY, 1); //i only need the header
curl_setopt($ar r_requests[$i], CURLOPT_POST, 1);
curl_setopt($ar r_requests[$i], CURLOPT_POSTFIE LDS, $request_data[0]);
curl_setopt($ar r_requests[$i], CURLOPT_COOKIE, "PHPSESSID= ". $request_data[1] ."; Tracker=". $request_data[2]);
curl_setopt($ar r_requests[$i], CURLOPT_REFERER , "http://www.example.com ");
curl_setopt($ar r_requests[$i], CURLOPT_USERAGE NT, $agent); //that's already set using $_SERVER['HTTP_USER_AGEN T']
curl_setopt($ar r_requests[$i], CURLOPT_TIMEOUT ,10);
curl_setopt($ar r_requests[$i], CURLOPT_CONNECT TIMEOUT,2);
curl_setopt($ar r_requests[$i], CURLOPT_FORBID_ REUSE,1);
curl_setopt($ar r_requests[$i], CURLOPT_LOW_SPE ED_LIMIT,100);
curl_setopt($ar r_requests[$i], CURLOPT_LOW_SPE ED_TIME,2);
}

//now perform the requests:
while($arr_requ ests) //while they have NOT all SUCCESSFULLY completed
{

$mh = curl_multi_init ();
foreach(array_k eys($arr_reques ts) as $i)
curl_multi_add_ handle ($mh,$arr_reque sts[$i]);


print "got as far as executing the curl stuff<br>"; while (ob_end_flush() ); while (flush());


do {
$mrc = curl_multi_exec ($mh, $active);
} while ($mrc == CURLM_CALL_MULT I_PERFORM && $active>0);


print "1<br>"; while (ob_end_flush() ); while (flush());

while ($active>0 and $mrc == CURLM_OK){

print "2<br>"; while (ob_end_flush() ); while (flush());

// wait for network
if (curl_multi_sel ect($mh) != -1){
// pull in any new data, or at least handle timeouts
do {
print "3<br>"; while (ob_end_flush() ); while (flush());

$mrc = curl_multi_exec ($mh, $active);
} while ($mrc == CURLM_CALL_MULT I_PERFORM && $active>0);
}
}

print "4<br>"; while (ob_end_flush() ); while (flush());

if($mrc != CURLM_OK) //if it all went wrong
{
//then make all results into "curl_error " and exit the script
foreach(array_k eys($arr_reques t_data) as $i)//some elements may have already been deleted, but only if they were curl_errors enyway
$arr_results[$i]="curl_error ";
unset($arr_requ est_data,$arr_r equests);
return;
}


print "5<br>"; while (ob_end_flush() ); while (flush());


// retrieve data
foreach (array_keys($ar r_requests) as $i){
if(curl_error($ arr_requests[$i]) == '') //if all went well
{
$arr_results[$i]=curl_multi_get content($arr_re quests[$i]);
curl_multi_remo ve_handle($mh,$ arr_requests[$i]);
curl_close($arr _requests[$i]);
unset($arr_requ ests[$i]); //it has to be unset as well, otherwise it still exists
}
else //if we got a curl error
{
print "<br>Send request loop: ". curl_error($arr _requests[$i]);

if($arr_retries _count[$i]<3) //if it has NOT been retried 3 times already (4 times including the 1st one)
$arr_retries_co unt[$i]++; //start/increment the tally of how many times it has been retried
else
{
//just delete it:
unset($arr_requ est_data[$i]);
$arr_results[$i]="curl_error ";
curl_multi_remo ve_handle($mh,$ arr_requests[$i]);
curl_close($arr _requests[$i]);
unset($arr_requ ests[$i]);
}
}

}//end foreach

print "6<br>"; while (ob_end_flush() ); while (flush());

curl_multi_clos e($mh);
}//end of while($arr_requ ests)[/PHP]
It's not very easy to read there either!!

It gets as far as printing out "2<br>" and then it dies. Dead. Nothing. If curl_multi_sele ct($mh) is not equal to -1 then it should print out "3<br>" and if it IS equal to -1 then the while ($active>0 and $mrc == CURLM_OK) should go round again and it should print out "2<br>" again, but it doesn't, it just dies.
Jul 21 '07 #4
pbmods
5,821 Recognized Expert Expert
If you remove the curl_multi_sele ct() call, does the rest of the script output (i.e., is that statement what's causing it to die)?
Jul 21 '07 #5
adamalton
93 New Member
Yes, if I change
curl_multi_sele ct($mh) != -1
to
TRUE
then the
while ($active>0 and $mrc == CURLM_OK)
loop just goes round and round lots of times printing out "2<br>" and "3<br>" each time. I'm not sure that the curl stuff works when I do that, but it stops the script from dying a silent death.

Do you know any more about exactly what curl_multi_sele ct does, other than what's in the php manual? I took the user-added example code from the curl_multi_exec page of the php manual and adapted it for my needs, so I must admit I'm no expert on the curl multi functions. I tried looking on the curl.haxx site, but the multi functions that it lists don't quite match the functions that php uses and I didn't gain any great wisdom by reading what was there.

If I could adapt the code so that I don't need to use curl_multi_sele ct then that would be great, do you know if that's possible?

Thanks
Jul 21 '07 #6
adamalton
93 New Member
Actually the loop goes round several hundred times, but it DOES eventually finish, and the curl operations DO appear to work. So maybe i should just dump the if(curl_multi_s elect($mh) != -1)
line?

If I leave the curl_multi_sele ct line in, and if the script works, then the loop would only go round 2 or 3 times, which suggests that the curl_multi_sele ct does have some purpose, but maybe it's not essential?

Any ideas?
Thanks
Jul 21 '07 #7
pbmods
5,821 Recognized Expert Expert
Heya, adamalton.

Let's go back to basics for a second.

What do you want your code to do? Give an example.
What is your code doing that you don't want it to do? Give an example.
What is your code *not* doing that it is supposed to? Give an example.
Jul 21 '07 #8
adamalton
93 New Member
Ok,
I want my code to take a multi dimensional array in the format:
$arr_request_da ta[0] = array(post_data _to_be_sent , cookie1 , cookie2);
$arr_request_da ta[1] = array(post_data _to_be_sent , cookie1 , cookie2);
etc,
and for each array row I want it to create a curl handle that will send the post data and the 2 cookies to a given url, and return the response from the server (CURLOPT_RETURN TRANSFER).

I then want it to execute all of these curl handles simultaneously, and put the 'replies' into an array:
$arr_results[0] = "the reply that was given for the $arr_request_da ta[0] request";
$arr_results[1] = "the reply that was given for the $arr_request_da ta[1] request";
etc

What is your code doing that you don't want it to do? Give an example.
My original code that contained the line:
if(curl_multi_s elect($mh) != -1)
would cause php to fail, silently at that line, which apart from not allowing the transfers to complete also stops me from 'handling' the errors, because php execution stops.

What is your code *not* doing that it is supposed to? Give an example.
It is not completing the curl transfers.


*************** *************** *************** **
After experimenting a bit more I now realize that the transfers DO complete if I take out the line:
if(curl_multi_s elect($mh) != -1)
*but* if I do that then as I mentioned earlier php goes round and round the
while ($active>0 and $mrc == CURLM_OK)
loop several hundred times, which (after running some more tests) often causes php to fail because of it exceeds its maximum execution time, so is not really a viable solution.
Jul 21 '07 #9
pbmods
5,821 Recognized Expert Expert
Is it possible to simplify the code at all? I'm not familiar with curl_multi_anyt hing(), but have a look at this example.
Jul 21 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

4
3081
by: Munja | last post by:
I have PHP script running complex query and then calculating data for different conditions from received result set. Actually, it's doing the same as if I would make several queries with different conditions on same data in DB. Calculating data in PHP instead of running several queries (each query has joins on several tables with several hundreds of thousands of records) shortened page generation time, but it's still not fast enough :-(...
0
1735
by: Michal Zajaczkowski | last post by:
Hello I have installed php 4.3.3 and Zend Optimizer2.1.0b on debian woody. I added to my php.ini lines: zend_optimizer.optimization_level=7 zend_extension="/usr/local/Zend/lib/ZendOptimizer.so" (there is library for php 4.3.x) but phpinf() still don't display "with Zend Optimizer ..." info What is the problem? Anyone has a sugestion? Thanks,
1
2401
by: Nick Mudge | last post by:
Hi, Does anybody know the performance difference between having your PHP code cached and just running your code with the zend optimizer? Is there much difference? Nick
1
4876
by: Toni | last post by:
I've tried to reinstall the zend environment and debugger on my new computer. I almost succeeded but when I try to debug or profile a webpage by clicking on the buttons on the toolbars I get the following message in my browser: Failed to connect to host '192.168.2.102'. Failed to connect to host '192.168.126.1'. Failed to connect to host '192.168.47.1'. (I've got a network card, Wifi and Bluetooth in the machine)
3
2252
by: nntp | last post by:
What is ZEND. Why it has anything to do with programming PHP?
1
2149
by: Xristos Nikolopoulos | last post by:
Hello, I have made an application that needs to upload files, the application is deployed in several folders, and each folder has its php files. The problem is, I have in the folder I want to upload the php files that do the job and a php.ini file to change limits.
7
3121
by: archimonde2 | last post by:
What are pros any cons to use eaccelerator and zend optimizer on php5-mod with apache2.2 ?? Does accelerators work immediately after install on all php files? When both are in use which accelerate speed execution of php files? How can i find that??
1
2532
by: maheswaran | last post by:
Hi I have tring to run a simple test script using ioncube loader (like echo "welocme"l). I could not . In my server ioncube is installed and run successfully (some thrid party script).Any one tell or give me any example to me. Thanks in advance
4
2579
by: Blueparty | last post by:
I am going to use Ioncube or Zend compiler/encoder to deploy PHP5 applications on servers at customers premisses. The factors that affect choice are: - reliability - easy of deployment at Apache/UNIX, Apache Windows and IIS/Windows - price Performace is not important
0
9691
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10507
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10255
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10036
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7582
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5607
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3765
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2948
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.