[warn] module php5_module is already loaded, skipping
solve) delete " LoadModule php5_module /usr/lib/apache/libphp5.so " line in httpd.conf
heonyee's blog for linux
Monday, November 21, 2011
Saturday, November 19, 2011
How to install mysql server
How to install mysql server on fedora
1) First of all install mysql client and server. Open the terminal and enter the following command
[jasonleon]$ yum install mysql mysql-server2) Then Install the mysql package and start the mysql deamon by using the command
[jasonleon]$ service mysqld start3)Start the mysql deamon everytime you boot
[jasonleon]$ chkconfig --level 2345 mysqld on4) Login as root database admin to MYSQL server
[jasonleon]$ mysql -u root5) Change the database password by using
[jasonleon]$ mysqladmin -u root password NEWPASSWORDIf you want to change or update the new password you can use the following command
[jasonleon]$ mysqladmin -u root -p OLDPASSWORD password NEWPASSWORDSimilary, you can change the password of other users
[jasonleon]mysqladmin -u username -p OLDPASSWORD password NEWPASSWORDYou can also change the password using mysql commands
Login to mysql server by typing following command at shell prompt
[jasonleon]$ mysql -u root -p6) If you have anonymous access to the database consider removing it.
mysql> use mysql;
mysql> update user set password=PASSWORD("NEWPASSWORD") where User='username';
mysql> reload privileges
mysql> FLUSH priviledges
mysql> DELETE FROM user where User='';7) Add new users with database admin priviledges for all the databases
mysql> FLUSH PRIVILEGES
mysql> GRANT ALL PRIVILEGES ON *.* TO 'user' @'localhost' INDENTIFIED BY 'somepass' WITH GRANT OPTION;8) We can also add permissions to a user for a specific database.
mysql> GRANT SELECT, INSERT, UPDATE, CREATE, DROP, INDEX, ALTER ON some_database.* TO 'user'@'localhost';9) Add a new MYSQL database
mysql> create database db_name;10) If you want to manage your database through a graphical user interface you can use mysql-administrator. Install mysql-administrator tool when installed you can find it in Application => System Tools.
[jasonleon]$ yum install mysql-administrator
how to change monitor resolution in fedora
syncmaster 213T
xrandr --newmode "1680x1024_60.00" 146.250 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync
xrandr --addmode VGA1 1680x1024_60.00
xrandr --output VGA1 --mode 1680x1024_60.00
# if you are adapting this script get the modeline information by running cvt
# then to the below to add this named mode with its config details to the xrandr system
xrandr --newmode "Syncmaster1600" 161.00 1600 1712 1880 2160 1200 1203 1207 1245 -hsync +vsync
# make the new mode setable on this monitor
xrandr --addmode VGA1 Syncmaster1600
# now the new mode should be in the display control panel, but we will go ahead and set it here.
# sets the vga out to use the modes from above
xrandr --output VGA1 --mode Syncmaster1600
xrandr --newmode "1680x1024_60.00" 146.250 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync
xrandr --addmode VGA1 1680x1024_60.00
xrandr --output VGA1 --mode 1680x1024_60.00
Setting a non detected resolution on modern xrandr system
This script distills the knowledge needed to get my old samsung syncmaster 213T to work at native res from my macbook air running gnome 3.
#!/bin/bash# if you are adapting this script get the modeline information by running cvt
# then to the below to add this named mode with its config details to the xrandr system
xrandr --newmode "Syncmaster1600" 161.00 1600 1712 1880 2160 1200 1203 1207 1245 -hsync +vsync
# make the new mode setable on this monitor
xrandr --addmode VGA1 Syncmaster1600
# now the new mode should be in the display control panel, but we will go ahead and set it here.
# sets the vga out to use the modes from above
xrandr --output VGA1 --mode Syncmaster1600
Friday, November 18, 2011
php5 ./configure error: Cannot find MySQL header files
Solution for fedora is yum install mysql-devel. Then set --with-mysql=/usr/include/mysql/
how to install php from school
PHP (Version 5.3.5 as of 03/10/2011)
This installation page assumes that you will be installing PHP 5.3.5
locally on Seneca's "zenit" server (as a student user) or on any
Unix/Linux system.
STEP 1: Download
php-5.3.5.tar.gz
NOTE: You may copy the software directly on zenit by running the following command:
(after you've created the /tmp/int322_113nxx/ directory (see below)
/tmp/int322_113nxx/>cp /home/danny.abesdris/php-5.3.5.tar.gz .
STEP 2: Make /tmp directory and cd
/home/students/int322_113nxx/>mkdir /tmp/int322_113nxx
/home/students/int322_113nxx/>cd /tmp/int322_113nxx
STEP 3: Copy software and Extract
/tmp/int322_113nxx/>cp /home/int322_113nxx/php-5.3.5.tar.gz .
/tmp/int322_113nxx/>tar -xzf php-5.3.5.tar.gz
This will create a new directory 'php-5.3.5' under the current
directory containing the source code for the distribution.
You must cd into that directory before
proceeding with the configuration and before compiling
the server.
STEP 4: Change Directories
/tmp/int322_113nxx/>cd php-5.3.5
NOTE: This installation assumes apache2 has already been installed and that
the apache2/ directory already exists!
STEP 5: Configure
The next step is to configure the PHP source tree for
your particular platform and personal requirements. This
is done by invoking the script configure included
in the root directory of the distribution and including
the --prefix option.
/tmp/int322_113nxx/php-5.3.5/>./configure \
--with-apxs2=/home/int322_113nxx/apache2/bin/apxs \
--with-mysql \
--prefix=/home/int322_113nxx/apache2/php \
--with-config-file-path=/home/int322_113nxx/apache2/php \
--enable-force-cgi-redirect \
--disable-cgi \
--with-zlib \
--with-gettext \
--with-gdbm
All other defaults are acceptable.
STEP 6: Build
Now you can build the various parts which form the
PHP package by simply running the command:
/tmp/int322_113nxx/php-5.3.5>make
Please be patient here, a base configuration may take
a few minutes to compile on zenit.
STEP 7: Install
Now it's time to install the package under the configured
installation PREFIX (see --prefix option above) by running:
/tmp/int322_113nxx/php-5.3.5>make install
STEP 8: Copy PHP module and config file to the installation directory
/tmp/int322_113nxx/php-5.3.5>cp -p .libs/libphp5.so /home/int322_113a45/apache2/modules
STEP 9: Copy php.ini-development to apache2/php/
/tmp/int322_113nxx/php-5.3.5>cp -p php.ini-production /home/int322_113a45/apache2/php/php.ini
STEP 10: Customize
It will be neccessary to configure the httpd.conf file in the
/apache2/conf/ directory before you can test your PHP installation.
Return to your home directory by typing "cd"
/home/int322_113nxx>nled apache2/conf/httpd.conf
Note: If you don't have the nled editor, you can
get it here.
(I refuse to use vi!)
Add the following directives:
# Use for PHP 5.x:
LoadModule php5_module modules/libphp5.so
AddHandler php5-script php
# Add index.php to your DirectoryIndex line:
DirectoryIndex index.html index.php
AddType text/html php
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
# PHP Syntax Coloring
# (optional but useful for reading PHP source for debugging):
AddType application/x-httpd-php-source phps
You can read more about PHP configuration by visiting:
PHP 5 Documentation for a complete description.
STEP 11: Test
Now, you can start your Apache HTTP server by running:
/apache2/bin/apachectl start
You should be able to request your first document via
URL http://zenit.senecac.on.ca:12345 (your port number)
The web page you see is located under the DocumentRoot which
will usually be /apache2/htdocs/.
If everything was successful, you should see:
It works!
Now, you can test to see if your PHP installation was successful
by creating a file called "info.php" and entering the following text:
<html>
<head>
<title>PHP Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<h1>PHP Test</h1>
<p>
<b>An Example of PHP in Action</b><br />
<?php echo "The Current Date and Time is: <br>";
echo date("g:i A l, F j Y.");?>
</p>
<h2>PHP Information</h2>
<p>
<?php phpinfo(); ?>
</p>
</body>
</html>
Now save the file and try loading it in a browser via URL:
http://zenit.senecac.on.ca:12345/info.php
NOTE: 12345 should be replaced with your port number.
You should see The current date and time and also a long
page with PHP configuration details.
That's It!
linux permission for apache setup
403 Forbidden error solution
<IfModule mod_userdir.c>
#
# UserDir is disabled by default since it can confirm the presence
# of a username on the system (depending on home directory
# permissions).
#
#UserDir disabled
#
# To enable requests to /~user/ to serve the user's public_html
# directory, remove the "UserDir disabled" line above, and uncomment
# the following line instead:
#
UserDir public_html
</IfModule>
After that, you still have to deal with SELINUX and file permission setup in order to allow "apache" to access your files.
One way to do this is:
1. set your home folder "/home/user101" permission to 711.
2. set your "public_html" folder permission to 755.
3. set your files in the "public_html" folder permission to 644.
4. chcon -t httpd_sys_content_t /home/user101.
5. chcon -R -t httpd_sys_content_t /home/user101/public_html.
<IfModule mod_userdir.c>
#
# UserDir is disabled by default since it can confirm the presence
# of a username on the system (depending on home directory
# permissions).
#
#UserDir disabled
#
# To enable requests to /~user/ to serve the user's public_html
# directory, remove the "UserDir disabled" line above, and uncomment
# the following line instead:
#
UserDir public_html
</IfModule>
After that, you still have to deal with SELINUX and file permission setup in order to allow "apache" to access your files.
One way to do this is:
1. set your home folder "/home/user101" permission to 711.
2. set your "public_html" folder permission to 755.
3. set your files in the "public_html" folder permission to 644.
4. chcon -t httpd_sys_content_t /home/user101.
5. chcon -R -t httpd_sys_content_t /home/user101/public_html.
Subscribe to:
Comments (Atom)