Your favorite Apple, iPhone, iPad, iOS, Jailbreak, and Cydia site.
General iPhone Chatforums, a part of the
First off-- This is a serious discussion. Please don't do/say the following: "What's the point" "This is stupid" "What a waste of time" "It can't be done" "WAHhhh...it will waste...
10-26-2010, 06:46 PM #1[Question] Apache/PHP/MySQL and running a webserver on an iDevice (iOS 4.0+)
First off-- This is a serious discussion. Please don't do/say the following:
- "What's the point"
- "This is stupid"
- "What a waste of time"
- "It can't be done"
- "WAHhhh...it will waste your battery/wifi/disk writing"
- "SQLite works fine"
- Or any derivative of this
I will report ALL nasty comments and derogatory statements to the mods. Be respectful.
Yes yes, I know...there's already THREADS FOR THIS, but look closely and you will see they are outdated by 3 years. 2007 and iOS 1.0/Installer.app was a LONG time ago. Also, none of them cover how to get MySQL working. Only PHP and Apache. Plus, the packages they reference are gone.
I need this in order to demo sites for clients and to have a development machine at all times so I can test new code, hook to a db and more. This is [COLOR="rgb(139, 0, 0)"]not[/COLOR] a hobby.
As of now I have PHP and lighttpd (plus 'lighttpd SBSettings') installed via Cydia. (note: PHP installs via iPHPPod). I was able to find an iPhone friendly version of MySQL here: LINK (directions for installing are included in a readme)
Now, that said PHP does not see MySQL. PHP doesn't have the MySQL module/extension installed. It only has a PDO for attaching to SQLite. Problem is, most web apps (Wordpress, etc) need MySQL to work. SQLite doesn't have the same parameters as MySQL. In fact i find ZERO information on how to attach it or use it. There's no username/password/server address like with MySQL. BUT THAT DOESN'T MATTER. I do NOT want to use SQLite. I can't. Besides, it's slow. I already tried it.
Note: Wordpress does have a PLUGIN that allows you to use SQlite, but what about all the other apps I want to install? No options.
phpmyadmin also doesn't work. Without MySQL it won't work. It can't.
So, the point of this thread is:
How do we attach PHP/Apache/MySQL and have a full running webserver on our iDevice?
I have searched for 3 days and my Google-Fu is strong. However, nothing relative to this exists. It seems odd there's no package for this, anywhere. There used to be a great tutorial HERE, but all the files are gone.
So, let's get this going. I know someone has to be interested.
I have included a screenshot of phpinfo running to prove it is a working server. Now it needs MySQL to be a better, more usable, server.
The Following User Says Thank You to therealduckie For This Useful Post:
10-29-2010, 09:45 AM #2
I can add databases and configure and run MYSQL (via SSH terminal), but I'm still stumped on how to get it working with lighttpd and PHP.
This was relevant in another thread, so pasting it here to help the conversation:
one of my problems is that I use a pay-as-you-go SIM card and I don't have a data connection.
As for the module, I'm not great at coding, but I would have to guess tere is a way to compile it on the phone for the specific processor. I just don't have the technical know-how. Seeing as MySQL works as does PHP and the link I offered shows it was, at one time, possible...that tell me someone still has that code or that it has already been done, so entirely possible.
Found another tutorial here: Forum iTouch / [Tuto] Serveur Apache avec PHP et MySQL
But, like the iAmps site...the files are gone. Need the php.gz and php-cgi.gz that were there
I wanted to share some screenshots to give you guys an idea how this can be helpful land how well it works, so far.
Everything you see is running on my iPhone 3G.
Main Index - This link is the Index File so you can use it on your server. Better than a plain boring HTML page and sized for iPhone.
iPHPpod - an alternative to the iPod player. You can upload your own files via SSH without using iTunes. INCLUDING MOVIES
iWebKit - the standard kit for making a web based app
PHP - PHP running (with some of the iPhone server settings visible)
Wordpress - Uploaded to the server, but not working since there is no MySQL
Wordpress - As you can see, this is as far as it gets
eyeOS - a web based operating system with amazing features.
DirList - a CSS formatted directory listing
As you can see, it has a purpose and can be even MORE amazing with MySQL.
Last edited by therealduckie; 10-29-2010 at 09:45 AM. Reason: Automerged Doublepost
10-29-2010, 03:47 PM #3
That's pretty cool.
What would you use this for? (different than what is the point :P)mod edit/link removed.
10-30-2010, 09:29 AM #4
I'm totally interested in this for the appletv v2 use case. It should make for a great low end web host. I'm out right now but I'll take a deeper look later and see if there's something I can do to help!
11-04-2010, 10:31 AM #5
thank you, yes please. This project could use a lot more people.
The prospect of a $99 server is amazing.
Oh, and BitBass: let me know if you get it running or have it running already.
Last edited by therealduckie; 11-04-2010 at 10:31 AM. Reason: Automerged Doublepost
11-08-2010, 06:30 PM #6
11-09-2010, 02:10 PM #7
As I understood it should be here /usr/lib aftet installation but its not. Did you have the same?
By the way my mail is deli6z(at)gmail.com please write me here
11-11-2010, 10:07 AM #8
php.ini has to be created. Look at your phpinfo to see the path where it needs to go. Either way, you won't find MySQL because it isn't there. phppod uses SQlite but SQlite is slooooooow and useless for web development.
11-11-2010, 10:12 AM #9
11-11-2010, 04:40 PM #10
You need to have an understanding of PHP in order to make a php.ini - It is not something you just randomly create a file for. It's usually used when you need to change paths, adjust memory, and more.
And no, I am still waiting for more people to engage in conversation about this so that it can develop further.
If I had the MySQL file I would share it here.
11-11-2010, 05:05 PM #11
Can u pls share your php.ini file?
11-11-2010, 05:15 PM #12
Sure, although I am not sure how it will help you
extension = mysql.so
extension = mysql_php
extension_dir = /var/root/mysql
; Allow or prevent persistent links.
mysql.allow_persistent = On
; Maximum number of persistent links. -1 means no limit.
mysql.max_persistent = -1
; Maximum number of links (persistent + non-persistent). -1 means no limit.
mysql.max_links = -1
; Default port number for mysql_connect(). If unset, mysql_connect() will use
; the or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order). Win32 will only look
; at MYSQL_PORT.
; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
; Default host for mysql_connect() (doesn't apply in safe mode).
mysql.default_host = localhost
; Default user for mysql_connect() (doesn't apply in safe mode).
mysql.default_user = root
; Default password for mysql_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this file.
; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password")
; and reveal this password! And of course, any users with read access to this
; file will be able to reveal the password as well.
mysql.default_password = ******
; Maximum time (in secondes) for connect timeout. -1 means no limit
mysql.connect_timeout = 60
; Trace mode. When trace_mode is active (=On), warnings for table/index scans and
; SQL-Errors will be displayed.
mysql.trace_mode = Off
Last edited by therealduckie; 11-11-2010 at 05:50 PM.
11-11-2010, 06:10 PM #13
Where did you get this code, its yours?
Last edited by Deli6z; 11-11-2010 at 06:21 PM.
11-11-2010, 07:32 PM #14
You should really read more of the thread. All your questions are answered above.
11-11-2010, 08:09 PM #15
You said nothing about php.ini file before, so how can I know? Usually when you're installing php on pc its appears automatically, in my case I dont have it at all, it just havent being created. My question was- did you create it and put all that code by yourself? Thank you for the answer
Last edited by Deli6z; 11-11-2010 at 08:12 PM.
11-12-2010, 07:16 PM #16
I used a server I have running on my mac for the info, however all of it refers to MySQL which is not installed...unless someone wants to crawl out of the woodwork and post it. *HINT HINT* you know who you are. Seriously, I find it odd this thread is in 3 of the most popular iPhone communities on the web and no one has offered the file.
11-14-2010, 03:59 PM #17
I have an iPhone friendly install of MySQL, but my PHP install does not use a PHP.ini file; it's based on a Linux install - it used various .h files.
Could you please supply the install of PHP you used? Thanks!
I can't attach the file, as it is too large. (10 MB or so.) I'm behind a restrictive proxy, so I can't upload the file to a 3rd party site. I will do so when I have the chance.
11-14-2010, 05:13 PM #18
11-14-2010, 06:50 PM #19
11-14-2010, 06:53 PM #20
Yes, very much so, Please.