LINUX SERVER PHP configurations.

Yesterday, i finished the whole process to built up a completely new LAMP stacks. After that, i am going to import my test server to my production server.

During this transition, i have to upload my sql database dump from my production server 1 to this new server.

Unfortunately, there is a problem for myself that i left off from yesterday’s process. I did not modify any of the PHP configuration. Therefore, i wasn’t able to upload the sql file which size 14MB.  By default,t he upload single file is only 2MB.

So, today i am going to dig into this php configuration file and do some modifications.

First, i would go to change the file php.ini. You can run following command to edit the php.ini file. (Sometime it’s stored in /etc/php.ini, but it also could be in /etc/php.d/cgi/php.ini or /usr/local/etc/php.ini)

vi /etc/php.ini

Then use the vi ‘s search function to search for below syntax and modify to suit your needs. (type in /strings to find your keyword and use keybaord i to get into insert mode to modify it one by one.)

memory_limit = 32M
upload_max_filesize = 10M
post_max_size = 20M

here is the search function: i type in /post_max and then hit enter


Then, the cursor will jump to the result it found


After all the modification has been completed, you can do following command to restart the apache

sudo service httpd restart

LINUX(LAMP) stack 安装日记

今天重装了一台服务器的LAMP stack.纯粹做个日记,下次就可以参考参考了。哈哈。

系统:CentOS7 x86_64_1511

首先安装好了linux.为了方便查看,装的时候选择了basic web server with GUI的包装。




sudo yum update (yum软件包的更新。如果你是类似我一样是新系统,可能会更新一段时间。因为很多包的下载还是蛮多的。我就下载了奖金700多MB的新软件包更新。)
sudo yum install httpd(这个是进行apache的安装。apache的软件包名字就叫做httpd)
sudo systemctl start httpd.service (这个是开始运行apache的服务)
sudo systemctl enable httpd.service(这个是吧apache的服务运行加入启动就自动运行。

sudo firewall-cmd –permanent –add-port=80/tcp
sudo firewall-cmd –permanent –add-port=443/tcp

sudo firewall-cmd –reload



sudo yum install mariadb-server mariadb


sudo systemctl start mariadb(开启服务)
sudo systemctl enable mariadb.service(开启开机自动启动服务)
sudo mysql_secure_installation(这个命令会进行mysql的初始化设置的一些工作)

Enter current password for root (enter for none):
OK, successfully used password, moving on…

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
… Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
… Success!


Normally, root should only be allowed to connect from ‘localhost’. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n
… skipping.

正常情况,root只可以从本地访问。这可以杜绝别人从网络访问去猜测root的密码。是否拒绝root的远程登陆。因为我经常要从本地和远程登陆进行管理。所以我会回答n 给这个问题。

By default, MariaDB comes with a database named ‘test’ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!

默认情况下,mariaDB自带了一个叫做test的数据库,这个是完全拿来做测试用的blah blah.我直接回答y去吧这个数据库给删除掉了。

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
… Success!

Cleaning up…

All done! If you’ve completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!


sudo yum install php php-mysql


sudo systemctl restart httpd.service (重启apache的服务)


sudo vim /var/www/html/info.php






Last but not the least is to install phpmyadmin. This is a very useful tool with GUI to manage the MySQL database on the centos7 server.
Now, run the following commands:

sudo yum install php-gd php-pear (Install two very important php related packages.)
sudo yum install epel-release-7-1.noarch.rpm (This is to add the epel release package to the repo.)
sudo yum install epel-release (install and update the epel release package lists)
sudo yum install phpmyadmin (Install the phpmyadmin)

After that, if you go ahead and access http://ipaddress/phpmyadmin you should see something different message other than the 404 now.

Unfortunately, you still cant access phpmyadmin yet. Now, you need to change the file

vi /etc/httpd/conf.d/phpMyAdmin.conf
Below is the file what it looks like the first time you open it.

# phpMyAdmin - Web based MySQL browser written in php
# Allows only localhost by default
# But allowing phpMyAdmin to anyone other than localhost should be considered
# dangerous unless properly secured by SSL

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>
   <IfModule mod_authz_core.c>
     # Apache 2.4
       Require ip
       Require ip ::1
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from
     Allow from ::1

<Directory /usr/share/phpMyAdmin/setup/>
   <IfModule mod_authz_core.c>
     # Apache 2.4
       Require ip
       Require ip ::1
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from
     Allow from ::1

# These directories do not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
<Directory /usr/share/phpMyAdmin/libraries/>
    Order Deny,Allow
    Deny from All
    Allow from None

<Directory /usr/share/phpMyAdmin/setup/lib/>
    Order Deny,Allow
    Deny from All
    Allow from None

<Directory /usr/share/phpMyAdmin/setup/frames/>
    Order Deny,Allow
    Deny from All
    Allow from None

# This configuration prevents mod_security at phpMyAdmin directories from
# filtering SQL etc.  This may break your mod_security implementation.
#<IfModule mod_security.c>
#    <Directory /usr/share/phpMyAdmin/>
#        SecRuleInheritance Off
#    </Directory>

Modify and add below items to. Check out the bold text carefully.

<Directory /usr/share/phpMyAdmin/>
   AddDefaultCharset UTF-8

   <IfModule mod_authz_core.c>
     # Apache 2.4
       #ADD following line:
       Require all granted
       Require ip
       Require ip ::1
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     #CHANGE following 2 lines:
     Order Allow,Deny
     Allow from All
     Allow from
     Allow from ::1

After i did the above two changes, i would do a httpd restart service again.

sudo systemctl restart httpd.service




RealVNC是一款远程登陆软件。类似winxp自己附带的Remote desktop connection这个软件。但是和Remote Desktop connection的最大不同是。VNC是一个开放协议。所有经过VNC协议下编写的软件都有连接到RealVNC的服务器的功能。 这里我们用到的是RealVNC这个软件。(普通版是免费的。已经有了绝大部分我们所需要的功能了。)而且最大的好处是,realVNC还提供了winxp,linux以及很多不同操作系统平台下的客户端以及服务器端软件,非常实用非常强大。

这里,我们开始这个教程吧。首先,我们需要从网上下载RealVNC这个软件。   这个地址可以下载到对应各个平台的realVNC平台的软件包。或者你可以选择只下载viewer—客户端。如果您已经配置好了服务器端。无需再次下载。这样可以节省很多时间。完整软件包则包含了服务器端和客户端了。这里,我们下载了windows 版本来测试。注意,安装过程无太大变化。所以直接跳过。仅需注意安装目录即可。
安装完毕之后,在 开始菜单-所有程序-RealVNC这里找到realVNC的所有软件。在下一级菜单,我们可以看到VNC server 4(server mode)和VNC server 4 (user mode)还有一个VNC viewer4.这里的server mode即是运行服务器端的软件和部分所需配置软件。

RealVNC全攻略教程 - Promise - Promise  (不好意思,手中只有英文版本的winXP.基本上的设置都大同小异。在图中的 All Program就是中文xp里面的 所有程序 选项了。)

如果这个时候已经万事具备,那么你就可以直接进入server mode文件夹,然后点start server来运行服务端了。在运行服务端之前。让我们打开configure VNC server进行一些基本配置吧。如图所示。显示VNC server properties(server-Mode).这个是服务端的设置程序。我们首先点Authntication这个项目。然后选中VNC password Authentication(密码验证),然后点右边的configure进行密码设置。在右图所示的密码输入窗中输入密码2次。然后点OK确认即可完成密码验证的设置。
RealVNC全攻略教程 - Promise - PromiseRealVNC全攻略教程 - Promise - Promise

配置好密码之后,我们点Desktop进行 服务端的桌面背景的一些设置。
其中在while connnected之下,有3个选项。分别对应意思是:
Remove wallpaper   去除桌面背景。
Remove background pattern 去除背景图案。
Disable user interface effects 去除用户界面特效。(动画以及很多影响网速的因素的特效之类。)

RealVNC全攻略教程 - Promise - Promise

选择上Accept connection on port 5900 表示接受连接到端口5900的连接请求。这个是默认,普通用户请勿修改。
disconnect idle clents after (seconds): 3600  这个选项则是在无动作用户的无回应多少秒之后自动断开连接。
serve java viewer via http on port 5800      接受java版本的viewer(客户端)通过http协议连接到5800端口。

在access control选项下面可以添加不同的规则,比如allow(同意连接),deny(拒绝连接),query(询问,回答是/否之后才可以进行连接)。然后添加不同的ip地址即可实现类似防火墙的功能。

RealVNC全攻略教程 - Promise - Promise

到这里,RealVNC的服务器端就基本配置完毕了。基本上就可以实现VNC承诺的大部分功能了。还有其他的一些没有提到的设置,大家可以自己挖掘。这下,大家可以直接运行start VNC server来运行服务端软件了。

不过如果你使用的是windows XP sp2或者以上版本。你还要做一些windows防火墙的设置以让windows接受来自客户端的连接请求。以下是具体设置步骤:

首先,在图中的 My Network places(网上邻居)点一下。打开新窗口

RealVNC全攻略教程 - Promise - Promise

直接点左边的 查看网络连接 。

RealVNC全攻略教程 - Promise - Promise

RealVNC全攻略教程 - Promise - Promise
这里,我们选择中间的Exceptions(规则) 选项。
然后我们可以点下面的Add port….(添加端口)来添加VNC所需的一个TCP类型的5900端口和一个UDP类型的5800端口。
RealVNC全攻略教程 - Promise - Promise
如法炮制,完成UDP和TCP设置之后。这里的设置只是让windows XP接受任何跟UDP端口5800和TCP端口5900的网络连接请求。


首先,在网络浏览器输入你的路由器HTML界面的网络地址。打开之后,你可以寻找一个叫做 网络转发规则或者如果是英文界面请寻找porforwarding的相关选项。里面应该会出现如图的选项,我们要和上面一样设置这2个TCP和UDP端口。这样每次从互联网外部发送到这个网络地址的时候,路由器会首先接受请求并转发到局域网内部的相关电脑。后面的IP地址即是你电脑的本地IP地址了。一般都是或者127.0.0.xx这样的形式。

RealVNC全攻略教程 - Promise - Promise


RealVNC全攻略教程 - Promise - Promise



RealVNC全攻略教程 - Promise - Promise


VNC viwer是VNC软件包中一个唯一独立的软件,可以直接复制到任何一个电脑上使用。充当这远程操作种的客户端的功能。如上图填入ip地址,然后就会自动打开一个窗口,并直接吧服务器端的电脑的屏幕复制过来,显示。 你可以当作自己的电脑一样进行所有操作。

T-mobile Tuesday

It doesn’t matter if you are a T-mobile user or not. You probably have heard of the T-mobile Tuesday things going on lately. It  is really excited and interesting that T-mobile willing to offer something to their royal customers.

On top of that, many people on line are accusing that T-mobile coverage sucks and speed are slow. To be honest, i have only use Tmo,sprint, AT&T and MetroPCs in my life. By far, Tmo has been the best in class in service representataives plus the growths on their technoliges upgrades. If i live on a mobile service provider that has the same service and have not yet to satifsy me and they have not thinking about going out and making any improvents, i think that sucks.

I think i am off topic already. But just want to say T-mobile network does not sucks..The speed are also pretty amazing. I assume T-mobile is not the best, but its service is soso which is a plus to me already..

Wait…I think i am still off topic. So, with this T-mobile Tuesday APP, you basically getting freebies every tuesday. The first week, i redeemed my one share of T-mobile stock, one warcraft movie ticket as well as a free 2 toppting medium pizza. The pizza is soso, but taste not too bad. The warcraft movie i have been excited about can be one year back when i first heard of they are reasing this movie.

I am jost bored….and think about writing something down when i saw those comments when i was looking about t-mobile tuesday APP.. ROFL.


Ubuntu 15.10 with Broadcom wireless.

Somehow i always struggling with the broadcom wireless that i have. This is just coincidence that even after two LAPTOP i have changed, both them came with Broadcom wireless module.

The current laptop i have is a Lenovo Z500. Which equiped with Intel core i5 4200M/8GB RAM/120GBSSD/1THDD. Nowaday, you can get a 6th gen core i laptop with something around $600. Though my laptop still runs pretty fast compare to the 6th gen core i gadgets.

This is really off topic. Now today, my problem is to go through the bottleneck of no drivers exsisting in my laptop with my Ubuntu 15.10 to support.

There is a couple simple command i ran to check whats really going on with my wireless.

First, i kicked off with following command to see the result of what network card avaliable. (wireless modules.)

lspci -vnn | grep Network

Then i get the result as below:

02:00.0 Network controller [0280]: Broadcom Corporation BCM43142 802.11b/g/n [14e4:4365] (rev 01)

Noted, above information is very important. In this case, it tells me the correct model and firmware that i have for my broadcom wireless module.

Then, here is the useful command for linux to configue wireless network.


lo no wireless extensions.

enp1s0 no wireless extensions.

The second line could be something similar but it could be different too… (I know some of my co-league would get eth0 for their module.)

Now, we are done with playing around and determining our wireless hardware. Let’s starting with the solutions to fix the wirless driver issue.

Remember the information we get above? The [14e4:4365] (rev 01) is something we would need to deceided which broadcome wireless module firmware we would need for installing with to support the wireless function.

02:00.0 Network controller [0280]: Broadcom Corporation BCM43142 802.11b/g/n [14e4:4365] (rev 01)

Now, lets update the source list with:

sudo apt-get update

Then, we can also updat the ubuntu PCI iDs:

sudo update-pciids

Then below steps by step to install:

sudo apt-get install bcmwl-kernel-source

sudo reboot

Please follow below table to select the correct packages to install from.

PCI.ID 14.04 LTS 15.10+
14e4:0576 Special Case #1 UNKNOWN
14e4:4301 firmware-b43-installer firmware-b43-installer
14e4:4306 firmware-b43-installer firmware-b43-installer
14e4:4306 rev 02 firmware-b43-installer firmware-b43-installer
14e4:4306 rev 03 firmware-b43-installer firmware-b43-installer
14e4:4307 firmware-b43-installer firmware-b43-installer
14e4:4311 firmware-b43-installer firmware-b43-installer
14e4:4312 firmware-b43-installer firmware-b43-installer
14e4:4313 firmware-b43-installer firmware-b43-installer
14e4:4315 firmware-b43-installer firmware-b43-installer
14e4:4315 rev 01 firmware-b43-installer / Case #2 UNKNOWN
14e4:4318 firmware-b43-installer firmware-b43-installer
14e4:4318 rev 02 firmware-b43-installer firmware-b43-installer
14e4:4319 firmware-b43-installer firmware-b43-installer
14e4:4320 rev 02 firmware-b43-installer firmware-b43-installer
14e4:4320 rev 03 firmware-b43-installer firmware-b43-installer
14e4:4324 firmware-b43-installer firmware-b43-installer
14e4:4325 firmware-b43-installer firmware-b43-installer
14e4:4328 firmware-b43-installer firmware-b43-installer
14e4:4329 bcmwl-kernel-source bcmwl-kernel-source
14e4:432a bcmwl-kernel-source bcmwl-kernel-source
14e4:432b bcmwl-kernel-source bcmwl-kernel-source
14e4:432c bcmwl-kernel-source bcmwl-kernel-source
14e4:432d bcmwl-kernel-source bcmwl-kernel-source
14e4:4331 firmware-b43-installer firmware-b43-installer
14e4:4335 firmware-b43-installer firmware-b43-installer
14e4:4353 Special Case #1 UNKNOWN
14e4:4353 rev 01 Special Case #1 UNKNOWN
14e4:4357 Special Case #1 UNKNOWN
14e4:4358 bcmwl-kernel-source bcmwl-kernel-source
14e4:4359 bcmwl-kernel-source bcmwl-kernel-source
14e4:4365 bcmwl-kernel-source bcmwl-kernel-source
14e4:4365 rev 01 bcmwl-kernel-source bcmwl-kernel-source
14e4:43a0 bcmwl-kernel-source bcmwl-kernel-source
14e4:43b1 bcmwl-kernel-source bcmwl-kernel-source
14e4:43b1 rev 03 bcmwl-kernel-source bcmwl-kernel-source
14e4:4727 bcmwl-kernel-source bcmwl-kernel-source
14e4:4727 rev 01 bcmwl-kernel-source bcmwl-kernel-source
14e4:a962 firmware-b43-installer firmware-b43-installer

After that the system reboots and hoepfully your wireless card will come up like mine. Otherwise, you can also try below:

sudo modprobe -r b43

sudo modprobe b43

sudo rfkill unblock all

if you have successfully installed the driver, You will happy to see below screens.

2015-12-18 17-34-21屏幕截图2015-12-18 17-42-20屏幕截图





Ubuntu stress test.

Command to install:

sudo apt-get install stress

Testing, sameple command:

stress -c 4 -m 5 -d 1
(Explaination:, -c means cpu cores number count that will under stress test. -m means how many memory threads are going to under stress test, -d HDD numbers.)

System configurations:

Intel core i3 2330E/8GB ram/80GB HDD

Tested with above and “stress -c 4 -m 20 -d 1”. Then tried adjusted -m to -m 40 and system crashed and hanged up.


Pfft, nice try.

iframe self adjusting height.

I have been doing some research on self adjusting height on some of my site projects. One of the most challenging one for me is that some of my pages using ifrmae to reference from another page. The problem is, it’s not always diplsy correctly the height and width. it’s been exahusting since i am not majoring in CS and coding is a been hard for me. But i finally get this work well.

I have tried jscripts, it never really works. The problem i suspect is because not all browser using the same language translater. IE or most will redefined the iframe value to 0 and reload it, in another words some others will do it accorindly by the abolute values.

Here is a very simeple codes:

<iframe id=’iframe2′ src=”./index_frame.htm” frameborder=”0″ style=”overflow: hidden; height: 100%; width: 100%; position: absolute;” height=”100%” width=”100%”></iframe>


By doing so, it will self adjust the iframe size according to the documents and based on the current page size. Works perfrecly for me.


Get my logitech unify receiver and keyboard / Mouse to work with my Ubuntu.

So, i reinstall my ubuntu and decided to go with a somewhat new distribution called Elementary OS. Everything works fine except that my Logitech Mouse is not working. It kinds of feel like the mouse is not pair with my Unify receiver.Here is the solution i found and seemd to work like a charm.

First thing first, get your terminal window out and throw in the below codes:
sudo apt-get install git gcc
git clone
cd ltunify
make install-home

Screenshot from 2015-02-19 11:43:22

  After that, you should be able to find your ltunify in $Home/bin/ltunify. Next thingyou need to do is redirect to this folder and run:
   ./ltunify pair
  The program will probably ask you to turn on and off of your mouse to pair with your Logitech USB receiver.
  After that, start enjoy your logitech and ubuntu!
  I found it also useful by installing a graphic UI program to manage your unify receiver. This App is call "Solaar".
  Go to your software center. (You can just click the left corner and type in "software" to search for software center.)
  After you launch the software center APP, click on the "Edit" and select "software source". Navigate to "Other software". Click on "Add..." button, then add following ppa:daniel.pavel/solaar
  After doing so, you will need to go to your terminal window and do a "sudo apt-get update". Then you can just type in command "sudo apt-get install solaar".
  Once everything is done. you will be able to search for your "solaar" in your application menu.
  This program will provide you some possible features provided by your unify receiveras well as the mouse battery level. (This could come in handy if you need to know if you possibly need to change your battery soon or if it still can last a while.)

   software sourcesadd software sources

dd (linux) for cloning a new HDD images.

So, just want to make a post and do some notes about a clone HDD images tha ti have been trying to do for a LINUX live that i have for a while.

It’s basically a LINUX live that i ran from a USB drive. I need it to perform some .sh script files and such to process some heavily network traffic and so to meter the LAN port’s healthy status.

Here is the problem, i have this fedora live originally installed to this USB drive for less than 1 GB. After time to time use and some more scripts file written to this USB drive, it has been now growth to gigantic 8GB USB DRIVE!. Although most of fthe files on the USB drive still only occupy the 2GB space. Now, i need to mass reproduced this USB drive to , let’s say 10 more copies. One simple methods that i have been trying to accomplished so far is by copy itself to another same 8GB USB drives. But i have those 4GB USB laying around with no absolutely no use at all. I really and likes to copy the original USB drive to those 4GB drive so i can save some money on buying more bigger size and perhaps more expensive gadgets.

I really want to use dd command which is a powerful yet strong enough to help me finish this target.

First of all, i would like to expertment a little bit and get a little bit of idea about the original USB drive.

By do so, i would need to run comamnd:
sudo fdisk -u -l /dev/sdb
(-u ->this extension would make all bytes in the times of 512 bytes, which  a sector block size. )

This command would allow me to check the layout and size of the USB drive. It could be something similar like below:
/dev/sdb1 5GB
/dev/sdb2 1GB ext
/dev/sdb5 1GB ext

Then we can use the following dd command to make the images:

dd bs=512 count=[max number of “end” result in fdisk command out put] if=/dev/sdb of=image.img

The fdisk command in Linux will identify and calculate the actual size and what ever that partition has been using regardless of it’s types. It wouldn’t matter if it’s a NTFS/FAT32 or even a EXT4 file system.

Above are all practice notes and study plan for cloning a hdd image.