cancel
Showing results for 
Search instead for 
Did you mean: 

Please help this newbe - 3 subjects

OldDuffer
Dabbler
Posts: 23
Registered: ‎31-07-2007

Please help this newbe - 3 subjects

Being new to using CSHELL I would appreciate help in idiot format.
1. I have uploaded a file 'name.tar.gz' into a directory 'xx'. How do I extract it into the 'xx' directory.
2. I have uploaded a file 'name.mysql.sql' into a directory 'xx'. What do I do to import that into MySQL.
3. I have a .'htaccess' file in directory 'xx' which stops any php file from running (including 'phpinfo.php'). The 'phpinfo.php' file runs if I remove the '.htaccess' file.
Directoryindex index.php
# AUTENTICAZIONE (qualora servisse)
#AuthType Basic
#AuthName "Area Riservata"
#AuthUserFile "/var/www/passwd/filepassword.pwd"
#AuthGroupFile /dev/null
#require user nome_utente
# FINE AUTENTICAZIONE -----------

The vendor of this program states it requires Apache 2.x web server, MySQL 5.x PHP 5x, and states that it is better to use PHP in Apache mode. You can use it with PHP in CGI mode but may encounter unexpected behaviour.
See 'http://www.vfront.org/'
My thanks in advance
8 REPLIES 8
Aubs
Grafter
Posts: 26
Registered: ‎24-10-2010

Re: Please help this newbe - 3 subjects

1. type in: tar xvzf name.tar.gz
2. Take a look here: http://support.modwest.com/content/6/241/en/how-do-i-import-a-mysql-dumpfile-into-my-database.html
3. The only line in that .htaccess file that is doing anything is the first line. Everything else is commented (hashed) out. Try correct capitalisation of DirectoryIndex (that's a capital i).
Aubs
Ben_Brown
Grafter
Posts: 2,839
Registered: ‎13-06-2007

Re: Please help this newbe - 3 subjects

Unfortunately due to the nature of the ccgi platform we use PHP with suexec, which means we have to use PHP in cgi mode rather than an apache module.
Also, we don't allow DirectoryIndex to be used in an .htaccess file, so it will fail. It is currently set as below:
DirectoryIndex index.html index.html.var index.htm index.shtml index.cgi index.pl index.php

If that .htaccess file doesn't have anything else in that isn't commented out, you don't need it.
To extract the file and import the sql you'll need a script like the one below, put your details in the section at the top.

#!/bin/bash
##### EDIT THESE DETAILS #####
# Input details
TARFILE=name.tar.gz
SQLFILE=name.mysql.sql
# MySQL details
USERNAME=your_username
PASSWORD=your_password
SERVER=rumpus_or_humbug
DATABASE=your_database_name
###### DO NOT EDIT BELOW THIS LINE #####
echo -e "Content-type: text/plain\n"
echo -n "Extracting Tar file: "
tar xzf $TARFILE
if [ $? -ne 0 ]
then
  echo "Failed"
  exit 1
else
  echo "OK"
fi
echo -n "Importing mysql database: "
mysql -u$USERNAME -p$PASSWORD -h$SERVER $DATABASE < $SQLFILE
if [ $? -ne 0 ]
then
  echo "Failed"
  exit 1
else
  echo "OK"
fi
echo "All done"
exit 0

Call this script 'install.cgi', and upload it to xx. Give it execute permissions and then browse to it in your browser. It may take a few seconds to run, be patient.
spraxyt
Resting Legend
Posts: 10,063
Thanks: 674
Fixes: 75
Registered: ‎06-04-2007

Re: Please help this newbe - 3 subjects

Quote from: OldDuffer
The vendor of this program states it requires … MySQL 5.x …

The version of MySQL is currently 4.1.11 which does not meet that requirement.
Why not use phpMyAdmin to access your database?
https://mysql.plus.net/index.php
David
OldDuffer
Dabbler
Posts: 23
Registered: ‎31-07-2007

Re: Please help this newbe - 3 subjects

Quote from: spraxyt
Quote from: OldDuffer
The vendor of this program states it requires … MySQL 5.x …

The version of MySQL is currently 4.1.11 which does not meet that requirement.

I looked at the phpadmin results and saw under MySQL that the only reference was to client (V5.0.51a). I assumed that the server would be the same verson.
OldDuffer
Dabbler
Posts: 23
Registered: ‎31-07-2007

Re: Please help this newbe - 3 subjects

Re extract and import script - this fails.
Quote
Why not use phpMyAdmin to access your database?
 
The results:
Quote
Error
You probably tried to upload too large file. Please refer to documentation for ways to workaround this limit.
--- SQL file is 333Kb  MySQL states file size limit is Max: 2,048 KiB

or
Quote
Error
SQL query:
CREATE DATABASE sample;
MySQL said:
#1044 - Access denied for user 'g4ddm'@'%' to database 'sample'

I can create a table by using an individual table structure copied from the sample.sql file.
spraxyt
Resting Legend
Posts: 10,063
Thanks: 674
Fixes: 75
Registered: ‎06-04-2007

Re: Please help this newbe - 3 subjects

Quote from: OldDuffer
I looked at the phpadmin results and saw under MySQL that the only reference was to client (V5.0.51a). I assumed that the server would be the same verson.

Yes, the client API is version 5.0.51a, but MySQL is version 4.1.11.
Quote from: OldDuffer
Quote
Error
SQL query:
CREATE DATABASE sample;
MySQL said:
#1044 - Access denied for user '…'@'%' to database 'sample'

I can create a table by using an individual table structure copied from the sample.sql file.

What you are trying to create from the SQL file appears to be a database. You can't do this, hence the error message. You have to work with the database set up for you when you activated MySQL.
You can create tables within this database as you discovered. The usual way to prevent table-name clashes across applications is to use an appropriate suffix.
David
OldDuffer
Dabbler
Posts: 23
Registered: ‎31-07-2007

Re: Please help this newbe - 3 subjects

Thank you, you have given me a clue.
I have looked at the sample.sql file with textpad. Am I right in my assumption that the first section is tying to create a new sql database and the actual code useable of F9 starts here:
--
-- Table structure for table `zzsys_access_level`
--
CREATE DATABASE sample;
USE sample;
CREATE USER 'sample'@'localhost' IDENTIFIED BY 'samplepass';
GRANT ALL PRIVILEGES ON `sample` . * TO 'sample'@'localhost' WITH GRANT OPTION;
-- MySQL dump 10.13  Distrib 5.1.40sp1, for unknown-linux-gnu (x86_64)
--
-- Host: localhost    Database: vanilla
-- ------------------------------------------------------
-- Server version 5.1.40sp1-enterprise-gpl-pro-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `zzsys_access_level`
--
DROP TABLE IF EXISTS `zzsys_access_level`;
/*!40101 SET @saved_cs_client    = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `zzsys_access_level` (
  `zzsys_access_level_id` varchar(15) CHARACTER SET latin1 NOT NULL DEFAULT '',
  `sal_name` varchar(50) CHARACTER SET latin1 DEFAULT NULL,
  `sal_description` varchar(200) CHARACTER SET latin1 DEFAULT NULL,
  `sys_added` datetime DEFAULT NULL,
  `sys_changed` datetime DEFAULT NULL,
  `sys_user_id` varchar(15) CHARACTER SET latin1 DEFAULT NULL,
  PRIMARY KEY (`zzsys_access_level_id`),
  KEY `accName` (`sal_name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin7;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `zzsys_access_level`
--
LOCK TABLES `zzsys_access_level` WRITE;
/*!40000 ALTER TABLE `zzsys_access_level` DISABLE KEYS */;
/*!40000 ALTER TABLE `zzsys_access_level` ENABLE KEYS */;
UNLOCK TABLES;

I have learnt a lot today, now I only have to remember it.
spraxyt
Resting Legend
Posts: 10,063
Thanks: 674
Fixes: 75
Registered: ‎06-04-2007

Re: Please help this newbe - 3 subjects

Yes, you are correct. The first four lines attempt to create a database and user for it, and need to be removed to make the file usable on ccgi.
David