- Overview
- How to Test
- Debugging What Went Wrong
- Error Messages found in the log and the corresponding functions
- Debugging Help
- I've placed my script in the proper location within the InterWorx-CP tree, but when I try to go to ScriptWorx in SiteWorx, I get a white screen.
- When I click the install link from ScriptWorx, I get the following message: » No such script : <scriptName> - <version> and I don't see any of my custom fields.
- ScriptWorx says my script was successfully installed but when I launch the script all I get is a white screen
- My script installation failed and iworx.log says "Install DBs failed"
- My script installation failed and iworx.log says "There was a problem untarring the files to the installation directory"
- My script installation failed and iworx.log says "Configuring the dbs failed"
- My script installation failed and iworx.log says "Installing Config File Failed"
- My script installation failed and iworx.log says "Removing Temporary Install Files failed."
- My script installation failed and iworx.log says "Setting Final Permissions failed."
- My script installation failed and iworx.log says "Moving script to final location failed."
- When I try to install my script, I receive a blank red box at the top of my screen and my script is not in the installed script list, what happened?
- During installation of my script I am returned to the main ScriptWorx screen with no messages and I see my installation listed. What happened?
- I placed my script in the correct location within the InterWorx-CP file tree, but it's not showing in the NodeWorx ScriptWorx list
- I placed my script in the correct location within the InterWorx-CP file tree, but it's not showing in the SiteWorx ScriptWorx list
- My script shows up in the SiteWorx script list but says 0.00 MB in the Storage Needed column.
Overview
This document will detail how to test your custom script as well as give you some useful tips in debugging what (if anything) has gone wrong. If you need detailed instructions on adding your custom script, see Adding a Custom Script to ScriptWorx
If you run into a situation that is not listed here and you think it should be, please post it to the InterWorx forums and it will make its way into this document!
How to Test
Once you’ve written your class and placed the archive and .php file in the proper place it’s time to see if it works!
- Log in to the SiteWorx account where you wish to install the script.
- Get to the ScriptWorx interface.
- Click on the [ Install ] link next to your script.
- Fill in the appropriate details.
- Click the button.
- If all went well your script will be installed. If not, see the debugging section for help in diagnosing and fixing the problems.
Debugging What Went Wrong
When something goes wrong with a script installation, the first place to look for information is the iworx.log file. iworx.log can be found at /home/interworx/var/log/iworx.log. A sample entry from the log file follows. The sample shows a failed installation and what type of thing you should be looking for in the log.
Nov 07 12:39:48 scriptworx.php [debug] scriptworx.php --install mydomain phplist 2.10.2 /home/mydomain/mydomain.com/html/mylist location=mylist,username=user,password=pass,email_address=me@mydomain.com,version=2.10.2, Nov 07 12:39:50 mysql.php [info] script begin Nov 07 12:39:50 mysql.php [debug] mysql.php --chgrp --gid 581 --database mydomain_phpl1 Nov 07 12:39:50 mysql.php [info] script end Nov 07 12:39:51 scriptworx.php [debug] importing databases Nov 07 12:39:54 scriptworx.php [info] ScriptWorx: Installing Config File failed.
Error Messages found in the log and the corresponding functions
Parent Class Error Messages
The error messages in red are ones that you as developer have no control over and if received should be reported to the InterWorx development team.
- "ScriptWorx: Setting up the databases failed."
- "ScriptWorx: Adding installation to db tables failed."
- "ScriptWorx: Unable to create script dir structure."
- "ScriptWorx: Removing Temporary Install Dir failed."
- "ScriptWorx: Error generating manifest file"
- "Scriptworx: Error Chowning Files."
Subclass Error Messages
The error messages in green are ones that your subclass code directly influences. If you see one of these error messages in the log, you should investigate why the function is erroring out.
- "ScriptWorx: Failure unpacking the archive." --> Debug _unpack()
- "ScriptWorx: Preinstall failed." --> _preInstall()
- "ScriptWorx: Install DBs failed." --> Debug _installDBs()
- "ScriptWorx: Configuring the dbs failed." --> Debug _installDBConfig()
- "ScriptWorx: Installing Config File failed." --> Debug _installFileConfig()
- "ScriptWorx: Removing Temporary Install Files failed."--> Debug _removeInstallFiles()
- "ScriptWorx: Setting the final permissions failed." --> Debug _setPermissions()
- "ScriptWorx: post install failed." --> _postInstall()
- "ScriptWorx: Moving script to final location failed."--> Debug _moveToFinalLocation()
Debugging Help
As with any php development, a decent way to debug what went wrong is to litter your code with print statements. ScriptWorx will dump output to the screen when a subclass function returns false. The easiest way to get output from your php code is to isolate the php function in question, add print statements, and return false from the function. Returning false will indicate to ScriptWorx that a particular step of the installation process failed and ScriptWorx will dump to the screen any output directed to stdout such as print statements. Below is an example where we we return false from a function to determine what values are.
| Because returning false indicates a failed script installation, ScriptWorx will clean up the failed installation by removing the temporary install files, database entries, databases, and database users created by the script installation. |
function _postInstall() { $temp_install_dir = $this->_getInstallDir(); $blog_dir_htaccess = "$temp_install_dir/blogs/sample.htaccess"; $admin_dir_htaccess = "$temp_install_dir/blogs/admin/sample.htaccess"; $mvto_admin_htaccess = "$temp_install_dir/blogs/admin/.htaccess"; // We want to print out the values of the following variables to make sure they are what we are expecting. print( "$blog_dir_htaccess\n" ); print( "$admin_dir_htaccess\n" ); print( "$mvto_dir_htaccess\n" ); $retval = IWorxFileSys::iworx_mv( $blog_dir_htaccess, "$temp_install_dir/blogs/.htaccess", true ); $retval2 = IWorxFileSys::iworx_mv( $admin_dir_htaccess, $mvto_admin_htaccess, true ); // See if the moves succeeded. If they return 0, we're all set. print( "First Move: $retval\n" ); print( "Second Move: $retval2\n" ); if( $retval != 0 || $retval2 != 0 ) { $error = array( 'name' => '', 'status' => false, 'reason' => '##LG_SCRIPTWORX_DELETING_INSTALL_FILES_ERROR##'); return( $error ); } return( false ); //return( true ); }
I've placed my script in the proper location within the InterWorx-CP tree, but when I try to go to ScriptWorx in SiteWorx, I get a white screen.
Most likely, this means you have an error in your class file. You can find out the exact error one of two ways:
- Open up
/home/interworx/iworx.ini - Search for debug=
- Set only that value to 1
- Reload the ScriptWorx page.
or:
- From the command line run
php -l /path/to/your/script.php
When I click the install link from ScriptWorx, I get the following message: » No such script : <scriptName> - <version> and I don't see any of my custom fields.
This is usually a problem with permissions.
- Verify that the script class file has the proper permissions and owner. (The class .php file should be grouped to iworx and owned by the iworx user)
ScriptWorx says my script was successfully installed but when I launch the script all I get is a white screen
This usually indicates that the configuration (values in the script’s config file or database tables) of the script is not correct.
- Verify that all of the config files and database tables have valid and proper values.
- Verify there are no syntax errors in the script config files.
- Verify that the permissions are set properly on the script config files.
You can use the following command to syntax check a .php file: php -l /path/to/file.php |
My script installation failed and iworx.log says "Install DBs failed"
Most likely one of two things is happening.
- ScriptWorx cannot connect to the database to import the db tables.
- The .sql file being imported is invalid or not compatible with the version of MySQL on the server.
In case of #1, try to verify that you can connect to MySQL on 127.0.0.1 and localhost by doing the following (for the password enter the DSN grepped from the iworx.ini file):
[root@vpsdev3-fdr20-2 root]# grep "rootdsn" ~iworx/iworx.ini rootdsn="mysql://iworx:jgCBF7QUKuoP@unix(/var/lib/mysql/mysql.sock)/mysql" [root@vpsdev3-fdr20-2 root]# mysql -u iworx -h 127.0.0.1 -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5182 to server version: 3.23.58 Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>quit Bye [root@vpsdev3-fdr20-2 root]# mysql -u iworx -h localhost -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5182 to server version: 3.23.58 Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>quit Bye
If you get the mysql> prompt, ScriptWorx can successfully connect to the database. If, when trying to connect you get an error like “Too many failed connections” you need to execute the following:
[root@vpsdev3-fdr20-2 root]# mysqladmin flush-hosts -h localhost -u iworx -p Enter password: [root@vpsdev3-fdr20-2 root]# mysqladmin flush-hosts -h 127.0.0.1 -u iworx -p Enter password:
In case of #2, open up the .sql file you are trying to import it and try to narrow down what part of the file is causing the database import to fail. Many times it’s due to the sql having directives that are only recognized in a newer version of MySQL than what is present on the server.
My script installation failed and iworx.log says "There was a problem untarring the files to the installation directory"
Usually when this fails it’s because the path to the archive is wrong or the archive name is incorrect. It is often useful to print out and verify the values of three things:
- The command that is being run by IWorxExec::exec
- The directory where the archive is supposed to be unpacked to.
- The path to the archive.
My script installation failed and iworx.log says "Configuring the dbs failed"
Look in the _installDBConfig() function and make sure that there are no syntax errors in the sql used to modify the database tables. Often times it is helpful to isolate the sql statement and try to run the query on the database via phpMyAdmin or the MySQL command line interface. Also, you need to verify that the proper tables and fields are being accessed in the database.
My script installation failed and iworx.log says "Installing Config File Failed"
Most of the problems in this function are one of two things.
- The paths to the files you are trying to use/modify are not correct.
- You’re using IWorxFileSys::iworx_lock_barf instead of IWorxFileSys::iworx_barf or vice versa.
My script installation failed and iworx.log says "Removing Temporary Install Files failed."
Usually if there is a problem here it’s with the paths used in the IWorxFileSys::iworx_rm call(s). Verify that your paths are correct.
My script installation failed and iworx.log says "Setting Final Permissions failed."
Usually if there is a problem here it’s with the paths used in the IWorxFileSys::iworx_chmod call(s). Verify that your paths are correct.
My script installation failed and iworx.log says "Moving script to final location failed."
Usually if there is a problem here it’s with the paths used in the IWorxFileSys::iworx_mv call(s). Verify that your paths are correct.
When I try to install my script, I receive a blank red box at the top of my screen and my script is not in the installed script list, what happened?
Check /home/interworx/var/log/iworx.log to see where the error occurred in the installation process.
During installation of my script I am returned to the main ScriptWorx screen with no messages and I see my installation listed. What happened?
This usually happens when there is a php error in the script that caused early termination. For example, an undefined function being called (generateTempDir != _generateTempDir). Verify that you are calling all of the correct functions.
I placed my script in the correct location within the InterWorx-CP file tree, but it's not showing in the NodeWorx ScriptWorx list
Verify that the _package_glob and _package_ver_regex in the constructor for the object match the name of the archive (this is case sensitive). The * in the two variables represents the version number of the script package. An example follows.
The archive name is the following: b2evolution-0.9.1b-2005-09-16.zip and it can be found at /home/interworx/lib/scriptworx/b2evolution/0.9.1b
The corresponding variables in the constructor should be as follows:
$this->_name = "b2evolution"; $this->_package_glob = "b2evolution-*-2005-09-16.zip"; $this->_package_ver_regex = "b2evolution-(.*)-2005-09-16.zip";
I placed my script in the correct location within the InterWorx-CP file tree, but it's not showing in the SiteWorx ScriptWorx list
Verify that the script is enabled in NodeWorx. The following procedure explains how to do this.
- Click on the menu if it is not already expanded.
- Click on the ♦ ScriptWorx item.
- You should now be looking at the ScriptWorx controls in the main content area.
- Locate the ScriptWorx Global Options section.
- Select Enable or Disable from the drop-down labeled ScriptWorx.
- Click the button.
My script shows up in the SiteWorx script list but says 0.00 MB in the Storage Needed column.
Verify that the variable _package_ver_regex in the constructor for the object matches the name of the archive (this is case sensitive).
The archive name is the following: b2evolution-0.9.1b-2005-09-16.zip and it can be found at /home/interworx/lib/scriptworx/b2evolution/0.9.1b
The corresponding variables in the constructor should be as follows:
$this->_name = "b2evolution"; $this->_package_ver_regex = "b2evolution-(.*)-2005-09-16.zip";
