You can check for solution among comments in this topic
Posts made by Josip Mlakar
-
RE: How Do I Get Apache To Autostart?
-
RE: Install LAMP, FTP and PhpMyAdmin on your Onion Omega
@Chris-MacKay Cool, ty.
/php/ "/usr/bin"
worked before last update, after that I didn't try to install it again. Anyways I'll update my post -
RE: Install LAMP, FTP and PhpMyAdmin on your Onion Omega
@Milan-Vuckovic wathever You want (example: www.example.com, www.my-page.com ...)
-
RE: Install LAMP, FTP and PhpMyAdmin on your Onion Omega
Ok i found what's wrong. Since PhpMyAdmin uses mysql, apache fails to starts before mysql is up. So very very very (did I say very? :D) dirty way to fix this is to add sleep 5 in start() function... Better way would be somthing like
while (mysql not running) {wait}
but I cant find a way to check mysql status. if I find a way I'll update this comment.
Anyways @Danny-van-der-Sluijs current solution is:
Make file namedapache
in/etc/init.d
with content:#!/bin/sh /etc/rc.common START=95 start() { sleep 5 apachectl start } restart() { apachectl restart } stop() { apachectl stop }
Make it executable with
chmod +x /etc/init.d/apache
and then execute/etc/init.d/apache enable
. Ofcourse don't forget to enable mysql to start on boot, you can do that with a command/etc/init.d/mysqld enable
.@Kit-Bishop You don't need to manualy handle
enable
to set up symlink (as stated here in Enable and disable section). -
RE: Install LAMP, FTP and PhpMyAdmin on your Onion Omega
@Kit-Bishop Thank You for Your help, but
/etc/init.d/apache enable
creates symlink automatically. I also tried manual as you stated, but still no luck. Also tried to change START=95 into all kinds of numbers, but nothing works -
RE: Install LAMP, FTP and PhpMyAdmin on your Onion Omega
@Danny-van-der-Sluijs well I tried to make file named
apache
in/etc/init.d
with content:#!/bin/sh /etc/rc.common START=95 start() { apachectl start } restart() { apachectl restart } stop() { apachectl stop }
made it executable with
chmod +x /etc/init.d/apache
and then executed/etc/init.d/apache enable
. It gets enabled and I can start it with/etc/init.d/apache start
but script doesen't start on boot I'll keep You updated if I find the solution:) -
Install LAMP, FTP and PhpMyAdmin on your Onion Omega
DISCLAIMER:
I'm not responsible if You brick Your Onion following this tutorial. I'm Linux newbie so follow this tutorial on Your own reponsibillityI tested it on 0.0.4 (b220) firmware.
Hi,
in this tutorial I'll show you how to install LAMP, FTP and PhpMyAdmin on your Onion Omega. In this tutorial I'll use nano for editing text (yes I'm newbie who deosen't use vi:) and you can install it with:opkg update opkg install nano
Make Your Onion to boot from USB storage
Apache as other packages requires a lot of space so first thing You will have to do is to extend your storage. I did this by following this tutorial. To do that you will have to format your USB storage into ext4 filesystem. You can do this by following commands:
opkg update opkg install e2fsprogs mkfs.ext4 /dev/<your partition>
(your partition is the same You got from fdisk command in the tutorial above)
Install SFTP
To install sftp useopkg install openssh-sftp-server
command.Install Apache server
opkg update opkg install apache
Then edit
httpd.conf
:nano /etc/apache/httpd.conf
Find Listen part in the file and change it into:
Listen <ip You use to connect to Your console>:<port number other than 80>
Also find ServerName and change it into:
ServerName <name for Your server>:<same port as in Listen>
Then you should find:
LogLevel debug
and change it into
LogLevel error
To start Apache server You hould execute:
apachectl start
Address of Your Apache server is :
<Onion Console IP adress>:<Your chosen port>
Install PHP
Since I had some problems with PhpMyAdmin I installed all this packages for php (all of them are not required but those were that I installed)opkg install php5 php5-cgi php5-fastcgi php5-mod-json php5-mod-session php5-mod-zip libsqlite3 zoneinfo-core php5-mod-pdo php5-mod-pdo-sqlite php5-mod-ctype php5-mod-mbstring php5-mod-gd sqlite3-cli php5-mod-sqlite3 php5-mod-curl curl php5-mod-xml php5-mod-simplexml php5-mod-hash php5-mod-dom php5-mod-iconv
Type:
ln -s /usr/bin/php-cgi /usr/share/cgi-bin/
and then add folowing lines into httpd.conf:
<Directory "/usr/share/cgi-bin"> AllowOverride None Options FollowSymLinks Order allow,deny Allow from all </Directory> <Directory "/usr/bin"> AllowOverride None Options none Order allow,deny Allow from all </Directory>
Find
ScriptAlias /cgi-bin/ "/usr/share/cgi-bin"
and affter that line addScriptAlias /php/ "/usr/bin"
so you should have:ScriptAlias /cgi-bin/ "/usr/share/cgi-bin" ScriptAlias /php/ "/usr/bin"
Find
<IfModule mime_module>
section and addAddType application/x-httpd-php .php
andAction application/x-httpd-php "/php/php-cgi"'
into that section (before</IfModule>
)so you should have:AddType application/x-httpd-php .php Action application/x-httpd-php "/php/php-cgi" </IfModule>
To change Directory Index, change
DirectoryIndex index.html
toDirectoryIndex index.php index.html
.Open php.ini:
nano /etc/php.ini
And uncomment (remove ; ) on lines:
extension = gd.so extension = mbstring.so extension = pdo-mysql.so extension = pdo_sqlite.so extension = socket.so
Also do not specify
doc_root
so changedoc_root
intodoc_root =
After that restart apache server:
apachectl restart
Install mysql
opkg install mysql-server
Create two folders:
mkdir /mnt/data/mysql mkdir /mnt/data/tmp
Use command:
mysql_install_db --force
Ok, nex step is to create root user (when I installed mysql, table with users was empty, if that's also Your case use this steps). Execute:
/usr/bin/mysqld --skip-grant-tables --skip-networking & mysql -u root use mysql; FLUSH PRIVILEGES; INSERT into user (Host, User,Password) values ('localhost','root',' '); UPDATE user SET Password=PASSWORD('password you want') WHERE User='root'; update user set Select_priv='Y',Insert_priv='Y',Update_priv='Y',Delete_priv='Y',Create_priv='Y',Drop_priv='Y',Reload_priv='Y',Shutdown_priv='Y',Process_priv='Y',File_priv='Y',Grant_priv='Y',References_priv='Y',Index_priv='Y',Alter_priv='Y',Show_db_priv='Y',Super_priv='Y',Create_tmp_table_priv='Y',Lock_tables_priv='Y',Execute_priv='Y',Repl_slave_priv='Y',Repl_client_priv='Y',Create_view_priv='Y',Show_view_priv='Y',Create_routine_priv='Y',Alter_routine_priv='Y',Create_user_priv='Y' where user='root'; FLUSH PRIVILEGES;
To start mysql server you should type:
/etc/init.d/mysqld start
Install PhpMyAdmin
To install PhpMyAdmin you should download it from link and extract it to /usr/share/htdocs (Apache server root) and rename root folder of PhpMyAdmin (PhpMyAdmin-4..-allLanguages) tophpmyadmin
.
You should copy the content of config.sample.inc.php to config.inc.php and edit it:cp usr/share/htdocs/phpmyadmin/config.sample.inc.php usr/share/htdocs/phpmyadmin/config.inc.php nano usr/share/htdocs/phpmyadmin/config.inc.php
Change Authentication type and Servers parameters into:
$cfg['Servers'][$i]['auth_type'] = 'cookie'; $cfg['Servers'][$i]['host'] = '127.0.0.1'; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['compress'] = false; $cfg['Servers'][$i]['extension'] = 'mysql'; $cfg['Servers'][$i]['AllowNoPassword'] = true;
After that open
/usr/share/htdocs/phpmyadmin/libraries/common.inc.php
with nano (or whatever You use) and comment following part:#if (PMA_MYSQL_INT_VERSION < $cfg['MysqlMinVersion']['internal'] { # PMA_fatalError( # __('You should upgrade to %s %s or later.'), # array('MySQL', $cfg['MysqlMinVersion']['human']) # ); #}
And that's it:)
You can access PhpMyAdmin on <Onion Console IP adress>:<Your chosen port>/phpmyadminUPDATE (ty to @Chris-MacKay)
If you get some permission errors changeScriptAlias /php/ "/usr/bin"
toScriptAlias /php/ "/usr/bin/"
in httpd.conf .