I used the function htmlentities() in my php script, but the server says: "undefined function"
After some searching, I understand that the php installation on my webhost does not include that function, and that I can add the function by changing the php.ini file, but I have spent many hours searching, and have not found any information on how to actually do this.
Any suggestions?
If your webhost's PHP install doesn't have something so basic as htmlentities(), it's time to get a new webhost. If it's that bizarrely locked down, you're also not likely to be able to tweak php.ini...
I don't see anything in the manual that says this function is in an optional module that you'd have enable - you just need PHP 4 or 5. Are you sure you're calling the right function?
It's surprising that this would be unavailable, but have you tried the alternate htmlspecialchars? It will deal with the ones that are most important to deal with.
Related
I saw many different questions here, but nothing was helpful to me.
I have no trouble with an interpreter, I tried to reset PhpStorm's cache.
It looks like file functions.php isn't accessible.
I really don't want to make a total reset. Maybe somebody has an idea how to solve it?
I'm not sure what I actually did and how to reproduce this issue again, but now it works well. I took previous version of PHPstorm. When I installed new one, the previous one was simply renamed to sth like 'phpstorm2'.
Here are my thoughts what actually happened:
As I understand for highlighting is responsible that part of application which is managed under Languages & Frameworks / PHP / PHP Runtime.
To reproduce this issue you may try to disable there "Core / Core" and try to write down in any place of your phpfile following:
\Exception::class();
And in your case this class will not be highlighted, as it presents in Core_c.php. In my case it is placed in
/opt/phpstorm/plugins/php/lib/php.jar!/stubs/Core/Core_c.php
I'm 100% sure that these libs were always enabled, but why I didn't saw this - that is the question.
So if I face this issue again my steps would be:
Try to verify Languages & Frameworks / PHP / PHP Runtime. The better way would be to enable ALL libs.
Check External Libraries in the project tree. Check read privileges for /opt/phpstorm/plugins/php/lib/php.jar and probably reinstall this plugin.
Try to find out function which I don't actually see in External Libraries.
I was asked to help getting a website that was running with 5.2 php code, to work on a 5.3 php server. The site is big, and I can't see the errors that would appear normally when a site isn't working.
I've tried to use the Search and replace function that Dream Weaver has, and simply use it all over the website. But the problem is that I only want to replace functions in PHP documents, and not in js files. When i use Search and replace, in Dreamweaver, it overwrites the js files aswell, and that would cause more errors. Because there's A LOT of files that i have to go through, it would take me a lot of time if i had to go through it manually.
I figured this must be a problem that a lot of firms experiance, so there must be ways to handle this without it being a bigger hassle.
Anybody out there who could help me out ? Any help is much appreciated!
Regards,
Mathias
Check out the official guide about Migrating from PHP 5.2.x to PHP 5.3.x
most existing PHP 5 code should work without changes, but make sure error-reporting is enabled to get some idea of what is going wrong .
I would recommend the use of sed from command line. It is most likely the fastest and most powerful find/replace utility available for LAMP developers.
http://www.grymoire.com/Unix/Sed.html
Dont worry about it! If your code works in php->5 for the most part it will work just fine. 5.3 offers a plethora of options but no doubt your not using them.
I have a problem with Drupal 6.20.
Possibly after a PHP update, site stopped working. I get:
Notice: unserialize() [function.unserialize]: Error at offset 0 of 22765 bytes in /PATH/includes/cache.inc on line 33
This is the line:
$cache->data = unserialize($cache->data);
I would appreciate any help.
This problem will happen when you have Drupal 6.x running over PostgreSQL 9.0 because the bytea type was modified.
There are some suggested solutions here: http://postgresql.1045698.n5.nabble.com/Bytea-error-in-PostgreSQL-9-0-td3304087.html - (liking to Wayback Machine)
Running this on the database should fix it:
ALTER DATABASE databasename SET bytea_output='escape';
Sounds like your Drupal cache has gotten corrupted.
The immediate solution would be to clear the caches. Three ways to clear the Drupal caches:
Log in to the site with the admin password and select the flush caches option from the menu. This will obviously only be possible if you can get into the site in the first place.
If you can't do that, you can use the Drush command-line utility to flush the cashes without having to go to the site.
If you can't even get Drush to work (or you just don't want to install it), you can do it manually by going to the the database in your favourite MySQL tool, and emptying all the tables whose names start with the word "cache_".
The real question is why this would have happened in the first place. Sadly, I can't answer that, without a lot more info about your set up (and likely spending some time investigating too).
The danger is that even once you've cleared your cache, the same error could occur again, so even if you do get it working again, it would be a good idea to dig around a bit and see if you can find out the root cause.
My guess would be a rouge module that's got a bug has written bad data to the cache. You might want to check the drupal site and Google to check the modules you're using to see if there's any that have had similar behaviour reported.
Also, you mention a PHP update: Please let us know which versions of PHP you went from and to. There are known issues with some Drupal 6 modules in PHP 5.3, although the core does support it. See http://drupal.org/requirements for more info.
Try a var_dump($cache->data). It could be that PHP is adding escape sequences and/or quotes due to magic quotes or similar.
It is probably because of bad data inside of your array, you can fix it like this:
$data= preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $cache->data );
$s_data= unserialize($data);
Anyone got a problem with php 5.2.12 getting a lot of " Maximum execution time" error when trying to include() files?
I can't seem to find the bug in php.net, but it's consistently giving us that error on numerous scripts.
Anyone can recommend solutions?
The same script runs on a few other servers with php 5.2 without any problems. So just to let you guys know it isn't a script problem.
This is much, much more likely to be a problem with your code rather than with a specific version of PHP. PHP by default has a maximum execution time of 30 seconds, which you can modify by calling set_time_limit() or adjusting your php.ini settings.
If you're not doing something that you expect to take a long time, then usually the cause of this error is an infinite loop somewhere in your code. I'd throw a debug_print_backtrace() and a couple of exit() calls into some key locations and try to figure out which file is giving you grief, and then take a closer look in there. Perhaps you're stuck in an infinite include() hierarchy, in which case you should be using include_once() for all your class and function library files.
I would check to make sure the same include isn't getting requested time and time again somehow. You might try include_once() just to see if it changes things for you. That isn't a solution so much as it's a potential temporary fix. You should find out what is causing this if indeed it is getting called over and over again.
If you have xdebug setup and an IDE that supports debugging this would be a great way to dig into the code.
Otherwise, can you try putting some output statements in the first line of the included file and in the line PROIR to calling the include. See what's going on ...
I am calling a PHP-Script belonging to a MySQL/PHP web application using FF3. I run XAMPP on localhost. All I get is this:
Connection Interrupted
The connection to the server was reset while the page was loading.
The network link was interrupted while negotiating a connection. Please try again.
There are a number of possible solutions ... depends on the "why" ... so it ends up being a bit of trial and error. On a fresh install, that's tricky to determine. But, if you made a recent "major" change that's a place to start looking - like modifying virtual hosts or adding/enabling XDebug.
Here's a list of things I've used/done/tried in the past
check for infinite loops ... in particular looping through a SQL fetch result which works 99% of the time except the 1% it doesn't. In one case, I was using the results of two previous queries as the upper and lower bounds of a for loop ... and occasionally got a upper bound of a UINT max ... har har har (vomit)
copying the ./php/libmysql.dll to the windows/system32 directory (Particularly if you see Parent: child process exited with status 3221225477 -- Restarting in your log files ... check out: http://www.java-samples.com/showtutorial.php?tutorialid=1050)
if you modify PHP's error_reporting at runtime ... in certain circumstances this can cause PHP to degenerate into an unstable state if, say, in your PHP code you modify the superglobals or fiddle around with other deep and personal background system variables (Nah, who would ever do such evil hackery? ahem)
if you convert your MySQL to something other than MyISAM or mysqli
There is a known bug with MySQL related to MyISAM, the UTF8 character set and indexes (http://bugs.mysql.com/bug.php?id=4541)
Solution is to use InnoDB dialect (eg sql set GLOBAL storage_engine='InnoDb';)
Doing that changes how new tables are created ... which might slightly alter the way results are returned to a fetch statement ... leading to an infinite loop, a malformed dataset, etc. (although this change should not hang the database itself)
Other helpful items are to ramp up the debug reporting for PHP and apache in their config files and restart the servers. The log files sometimes give a clue as to at least where the problem might reside. If it happens after your page content was finished it's more likely in the php settings. If it's during page construction, check your PHP code. Etc. etc.
Hope the above laundry list helps somebody someday ... probably myself when I run into it again and come back here looking for "how the heck did I fix it last time?" ... :)
It's possible that your script could be caught in an infinite loop. If that doesn't apply, then I'd check the error logs like TimB suggested.
It sounds like the PHP script you're calling is failing without returning a valid response. Depending on the level of logging that you have set up, this should generate an error in the Apache logfile, which will give you some idea of the problem. I'm not familiar with XAMPP, but you should be able to find out where the logs are, and look for an error that occurred at the time you made your request to the PHP script.
copying libmysql.dll to apache\bin folder may help you overcome this strange error
I solved this problem Upgrading the xampp\php\ext\xdebug\php_xdebug.dll
(changed to php xdebug v.2.0.5-5.3-vc9 )
I had the same problem and this is what i did.
I issued the http get command through php cli script, and as it turns out I had declared one class twice somewhere.
By the way , i use AMPPS on an mac
Hope this helps some one!
Try doing the request with Firebug enabled and see what info you can get out of that; I always find that using wget is helpful for seeing the raw HTTP interaction without worrying about Firefox's UI elements interfering.
If you are using certificates for ssl in Windows 2008 Server(iis 7) from old selfssl tool(iis 6), that is the problem. Sometimes Microsoft releases patches which can destruct all these old certificates. The solution is to generate them again.
copying libmysql.dll to apache\bin folder may help you overcome this strange error
Indeed this helped me to solve this problem
The connection to the server was reset while the page was loading.
Incase the issue is not working this did the trick for me.
1. I got a new zip directory for PHP and connected it with apache
2. I searched for the libmysql in the new php and inserted this to the apache/bin
its this libmysql.dll that is needed there and not the one form mySQL/bin.
ok at least thats the one that worked.
I experienced a very similar issue - which doesn't apply to the person who asked this question - but may be of help to others who are reading this page...
I had an issue where in certain cases PHP 5.4 + eAccelerator = connection reset. There was no error output in any log files, and it only happened on certain URLs, which made it difficult to diagnose. Turns out it only happened for certain PHP code / certain PHP files, and was due to some incompatibilities with specific PHP code and eAccelerator. Easiest solution was to disable eAccelerator for that specific site, by adding the following to .htaccess file
php_flag eaccelerator.enable 0
php_flag eaccelerator.optimizer 0
(or equivalent lines in php.ini):
eaccelerator.enable="0"
eaccelerator.optimizer="0"