Ph: 123456789

Archive

Posts Tagged ‘mysql’

Install phpMyFAQ from scratch

May 14th, 2009

There’s a few packages you might not have installed that you’ll need before php phpMyFAQ will install. On a basic, headless virtual machine, I don’t install a web server, php or databases by default. So I’ll start from there.

Install a database.

If you want mysql:

$ sudo yum install mysql-server php-mysql

$ sudo /etc/init.d/mysql start

$ sudo /usr/bin/mysql_secure_installation

If you want postgresql:

$ sudo yum install postgresql-server php-pgsql

$ sudo /etc/init.d/postgresql initdb

$ sudo /etc/init.d/postgresql start

Install the web server.

$ sudo yum install lighttpd lighttpd-fastcgi php

Unpack phpMyFAQ under your webroot. If you use the default webroot, that would be /var/www/lighttpd/ (if you use apache, it would probably be /var/www/html/ but some distributions put it under htdocs the way apache meant it to be)

tar zxvf phpmyfaq*.tar.gz -C /var/www/lighttpd/

Optional:

Rename the phpmyfaq directory to just “faq”

Load the page in a browser. Fill out the fields and click Install! If you’re using postgres and you didn’t modify the database user and password, it’s postgres postgres. If you ran the secure installation script for mysql, it asked you to supply the password to use.

Linux apache, lighttpd, lighty, mysql, php, phpMyFAQ, postgresql, yum

Install Mediawiki and Lighttpd on Fedora 10

March 4th, 2009

Install lighttpd and lighttpd-fastcgi. My version is 1.4.20-6.fc10 but it shouldn’t matter what version you’re using as long as it’s not ancient.

$ sudo yum install lighttpd lighttpd-fastcgi

Install php. My version happens to be 5.2.6-5. If you’re trying to install on an older version of Fedora, you will get different versions of all your software, but this should all still work just fine since you’ll grab all binary distributions from the repositories, making upgrading in the future a breeze.

$ sudo yum install php php-common php-pgsql

Install postgres (or some other database if you want, mediawiki can use several different ones, just look in config/index.php after you install it and it has sections for all the databases it supports). My version is version 8.3.6-1.fc10

$ sudo yum install postgresql postgresql-server postgresql-devel postgresql-libs

Install mediawiki and then move it under your webserver root. My version: 1.14.0-45.fc10

$ sudo yum install mediawiki
$ sudo mv /usr/share/mediawiki /var/www/lighttpd/wiki

Edit /etc/lighttpd/lighttpd.conf and enable mod_rewrite, mod_redirect, mod_fastcgi, and optionally mod_status and mod_accesslog (this will allow you to quickly test to see if everythings working by checking the status and current running config, but you could leave this out if you want) If you plan on running in a hostile environment, you probably want to configure mod_auth with ldap or something (i’ll write that up next) and enable logging.

To allow for clean SEO urls, add this: (If you put your mediawiki directory under something else, you’ll want to change the redirect location to something other than wiki.)

url.redirect = ( “^/(?!w|wiki|robots\.txt|server-status|server-config|favicon\.ico)(.*)” => “/wiki/$1″ )

And make sure you’ve got this enabled so they don’t get cached along with everything else, (I can’t remember if it was commented out to begin with or not, so just check…)

static-file.exclude-extensions = ( “.php”, “.pl”, “.fcgi” )

Now enable php by adding this to that same config file:

fastcgi.server = ( “.php” =>
( “localhost” =>
(
“socket” => “/var/run/lighttpd/php-fastcgi.socket”,
“bin-path” => “/usr/bin/php-cgi”
) ) )

If you run the latest up-to-date version of php like I do, then dont forget to change the “bin-path” to your php-cgi installation. I unpack php source in /opt and build it to run from there, so I end up with /opt/php-5.2.9/ and /opt/php-fcgi/ so my bin-path is “/opt/php-fcgi/bin/php-cgi”

Start your database and lighttpd.

$ sudo /etc/init.d/postgres initdb
$ sudo /etc/init.d/postgres start
$ sudo /etc/init.d/lighttpd start

If you have any issues, they’ll show up in /var/log/lighttpd/error.log (unless you change the location of this log of course)

Now open your browser and point to the wiki. In my case this was just http://localhost/wiki. Fill out the information, and install. I used postgres/postgres for my super user because it’s a basic installation for testing purposes. If you’re installing a bunch of apps that use the same DBMS on this system then use something like wikidb and wikiuser for the db and user names, or at least something descriptive so you’ll know what you’re looking at when you go digging into the database later on.

Checking environment…
Please include all of the lines below when reporting installation problems.
* PHP 5.2.6 installed
* Found database drivers for: MySQL PostgreSQL
* PHP server API is cgi-fcgi; using ugly URLs (index.php?title=Page_Title)
* Have XML / Latin1-UTF-8 conversion support.
* Warning: Your session.save_path value (/var/lib/php/session) appears to be invalid or is not writable. PHP needs to be able to save data to this location for correct session operation.
* PHP’s memory_limit is 32M.
* Couldn’t find Turck MMCache, eAccelerator, APC or XCache; cannot use these for object caching.
* Found GNU diff3: /usr/bin/diff3.
* Found ImageMagick: /usr/bin/convert; image thumbnailing will be enabled if you enable uploads.
* Found GD graphics library built-in.
* Installation directory: /var/www/lighttpd/wiki
* Script URI path: /wiki
* Installing MediaWiki with php file extensions
* Environment checked. You can install MediaWiki.

“To complete the installation, move config/LocalSettings.php to the parent directory.” just like it says…

I noticed with the default fedora php, you ccan’t log in to your wiki, so I tailed the error.log and saw the problem:


PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in Unknown on line 0(mod_fastcgi.c.2618) FastCGI-stderr: PHP Warning: Unknown: open(/var/lib/php/session/sess_abcdefg123456789c5, O_RDWR) failed: Permission denied (13) in Unknown on line 0

Change the ownership of the directories to lighttpd:lighttpd and you’re all set. Fedora assumes you’re going to be using apache, so the owner is apache by default.

$ sudo chown -R lighttpd:lighttpd /var/lib/php

Linux, howto fedora 10, lighttpd, lighttpd-fastcgi, mediawiki, mysql, php, postgres, wiki

How to reset a mysql password from the command line

September 12th, 2008

I just got Wordpress installed and completely forgot to change the random password it started me off with to something I might have a chance of remembering.  So to change it, I opened a terminal and changed the password field for the account I just created in mysql.  Here’s how:

First you’ll need to get your password encrypted using openssl.

$ # openssl passwd -1 my_super_secret_password

$1$AIO1MlAJ$nTI.HbEKpuYRbtCpn.5Vu/

Copy this hash so you can paste it into your sql statement later.  Now connect to mysql.

$ mysql -u root -p

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 976

Server version: 9.7.6evil Source distribution

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql>

If you know the database name you can just connect to it, if your forgot, which I did, just list them all.

mysql> show databases;

Connect to your wordpress database.

mysql> connect my_wordpress_database_name;

And change the password.

mysql> update wp_users

-> set user_pass=’$1$AIO1MlAJ$nTI.HbEKpuYRbtCpn.5Vu/’

-> where user_login=’admin’;

And that’s it; all done.  Now you can get back to editing…

Linux forgotten passwords, mysql, openssl, wordpress


You are viewing a mobilized version of this site...
View original page here

Mobilized by Mowser Mowser
Mobilytics