Cchost/guide/Troubleshooting

From Creative Commons
Jump to: navigation, search


Docs Home Install Upgrade Troubleshoot Customize Admins Devs Content Query Templates Commands Skins

Known Issues

Please consult our bug tracker for the latest list of unresolved issues.

Blank Screen On Upload

PHP is notorious for returning a completely blank screen when uploading a file fails under some circumstances. Unfortunately those circumstances are hard to track down because of this lack of error reporting.

The most common reasons have to do with file access conflicts in Apache as well as memory allocation and other settings in your PHP configuration.

For ccHost 5.1 you can check your installation by clicking on Global Settings then Check PHP Settings (or browsing to /ini_settings).

Otherwise these settings should be sufficient:

  • file_uploads On (1)
  • upload_max_filesize 10M
  • post_max_size 10M
  • memory_limit 10M
  • max_execution_time 120
  • max_input_time -1

If you are still having problems, to make sure that uploading works on your installation, copy the following code to test_upload.php in your root installation and browse to /test_upload.php :

  <html>
  <body>
  <?
  error_reporting(E_ALL);
  upload_file();
  print_form();
  
  function print_form()
  {
  ?>
  <form enctype="multipart/form-data" action="test_upload.php" method="POST">
  File: <input name="uploadedfile" type="file" /><br />
  <input type="submit" value="Upload File" />
  </form>
  <?
  }
  
  function upload_file()
  {
    if( empty($_FILES) )
    {
        echo "No files to upload";
        return;
    }
      
    $target_path = "content/admin/" . basename( $_FILES['uploadedfile']['name']); 

    if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
        echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
        " has been uploaded ";
        echo "<a href=\"" . $target_path . "\">download</a>";
    } else{
        echo "There was an error uploading the file, please try again!";
    }
  }
  
  ?>
  </body>
  </html>

Note that the code above assumes your content upload directory is called content and that you have a user called admin. Edit the code above to conform to your installation if these assumptions are not correct.

If the upload did not succeed then the problem is definitely in your operating system or PHP environment and not in ccHost.

If the upload did succeed there might be a problem with your getID3 installation. To test that possibility you'll need to edit a file within the ccHost installation called cchost_lib/cc-fileveryify.php In that file at about line 143 there is a line of code that looks like:

       CCDebug::QuietErrors();

You'll want to put two forward slashes in front of that line so it looks like this:

       // CCDebug::QuietErrors();

A few lines later do the same thing to the RestoreErrors calls so it looks like:

       // CCDebug::RestoreErrors();


Now try your upload using the ccHost submit forms. If there is a problem with your getID3 installation, then the errors should lead you to what the solution is.

Once you have diagnosed the problem, make sure to return the PHP file you edited back to its original version for production sites!!

IE8 Layout Issues

Some of the screens in some of the skins are problematic for Internet Explorer 8.

The easy way to prevent these problems is to force "compatibility" mode using a meta tag in the skin.

To do this:

  1. Browse to admin/templatetags/profiles
  2. For the %(extra-meta)% field enter the following:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

If you don't see an 'extra-meta' field you can add one:

  1. Browse to admin/templatetags/new
  2. Type extra-meta into the field and submit

That should return you to the template tags editing screen where you can add the meta tag above.

File Access

By far the most common issue with new installs on Unix based systems involves file access permissions. The recommended way of dealing with this is to set the entire ccHost directory structure as all-access (0777) just while you get things going. If everything else is working then you should follow the ccHost file access guildlines.

No Flash Player (little speaker) for Audio Files

If you uploaded an audio file and expected a little speaker icon and the Flash (tm) player but don't see that it could be one of several things:

- The Flash(tm) will not show up on a page unless you have chosen the "Text appropriate for music sites" string profile, or one that derives from it, from admin/skins/settings screen. (This is a design flaw we will be addressing in the not-so-distant future.)

- Older versions of Flash only support MP3s and only those that are encoded with a sample rate divisible by 11 like 44k.

- You don't have a working Flash(tm) plugin installed in your browser.

Outputting Debug Messages

Debug messages are special messages that help ccHost developers troublshoot your site when there is a problem. The option to turn on debug message output is on by default in 5.0 installations and upgrades. The file that controls this option is <your_local_files>/lib/DEBUG.php. You can remove this file (or change the extension to something other than .php) and that will turn the option off debug output for your production site.

Variable Dumps

You can dump various records and environment variable at any time, right onto the screen.

First, you must enable debug mode as described above.

Then, as long as you logged in as admin, on any page browse to:

 <your_installation_root>?dump_page=1

That will list out all the global variables available to you (the user record is the currently logged in user).

To view the first record of the current page's Query API record results:

 <your_installation_root>?dump_rec=1

In other words, you can append dump_rec=1 to almost any URL to see what the Query API is returning:

 <your_installation_root>/files/victor/1234?dump_rec=1
 <your_installation_root>/people/teru?dump_rec=1
 <your_installation_root>/api/query?tags=remix&user=loveshadow&dump_rec=1

That will list out all the variables in a given upload record (the user record here is the one that uploaded the thing).

To dump the internal dataview use dpreview=1 instead.

Developer Dumps

ccHost developers have several options for dumping specific variables and getting state information.

All of these assume that debug mode has been enabled somewhere:

 CCDebug::Enable(true);

For dumping a variable to the screen:

 CCDebug::PrintVar($var);

For sending text to the log file determined at admin/paths:

 CCDebug::Log($text);

To dump a variable to the log use:

 CCDebug::LogVar( $text, $var );

Since ccHost is event based it's not always to figure "how I got here." For an abbreviated stack trace:

 CCDebug::StackTrace();

For a full blown (very expansive) version:

 CCDebug::StackTrace( false, true );

Repairing a broken configuration (A.K.A. HELP!!!!)

If you get into 'trouble' with your system you might be able to salvage your site by browsing to one of these URLs:

  • <your_root_installation>/admin/edit
  • <your_root_installation>?ccm=/media/admin/edit
  • <your_root_installation>/cchost_lib/cc-config-repair.php

If you are not logged in as an administrator when trying this you will have to:

  • Open the cchost_lib/cc-config-repair.php file in a text editor
  • Remove the two forward slashes // before the word 'return' in the line at the top of the file
  • Save this file to disk
  • From your browser, go to <your_root_installation>/cchost_lib/cc-config-repair.php. (This should bring up a configuration editor)
  • Click on the word media to open the configuration settings and see if you can spot the error
  • After you have fixed (or decided you can't fix) the problem make sure to the put the // back into the cchost_lib/cc-config-repair.php file otherwise you will leave a large gaping security hole in your site