Tuesday, July 29, 2014

how to enable samba service

https://ask.fedoraproject.org/en/question/40353/how-to-enable-samba-share-for-a-specific-directory-fedora-20/

# useradd joe
# passwd joe

 or
adduser joe
 
smbpasswd -a joe


[accounts]
comment = Accounts data directory
path = /data/accounts
valid users = vivek raj joe
public = no
writable = yes
 
 # service smb restart
 

A note about adding users on Samba version 4.x

 
# /usr/local/samba/bin/samba-tool user add USERNAME-HERE
  

 # samba-tool user add USERNAME-HERE

Thursday, October 17, 2013

installed Xdebug on a Fedora 17 OS

I installed Xdebug on a Fedora 17 OS in order to use it with netbeans 7.3.1 It took me some time so I share with you how did I managed to have it working:
Install Xdebug:
sudo yum install php-pecl-xdebug
Add this lines to php.ini at the end of the file:
sudo vi /etc/php.ini
zend_extension=/usr/lib64/php/modules/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000

Add the same lines to xdebug.ini file:
sudo vi /etc/php-zts.d/xdebug.ini
xdebug.remote_enable=1 xdebug.remote_handler=dbgp xdebug.remote_mode=req xdebug.remote_host=127.0.0.1 xdebug.remote_port=9000
Allow port for Xdebug
sudo semanage port -a -t http_port_t -p tcp 9000
Now find your netbeans.conf file in your system:
sudo find / -name netbeans.conf
Now, open up the file and add the text "-J-Dorg.netbeans.modules.php.dbgp.level=400" in netbeans_default_options so that the line looks somewhat like this:
netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Dnetbeans.logger.console=true -J-ea -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.zip.disableMemoryMapping=true -J-Dsun.awt.disableMixing=true -J-Dnetbeans.extbrowser.manual_chrome_plugin_install=yes -J-Dorg.netbeans.modules.php.dbgp.level=400"
Restart both NetBeans IDE and apache:
sudo service httpd restart
if not working then use

SQLSTATE[HY000]: General error: 1 Can't create/write to file '/tmp

You messed up with /tmp permissions. To fix:
chown root:root /tmp (root:root is mysql username and password which you used)
chmod 1777 /tmp 
/etc/init.d/mysqld restart (mysqld service restart)

Tuesday, September 10, 2013

[SOLVED] How to fix filesystem error - Fedora

/dev/mapper/volgroup-lv_root contains a filesystem with errors checks forced

run below command

# /dev/mapper/volgroup-lv_root
# fsck -f  /dev/mapper/volgroup-lv_root

Thursday, September 5, 2013

MySql backup with php script

<?php

    $link = mysql_connect($host,$user,$pass);
    mysql_select_db($database_name,$link);

    $tableName  = '(select * from table_name where date(created_at) = "2013-09-04")';
  //$tableName = 'table_name';
    $backupFile = realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR.'backup.sql';

    $query      = "SELECT * INTO OUTFILE '$backupFile' FROM $tableName";

    $result = mysql_query($query);

    echo "backup complete";

    mysql_close($link);
    $link = null;

?>

Restore table script

<?php
 

    $link = mysql_connect($host,$user,$pass);
     mysql_select_db($database_name,$link);

    $tableName  = 'table_name';
    $backupFile = realpath(dirname(__FILE__)).DIRECTORY_SEPARATOR.'backup.sql';

    $query      = "LOAD DATA INFILE '$backupFile' INTO TABLE $tableName";
    $result = mysql_query($query);

    echo "backup restore complete";

    mysql_close($link);
    $link = null;

?>

Monday, August 12, 2013

X-Debug in php 5.4.17


I installed Xdebug on a Fedora 17 OS in order to use it with netbeans 7.3.1 It took me some time so I share with you how did I managed to have it working:

Install Xdebug:

sudo yum install php-pecl-xdebug

Add this lines to php.ini at the end of the file:

sudo vi /etc/php.ini

zend_extension=/usr/lib64/php/modules/xdebug.so

xdebug.remote_enable=1

xdebug.remote_handler=dbgp

xdebug.remote_mode=req

xdebug.remote_host=127.0.0.1

xdebug.remote_port=9000

Add the same lines to xdebug.ini file:

sudo vi /etc/php-zts.d/xdebug.ini


xdebug.remote_enable=1 xdebug.remote_handler=dbgp xdebug.remote_mode=req xdebug.remote_host=127.0.0.1 xdebug.remote_port=9000

Allow port for Xdebug

sudo semanage port -a -t http_port_t -p tcp 9000

Now find your netbeans.conf file in your system:

sudo find / -name netbeans.conf


Now, open up the file and add the text "-J-Dorg.netbeans.modules.php.dbgp.level=400" in netbeans_default_options so that the line looks somewhat like this:


netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Dnetbeans.logger.console=true -J-ea -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.zip.disableMemoryMapping=true -J-Dsun.awt.disableMixing=true -J-Dnetbeans.extbrowser.manual_chrome_plugin_install=yes -J-Dorg.netbeans.modules.php.dbgp.level=400"


Restart both NetBeans IDE and apache:

sudo service httpd restart

if not working then use

xdebug.remote_host=127.0.0.1 to ip address of computer

Saturday, March 23, 2013

how to install mongo db

Install mongo db step in centos/fedora

first check your os (32/64)
uname -m

Create a /etc/yum.repos.d/10gen.rep

open file and add bellow line in file and save the file (64bit os)
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0
enabled=1

open file and add bellow line in file and save the file (62bit os)
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686
gpgcheck=0
enabled=1

~]# yum install mongo-10gen mongo-10gen-server

~]# service mongo db start

~]# chkconfig --levels 235 mongod on

// step for install php mongo drive

~]# yum install php-devel git httpd

~]# export PHP_AUTOCONF=/usr/bin/autoconf

~]# export PHP_AUTOHEADER=/usr/bin/autoheader

~]# wget http://pecl.php.net/get/mongo-1.0.9.tgz

~]# tar -xzf mongo-1.0.9.tgz

~]# cd mongo-1.0.9

~]# phpize

~]# ./configure

~]# make install

~]# cd /etc/php.d

~]# vi mongo.ini

add bellow line in mongo.ini
extension=mongo.so

~]# service httpd restart

//test mongo db in prompt
//strat mongo
~]# mongo

//databse test use
>use test;

>doc = {"hello": "world", "php": "is alive!" };
>db.phptest.save(doc);
>db.phptest.findOne();

Example in php

<?php
$connection = new Mongo();
$db = $connection->test;
$collection = $db->phptest;

$obj = $collection->findOne();
echo "Hello " . $obj["hello"] . "!";

echo "Show result as an array:";
echo "<pre>";
print_r($obj);
echo "</pre>";

echo "Show result as JSON:";
echo "<pre>";
echo json_encode($obj);
echo "</pre>";


?>

install rockmongo for web view

download from rockmongo.com/downloads

extract file in web directory

create virtualhost


how to see xml preview in browser php

xml preview view in browser $xml = new DOMDocument('1.0', 'UTF-8');                 $xml->preserveWhiteSpace = false; ...