Years of Web Developer Problems and Solutions

The following is a list of how I solved a large variety of issues encountered in the last 5+ years as a web developer. In many cases, I shorten down the problem and solution into 2 lines, even though the solution may have taken many, many hours to uncover.

Keep in mind the problems and solutions may not match your situation exactly. Use at your own risk.

Hopefully this thread can save a few folks hours of their lives, thus paying it forward for all the Google search help over the years.

Problem: git submodule update --init fails with No submodule mapping found in .gitmodules for path 'somedirectory'

Solution: The directory ‘somedirectory’ already exists. The git submodule is trying to initialize the directory, but can’t because it already exists. Do an rmdir somedir and git rm somedir and commit, push, and then re-run git submodule update --init

SFTP

Per https://forums.gentoo.org/viewtopic-t-733616.html, In a chrooted environment, /usr/ is unlikely to exist. That's alright though because you don't actually need to execute /usr/lib/misc/sftp-server to handle an SFTP connection. The SSH daemon has this functionality built-in.

Solution: Opened the Makefile and changed it to point at the folder where the libsvn_client libraries, and other SVN libraries, were located. SVN_SHARED_LIBADD = -Wl,-rpath,/usr/local/subversion/lib -L/usr/local/subversion/lib -lsvn_client-1 -lsvn_fs-1 -lsvn_repos-1 -lsvn_subr-1 -lapr-1 it was point to /usr/local/apache/lib

Problem: Error "Disk quota exceeded", but the disk space was at 44% and no quotas were set. Attempting to add one more file caused the error. Deleting any file, even a larger file, would allow for one file to replace it.

Solution: Hosting company had to increase the inodes limit for the VPS. This limits the number of files on a filesystem.

MySQL

Problem: #1037 - Out of memory; restart server and try again -- generated while running a query with ORDER BY. It became an issue after Furman and Britt Peters' servers were migrated to new machines.

Solution: It seems this issue can be fixed by increasing the "sort_buffer_size" memory value in MySQL's /etc/my.cnf configuration file. Increase to 80M for Furman before it worked. This is likely too high, but it worked.

Problem: #1114 - The table 'COLUMNS' is full OR The table '#sql-1cb8_39a1' is full query (while doing an ALTER ADD INDEX

Solution 1: Check the /etc/my.cnf and test increasing or decreasin limits on certain variables. This fixed the issue when an old my.cnf with high memory values was showing "table full"

Solution 2: Most likely there are odd character set characters in the data. For instance, if the database is old and was created on a Windows computer and moved to Linux. Try identifying odd dashes, hypens, ascent marks, apostrophes and double_quotes and replace them like UPDATE node_revisions SET body = REPLACE(body, "’", "'")

Reason: This occurred when the hostname of the server was changed. A process ID file using the hostname must get changed in the process and causes theProblem.

Solution: First, make sure your running the command as the root user or via sudo. Use `top` to find the PID of mysqld_safe and/or mysqld Then use `pkill -P {pid}` to stop the existing proceess(es). Then do a `sudo /etc/init.d/mysql start`

This may also occur if the diskinodes getting full, at which point the host would need to double the existing limit on the server

To check existing run-levels to sudo /sbin/chkconfig --list if mysql or mysqld doesn't exist then do making sure there exists a /etc/init.d/mysql (it must be executable – chmod +x), doing a chkconfig --add mysql and making sure that it starts up at the correct runlevels (typically 3, 4 and 5). A simple chkconfig --level 345 mysql on and you’re ready to rock.

Problem: Wrong bytesec when repairing a table (note: this was reached when reached during a test of restoring a database by doing a schema dump, moving .MYD files, and repairing tables/indexes)

Solution: In this case the wrong .MDY file was copied into the restore. (Note that this method of restoring is not 100% trusted, it was just a test)

Problem: When trying to import a database through PHPMyAdmin, “1153 -- 'max_allowed_packet' exceeded”

Solution: Under the [mysqld] section of /etc/my.cnf add a value like max_allowed_packet = 50M

Solution: Have the hosting company set the numiptent value has been set to 256 on your server and are able to restart the firewall The suggestedSolution on many message boards it that the VPS hosting company is able to increase the numiptent value.

Bash/sh Scripting

Problem: While executing an sh script the error "command not foundpts" and "not a valid identifier" along with strange behavior

Solution: Character set of the file is screwed up. Delete the file and create a new copy from scratch. The text editor used to create the original may be inserting breaklines or other non standard characters.

Solution: Install subversion 1.5.5 from source, link to the .so it creates and restart began working. Possibly an issue in the yum build not lining to BerkleyDB and/or BDB not being installed

Problem: After using EasyApache to rebuild Apache and PHP the error "/usr/local/modules/mod_dav_svn.so "Cannot open shared object file: No such file or directory"

Solution: SVN must be built against the new installation. Temporarily commented out the LoadModule modules/mod_dav_svn.so and LoadModule module/mod_authz_svn.so and then rebuilt SVN against Apache from source

Problem: 403 Forbidden

Solution: Ensure the linux account under which Apache is running (use `top` to find out) has access to the /home/account/public_html and also the files within it.

Problem: After installing SSL certificate, a restart shows no errors but still no connection

Solution: Verify port 443 is open. Open on any software (Lokkit/iptables) and hardware firewalls

Problem: 404 due to Rewrite rules and entire .htaccess file being ignored.

Problem: On Apache restart, “DocumentRoot /home/someuser/public_html does not exist.

Solution: SELinux is blocking. Use `setsebool -P httpd_enable_homedirs true` and then change the flags on the home directory via `chcon -R -t httpd_sys_content_t /home/someusername/public_html` then restart Apache again.

Problem: On restart "mixing * ports and non-* ports with a NameVirtualHost address is not supported"

Solution: If using cPanel/WHM then try running /scripts/rebuildhttpdconf

PHP

Problem: Recompiling with suPHP errors in Apache error log "SoftException in Application.cpp:592: Directory / is not owned by alliance" and "Premature end of script headers: index.php"

Solution: suPHP requires the / directory be owned by root. It was owned by a random userid. chown root:root / fixed this issue

Problem: After recompiling with suPHP errors in Apache error log “SoftException in Application.cpp:256: File "/home/example/public_html/index.php" is writeable by group”

Solution: Remove group write permission chmod -Rf g-w *

Problem: Configuring SSL Certificate in Apache .conf files with a .crt and .pem says “does not exist or is empty”

Problem: In Apache error logs, the following appears “symbolic link not allowed or link target not accessible” and files that are located in a symlink directory are not accessible.

Solution: In the /etc/http/conf/httpd.conf the main Options line probably includes +SymLinksIfOwnerMatch, it will need to be -SymLinksIfOwnerMatch in order for a user to follow a symlink outside of their home directory. Or, if using cPanel WHM go to Main >> Service Configuration >> Apache Configuration >> Global Configuration Main >> Service Configuration >> Apache Configuration >> Global Configuration and uncheck the SymLinksIfOwnerMatch checkbox and save.

Drush

Problem: When trying to do a drush update -l example.com Warning: Cannot use a scalar value as an array in ~/public_html//sites/all/modules/domain/domain.bootstrap.inc on line 58 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at ~/public_html/sites/all/modules/domain/domain.bootstrap.inc:58) in ~/public_html//includes/bootstrap.inc on line 1031

Solution: If the domains module is install the include statement at the bottom of the settings.php must be temporarily commented out.

Drupal 5

Problem: HTTP request staus fails, or Cron run failed, or Unable to fetch any information about available new releases and updates.

Solution: Correct Nameservers so they resolve the external IP addresses these scripts are calling. More details at http://drupal.org/node/222454#comment-1136650

Problem: httpd: bad user name key when trying to (re)start

Solution: Check configuration files for old VirtualHosts which declare a User or Group parameter. For instance, if an Apache conf file had a rule for a domain which is no longer hosted on the server and the account and directory have since been deleted.

Drupal 6

Problem: “Trying to clone an uncloneable object of class mysqli” when trying to use a mysqi connection.

Solution: Adding 'php_flag zend.ze1_compatibility_mode off' to the .htaccess fixed this, plus an issue with a certain page rendering a blank page with no error messages in PHP or Apache and a HTTP/0.9 200 OK response.

Problem: Unable to login, no database access

Solution: Edit the /modules/user/user.module and bypass the validation function, like

Solution: One possibleSolution is to change run the query UPDATE variable SET value = 'b:0' WHERE name = 'drupal_http_request_fails';

Problem: While upgrading from Drupal 5 to 6, a copy of the live Drupal database was made and setup as a development. When trying to login to Drupal (/user) with the development db Drupal would open a session but show "not authorized to access this page" on any secured page.

Solution: Restart MySQL

Problem: "Attempting to re-run cron while it is already running."

Solution: Clear the cache and remove cron_semaphore and cron_last from the variables table. If the cron job gets "stuck" and you're unable to access any admin/* page then just wait a while. It seems the php job may need to timeout.

Problem: After migrating a D6 sandbox to a new server the /admin/* pages, but not regular pages showed "maximum execution time of 30 seconds exceeded" in various /include/* files.

Solution: Set php_value max_execution_time 90 in the .htaccess file

Problem: The Comment wasn't showing a preview when the "Preview Comment" button was pressed

Solution: The button value was changed, it must be labedl "Preview", instead of something custom like "Preview Comment" because the comment_form function checks for ($op == t('Preview')

Problem: "directory does not exist" or "directory is not writable", despite 777 and appropriate permissions

Solution: On Fedora and other distros the SELinux can be running. Set each directory to make writeable by httpd, like this example

Solution: SELinx is blocking httpd from sending mail. To fix, run Then run sudo /usr/sbin/semanage boolean -l|grep sendmail and verify that the output of the command shows httpd_can_sendmail -> on httpd_can_sendmail

Note: Without the -P option, only the current boolean value is affected; the boot-time default settings are not changed. If the -P option is given, all pending values are written to the policy file on disk. So they will be persistent across reboots.

Problem: Ubercart's Payment methods "pane" doesn't render

Solution: Ajax was trying to call back to pages like, http://example.org/?q=cart/checkout/payment_details/credit, but these pages needed to use the https version. Adding /cart/checkout/* to the Securepages settings /admin/settings/securepages allowed the https versions of these ajax pages to load.

Problem: Unable to login because visiting /user redirects to https:// and no SSL certificate is present (usually when moving a copy to a development server or a dev domain name)

Solution: Temporarily move the /sites/all/modules/securepages directory to another name like /sites/all/modules/temp-securepages

Solution: Occurred when a theme was renamed. The old theme name was still being set as the default in a settings.php. Removing it ultimately fixed the issue. However, as best practice, before moving or deleting a theme you should really disable any blocks associated to it, and uncheck any options associated with it on /admin/build/theme

Problem: Went trying to use Drush just after it was installed. includes/table.inc: No such file or directory Drush needs a copy of the PEAR Console_Table library saved as Drush [error] includes/table.inc. Drush attempted to download this automatically, but failed. To continue you will need to download the 1.1.3 package from http://pear.php.net/package/Console_Table, extract, and move the file Table.php to includes/table.inc.

Solution: Log out and log back in. This happened when I installed drush as root and tried to immediately run it

Problem "Cannot use a scalar value as an array" when trying to use Drush

Solution: This is due to the "Domains" module requiring "include './sites/all/modules/domain/settings.inc';" in the bottom of settings.php files. Temporarily comment out the "include './sites/all/modules/domain/settings.inc';", run Drush, then re-enable it.

Problem: Block(s) created in a hook_block won't appear.

Solution: Check the blocks table and see if the status flag is set to 1 without a region being set. If so, remove the record and make sure the status value is not set in the hook_block unless a region is also specified.

Problem: "MySQL server has gone away query:" message, and a lot of them, when trying to access the /admin/build/securepages page

Solution: Occurs when the 'admin/build/securepages' page is visited via http://, not https:. Use PHPMyAdmin to temporarily disable the auto switching feature by executing update variable set value = 'b:0' WHERE name Like 'securepages_switch'; Then, flush the Cache tables. Then visit https://www.example.com/admin/build/securepages (be sure to use https). Then, Add admin/build/securepages to the list of "Make secure only the listed pages." Re-enable "Switch back to http pages when there are no matches" and Save

Problem: Upon adding a new domain, content is not visible to Anonymous users, but is visible to the admin, when Domain Access module is installed.

Solution: When the Domain Strict module is enabled the roles must be explicitly granted access to use new domain. This is done under the “User Defaults” tab /admin/build/domain/roles

Problem: Class 'XMLWriter' not found when trying to use xmlsitemap 6.x.2-beta2

Solution: yum install php-xml

Problem: Imagecache images won’t generate on PHP 5.1.6 even though the same code works on a different server.

Solutions: Permissions did not seem to be the issue. Going to Drupal’s Configuration -> File System and setting the download type to “Private”

was theSolution.

Drupal 7

Problem: Error logs show “The file permissions could not be set on public://filenamehere”. and Warning: filesize() [function.filesize]: stat failed for public://filenamehere in file_save() (line 573 of /home/example/public_html/includes/file.inc).

Solution: Drupal created a directory, literally named public: , in the root Drupal directory. Deleting this directory resolved the issue. This may have been caused by changing the location of the public file system path value via /admin/config/media/file-system after having used /sites/default/files Kudos for the Solution go to this thread

Solution: The .htaccess file in the parent folder of the virtual host root was causingProblems. Probably rewrites or messing with the AuthUserFile authentication. Renamed .htaccess and it works. It's probably best not to mix an SVN repo virtualhost and a regular website with it's own .htaccess in the same folder for various security reasons.

Problem: When using svn propedit svn:ignore . to ignore certain files, the use of svn add --force . doesn't pay attention to the ignore rules as it should according to the SVN book.

Solution: Used svn --version and found the active version was was old 1.1.4-2.ent Updated subversion to 1.5.5

Problem: When trying to use the http or https protocols the error "Unrecognized URL scheme for https"

Solution: Running svn --version shows there were no linked client libraries to handle http or https. Rebuilding the clients into the subversion and linking in neon and/or serf will provide for use of http and https

Problem: "svn: None of the environment variables SVN_EDITOR, VISUAL or EDITOR are set, and no 'editor-cmd' run-time configuration option was found" - When trying to issue a command like svn propedit svn:ignore .

Solution: Type export SVN_EDITOR=nano or for a permanent change, open ~/.bashrc and add SVN_EDITOR=nano

Problem: "error while loading shared libraries: libaprutil-1.so.0" when trying to do any svn command

Solution: Ensure the linux account is not running in a jail shell. (Go to WHM -> Manage Shell Access and change to "Enable Normal Shell"). Alternatively, there could be aProblem with the linked libraries not being read, which could be corrected by adding the .so file's path to /etc/ld.so.conf and then saving and running ldconfig

Solution: The file or directory already exists in the repo. Deleting the local copy and doing an SVN up may fix the issue. Then move the changes back into the working copy. If this doesn't work it may be best consider the working copy got corrupt. Make a copy of it, checkout a new copy of the entire repository and merge any changes from the corrupt copy as necessary.

Problem: When checking out a large set of files, “svn: REPORT of '/svn/repo/!svn/vcc/default': Could not read response body: Secure connection truncated”

Solution: By default, SVNPathAutz is on in the Apache config. Disabling path-based authorization, like via mod_authz_svn, to speed up access, but since we are using mod_authz_svn, it is best to keep it on. However, having it 'on' can cause "Secure connection truncated" errors on large checkouts, due to memory leaks. In those cases it can be temporarily turned off to allow the checkout, and then turned back on See, http://svnbook.red-bean.com/en/1.5/svn.serverconfig.httpd.html

PHPList

Solution: The From address in the message's From: textfield should be of the form "Actual Person" <actualperson@example.com> Otherwise it may default to something like default@example.com

Plesk

Problem: Email matching the web domain won't send from the web server, but email to other domains works fine.

Solution: Email is not leaving the web server and it delivered locally or to a queue. In Plesk, disabling Mail for the domain and pointing the MX records to the actual, remote MX server fixes. See Jim's post on 11/01/2010 here http://www.google.com/support/forum/p/Google+Apps/thread?tid=09165a87da6... for more details. It may be necessary to setup an A record within the web server’s DNS for the MX domain if that MX domain is the same as the emailing domain.