2012-02-18

How To Fix PHP Error Notice: Undefined variable: index

Today i have face this problem as listing below, and i have search a lot and try to fix my wamp server setting and waste my few professional hours. Im writing this so any other developer or designer not waste.

NOTE: This is just for those who wants to save their time to fix entire coding again to define variables. Otherwise i recommend must define variable before use them to avoid this error. 
this was the errors:
Notice: Undefined variable: q in in home.php on line 8
Notice: Undefined variable: module in home.php on line 11
you need to do some minor change on your php.ini file. please follow these steps
open your php.ini from wamp server and search “error_reporting = E_ALL & ~E_NOTICE
if that module not active, please active it.
and close (replace) 
error_reporting  =  E_ALL
to
;error_reporting  =  E_ALL
if any place.
——– 2nd step —— 
if you wont found this. only found
error_reporting = E_ALL
so replace that to
error_reporting = E_ALL & ~E_NOTICE
once you done please restarts your Apache server or “wamp” then go back to the page where you were getting this error and refresh the web page and you should not see this error anymore.

2012-02-14

unRAID, Slackware Development system, & Windows

unRAID, Slackware Development system, & Windows« on: June 16, 2009, 07:08:22 AM »QuoteWindoze... why?

Sometimes, you will want to upgrade the BIOS on your motherboard. For some motherboards, this can only be done in Windows. There is also, occasionally, some utility to being able to boot Windows on a Linux system.

So if you want a system that has:

- A full Slackware Development system
- Windows XP
- Cache drive for unRAID
- Swap partition of Linux

Here are the (abbreviated) instructions:

First, make sure you have a bootable DVD drive.
Install a hard drive that will be your CACHE drive for unRAID. Put it on a controller port that can be booted, and set your BIOS to boot this drive.

Boot DOS from CD or floppy
====================
Run fdisk /mbr
Run fdisk and wipe out entire partition table


Boot Slackware from Slackware DVD
====================
Run fdisk and create 4 partitions:

1. Linux (for cache)
2. Windows
3. Swap
4. Linux (for Dev)

Set #2 active (bootable)

Boot WinXP for CD
====================
Install Windows to #2

Boot Slackware DVD
====================
Make #4 active (bootable)
Run Sackwarre setup.
Create swap on #3
Make #4 your root fs.
Format #1 with reiser

DO NOT INSTALL LILO TO MBR! Install it to the Linux root partition (option 1).

Proceed with complete Slackware install.

Reboot. Lilo should give you option to boot Windows (default) or Linux. Boot Linux and change lilo.conf to make Linux the default if you want.

Congrats! Now you can use the Wiki instructions to add unRAID to the Linux system and build a new kernel.

Installing unRAID 5.0 on a full Slackware Distro

Random Notes for 64bit v13.37
Updated for 5.0Beta10 With some minor updates for beta13
(stolen from limetech forums and wiki for personal use)

Prerequisites and preparation
You need to be able to do the following on your own:
§ Install a virgin Slackware 13.1 system
§ Set up static IP under Linux.
§ Enable Apache and edit the Apache httpd.conf.
§ Edit various startup scripts in /etc/rc.d.
§ Run menuconfig, select drivers, and rebuild a kernel.
§ Debug panics caused by missing drivers in your kernel configuration.
§ Use a browser on nonstandard port numbers.
§ Edit lilo.conf to create multiple kernel boot options.
If you are doing this on an existing unRAID server, do NOT make any changes (adding or deleting drives) until this process is COMPLETELY done. If something goes fubar, go back to a standard unRAID setup booting from the USB, and get things stable and parity good BEFORE starting this process.
If you are doing this on an existing unRAID server, make sure your unRAID system is stable and parity is good BEFORE starting this process.
[edit]Start
1. Make a Slackware 13.1 DVD (http://www.slackware.com/getslack/)
2. Either use an existing unRAID flash or make a new one. You can make a new unregistered one for install process, and then swap it with your registered one later.
3. Boot unRAID from USB and confirm functionality with your mobo, drives, and controllers.
4. Save/print a copy of the syslog and dmesg output to help in identifying hardware when you make your own config.
5. Save a copy of the output from these commands, to assist you in identifying the hardware in your system:
1. lsmod
2. lsdev
3. lspci -v
4. ethtool -i
6. If migrating an existing unRAID server:
1. Go to "Devices" page of unRAID control panel and PRINT OUT the list of devices.... you will need it later.
[edit]Alternative Start
1. Make a Slackware 13.1 USB Installer using a new usb key
1. You can get the usb source from here
2. Not sure how to use reference, but instructions can be found here to setup your usb key to install
[edit]Install Boot Drive and Linux
1. Shutdown and disconnect all drives and USB sticks you're not using. They can cause problems later. It is only necessary if you are unable to keep track of which hard drive you are installing it to.
2. Install a DVD drive and one hard drive to be used for Linux and swap, that will NOT be part of the unRAID array.
§ Drive should be on primary IDE or SATA controller (i.e. /dev/hda or /dev/sda). Speed is not critical. Size is not critical, I used a spare 250GB I had laying around, but you can use anything about 20GB and up. A larger drive can be useful as temporary storage for things like nzbget, so your array drives can stay spun down. You can also combine a Slackware install with a cache drive.
3. Boot Slackware 13.1 DVD
4. Use fdisk and create 2GB swap and otherwise partition the disk as you want it.
5. Run the Slackware setup, and accept all defaults, except you should enable Apache, anduse a static IP.
6. If you want a password on the unRAID management interface and for ssh, set it during the Slackware setup.
§ Note it is no longer necessary to run pwunconv to remove shadow passwords.
1. Reboot from the hard drive.
2. Reconfigure your BIOS to boot from hard drive instead of flash.
3. If using a PATA drive, run hdparm /dev/hda and make sure your drive can run in DMA mode.
4. Make sure you can ping the new server.
5. Make sure you can telnet to the new server.
6. If you want unRAID to have Internet access, check that you can ping and nslookup web sites like google.com.
§ If not, edit /etc/inetd.conf and /etc/resolv.conf as needed.
7. Edit /etc/inetd.conf and uncomment the telnet server.
8. Run kill -HUP 'cat /var/run/inetd.pid' to restart network services.
9. Log into server via telnet or ssh.
§ If it says your password is incorrect (and you've checked); vi /etc/securetty and remove the '#' for all the pts/X entries.
10.Open a browser on a PC and browse to your server’s IP and you should see the Apache "It Works" message
§ If it doesn't work and you want a web server, you can install Apache, see install instructions here
11. Create lilo entry for alternative kernel for recovery if new kernel hangs
1. $ ls -la /boot and see what file vmlinuz is linked to (probably vmlinuz-huge-smp-2.6.xx.x-smp)
2. Edit /etc/lilo.conf and duplicate the linux boot section
3. Changing the “image=” line to point to to the real file vmlinuz was symlinked to.
4. Change the label to unRAID as this is your new image
It should look something like this when done:
# Linux bootable partition config begins image = /boot/vmlinuz root = /dev/sdaX label = unRAID read-only image = /boot/vmlinuz-huge-smp-2.6.27.7-smp root = /dev/sdaX label = Linux read-only # Linux bootable partition config ends
1. Save and Exit
2. Run lilo -v (You may also have to run lilo -P ignore if you get errors here)
3. Reboot and test alternative kernel entry to make sure it works.
[edit]Extract initramfs files from bzroot
1. Decide where to store a copy of the unRAID distro. I use /unraid
2. mkdir /unraid
3. cd /unraid
5. unzip *.zip bzroot
6. zcat bzroot | cpio -m -i -d -H newc --no-absolute-filenames
§ It should read 417780 blocks (for beta 10) if it completes correctly. (394789 for beta13, 394801 for beta14)
[edit]Prepare Linux source
1. Get linux source for 2.6.39.3 and untar it in /usr/src (beta13 was using kernel 3.1.0, adjust sources if desire)
2. $ cd /usr/src
4. $ tar -xjf linux-2.6.39.3.tar.bz2
5. Rename the directory linux-2.6.39.3 to linux-2.6.39.3-unraid-special
6. Delete (rm linux) the existing linux symlink (if present)
7. Symlink linux (ln -s linux-2.6.39.3-unraid-special linux)
8. Confirm symlink is pointing to the right place (ls -la linux)
[edit]Copy the unRAID kernel config and MD source mods
1. $ cd /usr/src/linux
2. $ cp /unraid/usr/src/linux-2.6.39.3-unRAID/.config .
3. $ cd /usr/src/linux/drivers/md
4. $ cp /unraid/usr/src/linux-2.6.39.3-unRAID/drivers/md/* .
[edit]Modify the unRAID kernel config
This is important. UnRAID uses an initramfs to provide the root file system to the kernel. We are going to use a hard drive for the root file system, so the drivers for Linux to access that drivemust be built into the kernel, and not left as modules.
"make localyesconfig" looks as your current hardware and enables the necessary drivers. It is not 100% perfect, but it works very well.
1. Run lsmod and lspci and save the output to help you determine which drivers to put in the kernel later.
2. $ cd /usr/src/linux
3. $ make clean
4. $ make oldconfig
5. $ make localyesconfig (NOT RECOMMENDED; May strip out all of the unRAID setup from the .config file)
6. $ make menuconfig
7. You have to include the drivers for unRAID.
1. Device Drivers ---> Multiple Device Support ---> Multi-device support (unRAID) ---> [*] Multiple devices driver support (unRAID)
2. Device Drivers ---> Multiple Device Support ---> Multi-device support (unRAID) ---> RAID support
8. You have to include (not as modules) drivers for the controller for your boot disk.
9. Set the following to [*] and not as by using the spacebar to change it:
1. File Systems ---> Ext3 journalling file system support and ALL other filesystems on your boot disk, even if you are not mounting them. unRAID has them all built in now.
2. File Systems ---> DOS/FAT/NT Filesystems ---> NTFS file system support for NTFS support. May want to include write support as well.
3. Device Drivers ---> Serial ATA and Parallel ATA Drivers (* this first) ---> Make sure support is included for your needed hardware.
4. Also select AHCI if you are using AHCI in your BIOS.
5. Device Drivers ---> SCSI device support --> SCSI disk support unRAID has this as the default now.
6. Device Drivers ---> SCSI device support --> SCSI CDROM support (if you want it)
7. Executable file formats / Emulations ---> IA32 Emulation --> Include code to run 32-bit programs under 64-bit kernel (if you're building a 64-bit kernel)
8. Don't forget a mouse driver if you want to use a Linux GUI.
10. Save and Exit
If you have problems figuring out which drivers you need, boot the alternate Linux kernel, and save/print a copy of the syslog and dmesg output for use in identifying hardware.
[edit]Build a new Linux kernel
1. $ cd /usr/src/linux
2. $ make
3. $ make modules_install
4. $ make install
5. $ reboot into the new kernel
§ If it panics, reboot back to the alternate kernel and check the disk drivers. Particularly if the panic was a failure when attempting to mount the root fs.
§ Build a new kernel and boot again.
6. After your new kernel is booting properly, log in and run hdparm /dev/hda if you are using PATA drives (alternative command: hdparm -i /dev/sda) and make sure your boot drive is in DMA mode.
Once your new kernel is booting properly and your boot drive is in DMA mode (if using PATA drives), shut down and congratulate yourself.
[edit]Copy unRAID scripts and executables
1. Copy these differences to your Slackware system (Note, don't blindly copy paste these commands. Make sure that you are using either "cp -i" or "cp -n". It WILL cause problems down the road.
1. $ cp /unraid/root/* /root -r
2. $ cp /unraid/usr/local/* /usr/local -r
3. $ mkdir /var/local
4. $ cp /unraid/var/local/* /var/local -r
5. $ cp /unraid/usr/sbin/* /usr/sbin -r
6. $ cp /unraid/etc/samba/* /etc/samba -r
7. $ cp /unraid/etc/unraid-version /etc/
2. Plus you need these files (or merge their changes from stock into yours) from /unraid/etc/rc.d:
1. $ cp /unraid/etc/rc.d/rc.samba /etc/rc.d/
2. $ cp /unraid/etc/rc.d/rc.local /etc/rc.d/
3. $ cp /unraid/etc/rc.d/rc.nfsd /etc/rc.d/
4. $ cp /unraid/etc/rc.d/rc.ntpd /etc/rc.d/
5. $ cp /unraid/etc/rc.d/rc.atalk /etc/rc.d/
6. $ cp /unraid/etc/rc.d/rc.avahidaemon /etc/rc.d/
7. $ cp /unraid/etc/rc.d/rc.avahidnsconfd /etc/rc.d/
8. $ cp /unraid/etc/exports- /etc/
9. $ cp /unraid/etc/ntp.conf- /etc/
3. If you plan on using user shares, you may need to copy the following files (to their respective Slackware directories):
1. $ cp /unraid/etc/rc.d/rc.fuse /etc/rc.d/
2. $ cp /unraid/bin/fusermount /bin/
4. Also chmod +x each of the above scripts
5. If anyone finds something else important, be sure to post it.
[edit]Copy additional libraries
1. Libraries -- there may be more, but these are specifically used by emhttp:
1. $ cp /unraid/usr/lib/libdaemon* /usr/lib/ -p -P
2. $ cp /unraid/usr/lib/libk* /usr/lib/ -p -P
3. $ cp /unraid/usr/lib/libavahi* /usr/lib/ -p -P
4. $ cp /unraid/usr/lib/libgssapi* /usr/lib/ -p -P
5. $ cp /unraid/usr/lib/libcom_err* /usr/lib/ -p -P
6. $ cp /unraid/usr/lib/libwbclient* /usr/lib/ -p -P
2. If anyone finds something else important, be sure to post it.
[edit]Test new kernel and drivers with unRAID
1. Reinstall the unRAID USB stick (either registered or unregistered).
2. Boot your new kernel from the hard drive. (Make sure you are not booting from USB... change your BIOS if necessary.)
3. Log in
4. Modify the web server php config file, either with the following command or with a manual edit
§ sed -i -e "s/^short_open_tag.*=.*Off/short_open_tag = On/" /etc/httpd/php.ini
§ manually edit /etc/httpd/php.ini and change the parameter "short_open_tag" to "On".
5. Run emhttp -p 88. You should get error message “mkdir: cannot create directory `/boot/config/shares': Not a directory” ignore it for now.
6. Open browser to your server on port 88... you should see unRAID control panel.
7. Control-C to kill emhttp and move on to the next steps
Congrats.... you are in the home stretch.
If instead of the unRAID control panel you saw the following:
then something went wrong with the edit of /etc/httpd/php.ini. Make sure the parameter "short_open_tag" is set to "On",:
[edit]Mount flash and symlink to config
1. Add new line to /etc/fstab: "/dev/disk/by-label/UNRAID /flash vfat rw,noatime,nodiratime,umask=0,shortname=mixed 0 0"
2. $ mkdir /flash
3. Manually mount the flash with $ mount /dev/disk/by-label/UNRAID /flash
4. Remove the symlink for /boot/config (rm /boot/config).
5. Create symlink to /flash/config (ln -s /flash/config /boot/config)
6. Run $ emhttp -p 88. You should get no errors this time.
7. Open browser to your server on port 88... should see unRAID control panel. If you were using a flash with an existing unRAID config, it should have picked it up... if not, it should be empty.
8. Edit the go script on the flash, to run emhttp with -p 88
9. Control-C to kill emhttp and reboot.
[edit]Install drives and test
1. If you are upgrading an existing unRAID server and have been using a unregistered flash, now is the time to swap to your registered one.
2. Install all your drives.
3. Watch your POST messages and see that all hard drives are appearing.
4. Reboot and log in as root. Make sure you are booting from the hard drive, and not the flash.
5. If you used a flash with an existing unRAID config, some drives may appear missing, but they are probably just in the wrong order. Go back to your printout of the unRAID devices and rearrange them as they were originally.
6. Configure your drives for unRAID, and start the array.
7. Test the drives by:
1. Mapping from another PC and read from each one
2. Run $ hdparm -tT /dev/xxx for each one
3. Any problems that show up, probably mean you need to reconfig something in the kernel
8. Stop the array and reboot one last time.
[edit]Final boot
1. Your system should autoboot from the HD, with the USB flash installed.
2. Your go script from the flash should execute, and start emhttp... check syslog or dmesg if it doesn’t start.
3. Open browser to your server on port 88... should see unRAID control panel and the configuration changes you just made should have been retained.
4. You may need to do a parity check... I didn’t, but YMMV. I did one anyway overnight just to be safe, and no errors were found.
Congratulations. You now have unRAID installed and running on a complete Slackware development system. There is now practically nothing you can not do with this system, in terms of adding software and tweaking configurations.
[edit]Some Notes and Issues
If you edit Linux scripts and text files on the PC, be sure to use a text editor that supports Linux line endings. I use notepad2 (http://www.flos-freeware.ch/notepad2.html).
Remove the execute bit from /etc/cron.daily/slocate ... if you don't all your drives will be spun up once a day by slocate.
Edit /etc/rc.d/rc.inet1.conf to change your IP
Edit /etc/resolv.conf and /etc/hosts as needed
Startup mods are usually put in your local startup script (including calling the go script from the flash) (/etc/rc.d/rc.local)
Create a shutdown script (/etc/rc.d/rc.local_shutdown) and put commands to unmount unRAID devices, stop samba, sync, and stop the array.
Note that /etc/samba/smb.shares is rewritten on each boot by unRAID.
If you are going to mess around with features like S3 suspend, hibernation, installing software like nzbget, or do Linux maintenance stuff, stop the array first. Note you need to unmap all samba drives and in any terminal windows, cd to the root before stopping the array.
If attempting to install on a 64bit Slackware be sure that you also install multilib. A discussion on this can be found in the forum: (http://lime-technology.com/forum/index.php?topic=5639.0).

VMware Workstation 8 on Slackware 13.37/current ?./VMware-Workstation-Full-8.0.0-471780.i386.bundle --ignore-errors

There is. See my other thread about getting unRAID to work on the Slackware 64bit distros [ http://lime-technology.com/forum/index.php?topic=5639.0 ]

When I first did it, I used Slackware 13.0 and unRAID 4.5.x which used an older kernel and did not need unraid kernel source code modifications.

The basic gist is you install Slackware 13.37 64bit, then you install the Alien MultiLib packages [http://alien.slackbook.org/dokuwiki/doku.php?id=slackware:multilib ], then you follow the unRAID 5.x on Slackware installation instructions, then you copy over what libraries (from /usr/lib/ and possibly /lib) be needed from the 32bit unRAID 5.x series as determined by using "ldd" on /usr/local/sbin/emhttp and /usr/local/sbin/shfs, then you'll need to deal with the custom kernel which will require modifications to the unraid.c and md.c source code files to be usable on the linux kernel 2.6.37.x series (changes and removal of barriers), then you compile and install your new kernel. You're now good to go.

I have unRAID 5.06a (and 5.06d) working perfectly fine on a Slackware Current 64bit distro which is basically 13.37 plus newer changes since release.