Declarations not found in large files, PhpStorm 2018.3.3 - php

So I have an old project with some pretty large files (5000+ lines). I have upgraded to the latest PhpStorm and it has not fixed my issue.
My issue is that method calls are not linked to their declaration and are highlighted as such. If I try to control+click on the method name it tells me "cannot find declaration to go to".
The correct USE line is at the top of the file and I know it should be working because if I simply delete the bottom 1/4 of the file it starts working. I have tried narrowing down what code causes it to happen in the file, but it really just comes down to how much code is removed, not which code is removed.
I have increased my memory via my options file to no avail, and I am running the 64 bit version:
-Xms1024m
-Xmx2048m
-XX:ReservedCodeCacheSize=1024m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-Dhidpi=true
-Dawt.useSystemAAFontSettings=lcd
-Dawt.java2d.opengl=true
What can I do to increase the number of lines this software can deal with. Disabling inspections has no effect. Invalidating caches and restarting has no effect. Deleting my .idea folder has no effect.

I ran into the exact same problem on version 2020.2 of PHPStorm and ended up contacting JetBrain's tech support. Unfortunately the only solution is to refactor your code. This was JetBrain's answer:
"The reason for that behavior is that the control flow is too long to analyze.
It's this one: https://youtrack.jetbrains.com/issue/WI-41610
And partially, this one: https://youtrack.jetbrains.com/issue/WI-31569
Unfortunately, there's nothing you can do to work that around on your side"
Basically if the file has too many method calls and/or has too many lines of code, the IDE can't analyze the file. So you have to shorten the script enough to allow PHPStorm to analyze it. Beware that this will also affect refactoring in PHPStorm because it won't find usages of methods in those long files that are affected by this bug.

Help | Edit Custom Properties.
Relevant properties:
#---------------------------------------------------------------------
# Maximum file size (kilobytes) IDE should provide code assistance for.
# The larger file is the slower its editor works and higher overall system memory requirements are
# if code assistance is enabled. Remove this property or set to very large number if you need
# code assistance for any files available regardless their size.
#---------------------------------------------------------------------
idea.max.intellisense.filesize=2500
#---------------------------------------------------------------------
# Maximum file size (kilobytes) IDE is able to open.
#---------------------------------------------------------------------
idea.max.content.load.filesize=20000
Restart IDE, try File | Invalidate Caches | Invalidate and Restart.

Related

PHP Files Throw Parse Errors (ex: T_STRING) After Migrating

This is a weird one, and something I've never run into before.
I'm deploying to a vvv (Varying Vagrant Vagrants) box from PHPStorm, and the project is a wordpress site.
Frequently, when files are moved over, after reloading the site, I get a PHP parse error, always at the last line of the file. The file isn't necessarily the one I opened and edited, and adding a ?> to the end fixes it. I can then immediately remove the ?> at the end of the file, and all remains well.
This occurs intermittently, making it very difficult to isolate and fix.
An example parse error would be something like:
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting end of file in /srv/www/cpr/public_html/wp-content/plugins/jetpack/3rd-party/class.jetpack-amp-support.php on line 359
The specific parse error changes; it's not always the same thing, but it is always fixed by simply adding a ?>, refreshing, etc.
I keep thinking this has to be something to do with either line endings or encoding, but both seem to be ok. (PHPStorm using LF and UTF-8.
The only part of this workflow that is new to me, is the vvv box, as I've previously used other vendors' vagrant boxes, but I'm not sure how that would cause this.
Is something being appended to these files that's breaking when PHP goes to parse them? Is git or vagrant or PHPStorm's deployment overriding line ending rules and changing them?
I'm at a total loss.
Any help is greatly appreciated. As I roll out larger plugin changes, I'm unable to use the WP api, or do anything else without manually opening all the affected files and adding PHP closing tags, then removing them.
I was able to finally track down the cause of this by isolating the various components.
I ruled out phpStorm and git by migrating some files manually and getting the same error to occur above the app's root, on the vagrant box. This isolated the issue to the vvv box itself, and not the project, PHPStorm, or the deploy settings.
I then setup git to force linux line endings via a .gitattributes file in the repo root, with settings based on things I read in this thread.
Here's what I'm using now:
# Force provisioning script to use LF, even on Windows
* text eol=lf
# Avoid binary files to be corrupted by CRLF conversion
*.png binary
*.gif binary
*.jpg binary
*.jpeg binary
I then used dos2unix and find to recursively fix all the line endings in the project, like so:
find . -name '*.php' |xargs dos2unix
So far - all is well, and persisting. I'll update if this pops back up and needs further revision.

Wordpress Importer showing blank page after clicking the Upload File and Import button

I have been trying to import an .xml file from my old WordPress to a new one. I have the following settings in php.ini:
upload_max_filesize = 64M
post_max_size = 90M
memory_limit = 128M
But when I click on the Upload File and Import button Im getting a blank page. No errors or anything.
Anyone has any idea how to solve this? Thanks.
UPDATE:
After turning on the error display which was suggested below I was able to get the following error:
Fatal error: Class 'DOMDocument' not found in /var/www/html/wp-content/plugins/wordpress-importer/parsers.php on line 61
which I was then able to fix by installing php-xml.
This question in its original form did not provide enough information to justify actually trying to guess the solution.
Therefore I felt the most relevant answer was some general troubleshooting steps that may shed more light on a similar situation - my focus is on tips that may help in this particular situation, but since it is going to be rather lengthy anyway I do include some more general tips as well.
The OP is not actually asking for alternatives to the wordpress import / export function, but since this is a migration gone sour (plus the fact that the wordpress import / export feature leaves a lot to desire), I will try to answer Alans question regarding alternative ways to migrate wordpress between servers / locations / domains as well.
At risk of stating the obvious: This answer is going to be long!
Debugging wordpress errors in general
Step 1. Make sure you can see what goes wrong
Enable debug mode, and make sure display_errors is enabled, and an appropriate error_reporting level is defined. This is vital to any wordpress development.
Open wp-config.php and find this line:
define('WP_DEBUG', false);
Replace it with:
//Switch on wordpress' built-in debug mode
define('WP_DEBUG', true);
/**
* Just a convenient check so you can leave the next few lines unchanged
* for next time you need debugging, and just switch true/false above.
*/
if (WP_DEBUG) {
//Handle all errors regardless of error level
ini_set('error_reporting', -1);
//Display errors directly in the browser
ini_set('display_errors', 'On');
}
...if for some reason the line isn't there already, just insert it somewhere above the line saying.
/* That's all, stop editing! Happy blogging. */
This should allow you to see some more information about most (php-)errors.
Notes:
In most cases, simply setting WP_DEBUG to true will automatically enable display_errors - however I have found the above to cover some edge cases where errors where not shown in spite of WP_DEBUG being true.
On a live (production) site it may be very undesirable to display errors to every visitor, so you may want to:
enable WP_DEBUG conditionally, for example by IP: define('WP_DEBUG', $_SERVER['REMOTE_ADDR'] === '123.123.123.123'); (obviously substituting your actual IP)
log errors instead of displaying them - see the wordpress codex for more information: Debugging in WordPress
If you have low-quality or outdated plugins or themes installed you are very likely to see a lot of output from poorly written functions within those.
If you do see errors referencing one of your plugins as soon as you enable debug mode my recommendation is to either contact the plugin developer regarding the issue, or simply uninstall the plugin and find another one that satisfies your need. Plugins from developers who didn't even care to use debug mode during development are highly likely to also contain security issues and / or be sub standard with regards to future- or third-party compatibility.
Step 2. Reproduce the error
Whatever you did to make the problem happen - do it again. This should give you something to work with, for example by simply pasting it on google and see what comes up. Chances are you're not the first to experience whatever problem your are having.
If you still get no visible errors try to right click the "nothingness" and view the page source in a plaintext editor. Sometimes errors can be hidden inside an attribute, or behind an element on the screen.
You can also try to insert some intentionally broken code in wp-config.php to confirm that errors will in fact be printed. For example type this_function_surely_does_not_exist(); right after the ini_set() directives.
Some hosts restrict the use of ini_set(), so if things still aren't working, but you do not see any errors try to find out how you can set the relevant php.ini settings - it may be in your hosting providers control panel (cPanel, Plesk etc.), you may have direct access to your php.ini via FTP... or they may offer no way to set it (find a different provider at once!)
It is also possible that you cannot change the value, but errors are logged somewhere in your providers panel by default.
If you get a completely white browser window it is likely that you have a fatal error somewhere - or a configuration problem on the server itself. This is outside the scope of this answer, so if the suggestions regarding increasing limits in the next section doesn't work, try to google "WSOD" to get started.
Find actual limits and settings
Do not trust that just because you have a file called php.ini that contains a line saying memory_limit = 128M your memory limit is actually 128M. This can be set in so many different ways that the only reliable way to know is to ask php what its current memory limit is. This is true for most php.ini-settings!
To get a fair idea what your working environment looks like create a file (preferably in the root of your wordpress install) called phpinfo.php, with the following content:
<?php
//Your memory limit
echo 'memory_limit: ' . ini_get('memory_limit') . '<br>';
//Your maximum size of post-data (including file uploads)
echo 'post_max_size: ' . ini_get('post_max_size') . '<br>';
//The maximum file size for uploads
echo 'upload_max_filesize: ' . ini_get('upload_max_filesize') . '<br>';
//Maximum runtime for php scripts (in seconds)
echo 'max_execution_time: ' . ini_get('max_execution_time') . '<br>';
//Current error reporting level
echo 'error_reporting: ' . ini_get('error_reporting') . '<br>';
//Are errors displayed?
echo 'display_errors: ' . ini_get('display_errors') . '<br>';
//Will errors be logged?
echo 'log_errors: ' . ini_get('log_errors') . '<br>';
//Where will errors be logged?
echo 'error_log: ' . ini_get('error_log') . '<br>';
//What is the absolute path of this files parent folder
// = the complete path to your wordpress "root folder"
echo 'root of wordpress: ' . __DIR__ . '<br>';
/**
* If you are curious to see *a lot* of information about your environment
* then uncomment this line too:
*/
//phpinfo();
/**
* This should print whatever is in the error log, but it could potentially
* be huge, so use with caution!
*/
//echo '<pre>' . file_get_contents(ini_get('error_log')) . '</pre><br>';
You should be aware that all of the above values can be changed during execution of a script - and some (poor quality) plugins actually will. I've seen plugins try to increase the memory_limit for instance - which is all fine and dandy, except 6-7 years pass, and a plugin "increasing" the memory limit to 32MB actually messes up the installation, because nowadays 64MB is needed for a pretty basic wordpress install, and 128MB would be a more reasonable minimum for most. The problem with this is that the only way to actually know the values for sure at any given point of execution is to insert the above right at that point.
Some very common reason for errors that happen "on occasion", particularly in connection with imports or file uploads is that either memory_limit, post_max_size or upload_max_filesize is set too low - you can try to increase them using ini_set() calls in wp-config.php:
ini_set('memory_limit', '256M');
ini_set('post_max_size', '128M');
ini_set('upload_max_filesize', '64M');
Again your host may completely prevent you from affecting your limits using these functions, but may provide another way for you to set them.
If that doesn't work either, try disabling as many plugins as possible, and as a last resort switch to a default theme - but be prepared to lose widgets and a bunch of settings if things get to that.
If you're still stuck at square one ask a question on Stack Overflow, and be very verbose about exactly what you did before it all went south ;)
Cloning / Migrating / Moving or Backing up a wordpress site
There are a lot of backup / migration plugins out there. If you are inexperienced working with files, databases and the like your best bet is probably to go with one of those. I will not recommend any specific plugin as changes are too frequent and I personally always do it manually - a google search should yield plenty of relevant results though, and I'm sure many of them can get the job done in most situations.
However, if like me, you prefer to do it manually to understand (and control) the process, here is the method I use to move, rename, clone or back up wordpress installations routinely - it should work for almost any standalone installation (ie. if you're trying to move a multisite you should probably go look for another guide).
These instructions should work whether you are
migrating from one server to another - for example development to production
migrating from one domain to another
migrating from a sub-folder to the domain root (or the other way)
taking a backup (just stop half way through the process, and continue where you left off if you ever need to recreate your backup)
The basic steps are:
Get a copy of all files
Get a copy of the entire database
Do necessary corrections in files
Upload files to new server (or same if you are restoring a backup)
Load up the database on the new server
Do necessary corrections in the database
This requires that you have access to:
Your files, for example through FTP or perhaps your hosting provider has a tool that can create an archive containing all your files.
Your database, for example through phpMyAdmin or any tool that can make a complete database dump for you.
All decent hosting plans, and nearly all inexpensive shared hosting plans come with phpMyAdmin and FTP access. VPS', private servers etc. obviously comes with direct file and database access which will be even better (or at least faster).
If you do not have access to the above wherever your site is hosted, it is likely because you bought your site from someone who does not want you to move it away (usually because they designed your website for free or at a very low cost, and need you to stay with them to get back their investment). If that is the case you can try one of the many backup / migration plugins, but chances are they don't even allow you to install plugins, so you'll have to contact them and work out some agreement instead.
(if you do not have access to your database, but you do have access to your files you can install phpMyAdmin yourself - but how to do that is way outside the scope of this answer)
Note that depending on what operation you are actually doing, some steps can be skipped - which you can feel free to do once you understand the process, and why each step is (sometimes) required - but if this is your first time just start from the top and work your way through each step.
Step 1. Get a copy of all files
You'll want to get all files in the "root" of your wordpress installation. That is the folder containing wp-content, wp-admin and wp-includes plus about 15-20 files. Make sure you get hidden files too (for example the file .htaccess will likely be hidden by default if you use FTP - in some cases this file is completely irrelevant, but in others it can be essential, so just make sure you get everything)
If your hosting provider has some sort of file manager you may want to try that first. A lot of file managers offer the option to up- or download folders as a single compressed archive - which will be a lot faster than downloading all files individually.
If you have a VPS or any solution with SSH or some other form of console access, use that and navigate to the "root" of your installation, then zip everything up - something like zip -r my_wp_backup.zip . should do. Download the file using whatever means you have.
If you only have FTP access to your files, it may take a while, but you simply log in with FTP (my favorite FTP client is FileZilla, because it's easy to use, and allows several simultaneous transfers... but any client should be fine). Navigate to the "root" of wordpress and transfer all files to a local folder on your computer (don't forget to show hidden files!)
Step 2. Get a copy of the entire database
If you have access to phpMyAdmin through your provider use that - it is by far the easiest, and I have never had a problem, except with extremely special databases or extremely old versions of phpMyAdmin.
Just log in to phpMyAdmin, select your database, click export and accept the defaults (options are very different depending on the version, but the defaults should be fine for any "normal" wordpress database). This should give you either a file download with a name ending in ".sql" - or a big text-field with huge amount of text in it. If you get the latter just copy it to a regular text file on your local computer - notepad, notepad++ or any other plain text editor will work (ie. don't use word, google docs or any other rich text editor!)
If you don't have access to phpMyAdmin you can either install it (which I'm not going to describe), or you must find some other way to export the database, for example:
If you have console access this command should give you a usable dump: mysqldump -u your_database_username -p your_db_name > my_backup.sql - if you don't know the name of your database, take a look in wp-config.php (also contains your username and password if you don't know those)
If you don't have console access either go explore your providers control panel - surely they have some way to let you make a database dump.
Step 3. Do necessary corrections in files
You should now have a complete backup on your local disk.
If you are just doing a backup you're done - the files and database are ready to be uploaded to the same location, and everything will be restored to the current state.
If you are moving to a different server or a different location on the same server find out:
what your new path is (upload the phpinfo.php file above if your provider doesn't give you any clues)
what your new database username and password is
if you need a special hostname to connect to the database (localhost is sufficient in most cases, but some providers have dedicated mysql-servers that require you to connect to some other hostname)
Correct your wp-config.php file - the relevant lines are:
/** The name of the database for WordPress */
define('DB_NAME', 'your_database_name');
/** MySQL database username */
define('DB_USER', 'your_database_username');
/** MySQL database password */
define('DB_PASSWORD', 'your_database_password');
/** MySQL hostname */
define('DB_HOST', 'localhost');
Though it's rather rare some plugins do write information in files that needs to be updated, so if the absolute path of your wordpress root folder, or the absolute URL of your installation is changing in the process of migrating you should also do a complete search and replace for those:
If the old absolute path of your installation was /var/www/www.example.com/web/blog and your new absolute path is /var/www/blog.example.com/public_html then search-and-replace those throughout all files. Do not include a trailing slash!
If the old URL was http://www.example.com/blog and the new URL is going to be http://blog.example.com do a search for www.example.com/blog replacing with blog.example.com. Do not include http:// and do not include a trailing slash!
Note that if for some reason you are in a situation where you do not know your old absolute path and / or URL you can find them in the database, so do step 5 first, and look in the prefix_options table for the values siteurl (your absolute URL) and upload_path will usually contain your absolute path (plus /wp-content/uploads) - if it doesn't then there will probably be other rows in the table that can tell you what the path was, look for something that starts with /var/www or /home/something.
Step 4. Upload files to new server or new location
As in step 1 your options may vary, but the point is to get all files uploaded to whatever folder is going to be your new root. Use whatever means you have available to do so.
Do not give in to the temptation to "try" the site out after uploading files - though unlikely it can have unforeseen consequences if you visit before all steps are completed!
Step 5. Load up the database on the new server
Again, options vary:
If phpMyAdmin is available simply log in, select your database, click import and upload the file from step 2. Sometimes I even click the SQL tab instead, and just paste the entire content directly in the big text field.
If you have console access you can upload the file and run mysql -u your_database_username -p your_new_db_name < my_backup.sql
Step 6. Do necessary corrections in the database
If you're restoring a backup to the same server and location you are done.
However, if you are migrating to a different server or a different URL you need to be aware that Wordpress itself, as well as a lot of plugins writes your absolute URL in a lot (thousands) of places in the database, and your absolute path is likely to also be present in at least a couple of rows.
You also need to be aware that a lot of plugins, as well as some core wordpress functions use the php function serialize to store complex data easily in the database. That format is very sensitive to changes, so a "regular" search and replace is very (very!) likely to break everything.
Luckily there is a free tool specifically designed with this in mind. I have no affiliation, but I cannot recommend interconnect/it database search and replace enough. It is well-maintained, super user friendly, and I have never personally experienced it mess anything up.
Download it using the link above, unzip it, rename the folder to something_random_for_security and upload it to your wordpress root folder. Then go to http://blog.example.com/something_random_for_security in your browser (obviously substituting relevant parts of the URL).
You'll be presented with a neat graphical interface, and it has probably already filled in your database details for you (by reading your wp-config.php).
At the top of the screen there's a search field and a replace field. Don't mess with anything else, unless of course it actually failed to get your database information automaticall.
Like for files you need to search for:
your old absolute path and replace with your new absolute path (excluding trailing slash)
your old absolute URL and replace with your new absolute URL (excluding protocol http:// and trailing slash)
You can use the "Dry run" button first to see what will be changed, and if any obvious problems might arise - after that just click the "Live run" button and it'll chew through your entire database replacing in a serialize()-safe way where relevant.
Step 6,5 Broken permalinks
If you have moved your site from one folder to another folder (or up or down a level), then permalinks / "pretty URLs" may not work (ie. your front page is fine but everything else is one big error). This is because of the rules in that "hidden" .htaccess-file getting "confused". The fix is very simple - just visit the "Settings" -> "Permalinks" in the wordpress admin... you don't need to make any changes, the file is automatically refreshed as soon as you visit the page.
Done
Check that everything works, then go celebrate...
Your directives are in the wrong format. Try
upload_max_filesize = 64M
post_max_size = 90M
memory_limit = 128M
max_execution_time = 120
If those don't work, ask your webhost; you may not be able to make changes in php.ini.
And try running debug https://codex.wordpress.org/Debugging_in_WordPress to catch PHP errors that may point the way to the issue and solution.
The only way to find out what is causing the blank screen is check your server error log.
And also take reference from here
try this,after making the necessary changes for uploading a file in php or wordpress i.e
post_max_size = 90M
max_execution_time = 120
upload_max_filesize = 64M
memory_limit = 128M
other steps,
1)Increase the PHP memory limit via .htaccess (e.g. php_value memory_limit 64M)..
2)Increase the PHP memory limit via wp-config.php (e.g. efine(‘WP_MEMORY_LIMIT’, ’64MB’);)
finally check,
https://codex.wordpress.org/Importing_Content
These steps may help:
After showing the blank page, the page keeps running in background (you can see this in flight by refreshing the wp_posts table or wp-admin)
Inside wp-includes/deprecated.php there is a function named wp_get_http() with #set_time_limit( 60 );, change this to 0 to disable limitation.
This worked for me:
No images imported
Wordpress Tools > Export did not attach images even though settings state it to be true. The import process on the target site crashes. To fix that I installed the DeMomentSomTres Export plugin on the exporting site that forces the import process on your target site to make a connection to the export site and then pull the images over. That worked well.
No content when editing
However, when editing the imported posts, the content wysiwyg editor box appeared empty even though the text would display on the front end. Initially I thought it was a database issue. Then, I tried deactivating Classic Editor plugin and edited a post. Whaa-la the content appeared in edit mode. Next, after re-activating Classic Editor plugin, the content stuck. All good.
I got the same behavior today while exporting All Posts and Media from a client site using the usual WordPress Importer.
I tried changing the PHP.ini settings suggested in other answers, but that didn't help probably because they can't be overridden. Importer will stop showing the loading icon after 1 minute or two. No errors appeared even when I set DEBUG to true.
However, when I checked the wp-content/uploads folder I could see some of the folders and images were uploaded (check modified date) yet the execution timeout stops the importer before it can finish.
My solution was to keep importing the same file again and again until the whole thing is finally imported. This works fine because WordPress Importer won't import a Media or a Post again if it's already imported/exists.
So even if there is a timeout setting you can't change, multiple attempts will get it done unless you have huge media files exceeding max file size.
Of course, if it's a huge amount of images you should find another solution.

Wordpress Site and W3 Total Cache through Apache PHP-FPM FastCGI

I've setup an Apache server with Wordpress and after installing several plugins I noticed the page load times went up to 30 seconds or more so I followed several guides to fine-tune and Speed up Apache by removing modules, enabling deflate, changing worker processes, etc...
One of the changes I made was removing mod-php and using php-fpm through mod-fastcgi, afterwards I noticed several bizarre errors. W3 Total Cache reported that htaccess was not writeable despite the fact it belongs to the same user and group and I even made it world-writable (777 Permissions) and minify can't work because it can't write any changes to htaccess.
Not only that but Minify is giving off 2 more bizarre messages
Minify Auto encountered an error. The filename length value is most likely too high for your host. It is currently 150. The plugin is trying to solve the issue for you
To which it sits there trying to fix and then says
Minify Auto does not work properly. Try using Minify Manual instead or try another Minify cache method. You can also try a lower filename length value manually on settings page by checking "Disable the Minify Auto automatic filename test”
Also the compatibility check produces strange messages as well claiming that a number of modules aren't detected which are loaded, I did some quick research and found that the modules are just simply difficult to detect through fast-gi but I wonder if the plugin is doing anything given it cant detect them.
Any help would be appreciated
W3 Total Cache 'Minify Auto' under Apache/PHP-FPM
I experienced the same issue with W3 Total Cache (W3TC) and its 'Minify Auto' feature under Apache with PHP-FPM.
Problem in brief
When PHP is invoked in FastCGI mode, some CGI variables such as SCRIPT_NAME and PATH_INFO are not always set to the values expected by script developers. In my case, the value of SCRIPT_NAME was the path of the php5-fcgi executable (/usr/lib/cgi-bin/php5-fcgi), rather than that of the PHP script itself.
The minify module code in the W3TC plugin expects SCRIPT_NAME to be set correctly, and fails when it isn't.
Solution
The php.ini directive, cgi.fix_pathinfo, works around this 'CGI variables' issue when enabled. In my case, I had disabled this setting, and reenabling it resulted in generation of the correct SCRIPT_NAME and resolved the minification issue.
Instructions for a Debian/Ubuntu system
To reenable, change the setting in /etc/php5/fpm/php.ini:
cgi.fix_pathinfo = 1
And reload the php-fpm service:
sudo service php-fpm reload
Caveat
Note there have been security concerns dating from 2010 regarding the use of the cgi.fix_pathinfo setting in misconfigured Nginx sites (see here for details), however I haven't been able to reproduce this under an Apache setup.
Since PHP 5.3.9, a (poorly documented) new FPM configuration directive, security.limit_extensions has been introduced. This defaults to limiting execution to .php files only, and as far as I can tell this should mitigate the historical security issues.
Problem in detail (for those who care)
The broken CGI variables cause a problem in the W3TC function that derives the cache directory path.
This in turn causes the minify .htaccess file to be written to disk with the malformed cache path in the RewriteBase directive.
In my case, it was:
RewriteBase inify/
Rather than:
RewriteBase /wp-content/cache/minify/
This affects the subsequent rewrite rules, which ultimately prevents the minification code (which relies on these rules) from being invoked correctly.

Handle lots of session files with apache2 and php

I'm currently running into a huge problem regarding performance more precisely: Load generated through lots of I/O on an flat sessions folder with lots of files (+100.000).
The sessionfiles/htdocs folder is located on an managed storage - two seperate servers (behind a loadbalancer) are using these files (apache2) through an nsf-mount and are accessing the same sessions folder (to keep it persistent) at once.
Unfortunately the project is highly frequented and is generating a lot of sessionfiles. Even with ans max_lifetime of 2 hours we're generating +100.000 sessionfiles which is way to much for IO Nodes.
Is there a possibility to split - dynamically - these sessions into subfolders? e.g. all sessionfiles with sess_1* into /tmp/sessions/1, sess_2 into /tmp/sessions/2 and so on? With this approach the storage/IO Nodes only had to handle ~10.000 each folder which should speed up the garbage collection and should guard against IO Load.
I found this excerpt from the PHP (session.save_path) doc:
http://de3.php.net/manual/en/session.configuration.php#ini.session.save-path
There is an optional N argument to this directive that determines the
number of directory levels your session files will be spread around
in. For example, setting to '5;/tmp' may end up creating a session
file and location like
/tmp/4/b/1/e/3/sess_4b1e384ad74619bd212e236e52a5a174If . In order to
use N you must create all of these directories before use. A small
shell script exists in ext/session to do this, it's called
mod_files.sh, with a Windows version called mod_files.bat. Also note
that if N is used and greater than 0 then automatic garbage collection
will not be performed, see a copy of php.ini for further information.
Also, if you use N, be sure to surround session.save_path in "quotes"
because the separator (;) is also used for comments in php.ini.
Does anyone have been implementing this before in php and could provide me with some sample php code to handle sessionfiles in subfolders using this mod_files.sh?
unfortunatly its pretty poorly documented ...
Sometimes the solution is easier than it might appear at first. Somehow I thought the PHP has to handle and manage the apache requests to the sessions directory tree. However the Apache does it on its own once the session:save_path has been changed.
1.) call this (modified) script ( http://snipplr.com/view/27710/modfilessh-php/ ) once via ssh:
*sh path/to/script/mod_files.sh path/to/sessions depth* (in my case: "mod_files.sh /tmp/sessions 1"
2.) doublecheck chown rights of new sessions directory tree
3.) change "session.save_path" to "1;/tmp/sessions"
Thanks for your help nevertheless!

Eclipse - stack overflow errors

Since some time I'm having problems with Eclipse. When opening any file with a class which extends one specified class (Presenter), an error occurs:
Multiple problems have occurred http://img64.imageshack.us/img64/9678/screeneclipseproblems.png
Internal Error http://img202.imageshack.us/img202/5131/screeneclipseproblemspr.png
I've noted, that problems occurs only when loading the mentioned class - Presenter.
When I delete "extends Presenter" or when I delete the file, which contains class Presenter, the problems dissappear.
Class Presenter is part of the PHP framework Nette, so you can see the contents of this class here:
http://api.nette.org/1.0/__filesource/fsource_Nette-Application__ApplicationPresenter.php.html
I can provide contents of LOG files, if that may help, but those are large (over 1 MiB).
I faced the same problem. Here is the way to fixe it:
First goto [workbench_directory]/.metadata/.plugins/ - remove the folder named "eclipse.org.core.resources" and keep a copy of it.
Now go to the eclipse directory using CommandPrompt(Windows) or Terminal(in linux,mac)
write the command $ eclipse -clean ---> this will start your eclipse application.
Now close the eclipse application and restore the "eclipse.org.core.resources" folder that you removed in the First step.
That's it! You won't see the problem.
What exact version of Eclipse and PDT are you using?
There was a bug last month about that kind of error: bug 316876, but it appears to be fixed in PDT-2.2.0.v20100616.
Check also your eclipse.ini like, for instance, this ones (depending on your eclipse version).
You can increase VM stacksize and check. But a better solution would be to work out how to avoid recursing so much.
Add the flag -Xss1024k in the VM arguments for starting Eclipse (in eclipse.ini file in your Eclipse installation folder).
You can also increase the stack size in MB, by using -Xss1m for example.
I'm running Eclipse Indigo. I've adding the following to my eclipse.ini file as I didn't have them in there.
-Xmx1024m
-Xss1m
I haven't been able to salvage my Eclipse installation. The Error logs in Eclipse pertain to issues with the OSGI and Team plugin. I can try uninstalling these.

Categories