标签 iOS 下的文章

与Linux相见恨晚

经常会有这样的一种想法,就是突然觉得与Linux相见恨晚,我隐隐约约的记得我第一次接触Linux应该是还在上小学,在我的那一个家,应该是我舅买了一个dell的电脑,预装Red Hat Desktop,所以附带了两张CD,因为用不到,所以给了我,然后我就在家里的台式机上安装了,因为那时候懂得不是特别的多,所以引导、分区?几乎是整个硬盘全都破坏了,安装上之后随便看看也就删了。
再后来,应该是曾经的一个服务商提供免费的VPS,提供CentOS系统,用了几次,一是麻烦,二是那家的免费的三天就要续期一次,那个时候根本就没有那个时间,现在那家服务商已经不在了。
再到后来也就是最近了,用了VPS,CentOS系统,发现命令行竟然是如此的方便(ps:在某些时候是),好用,更重要的是显得高端、大气、上档次,非常的有逼格 😳 ,好吧,就是这样,还有很多的东西需要学习,Linux、CentOS、Debian、Red Hat甚至是Mac OS X、iOS,好吧,我的对这几个系统的逻辑有点混乱,不知道应该是怎么的划分层次,但是好多东西竟然是那样的相同。 😎

在iPhone/iPad中搭建web服务器和PHP开发环境:Lighttpd + PHP(with GD) + MySQL

1. Install the Package in Cydia Add the Cydia Source http://ios-webstack.tk/cydia, find and install the package ios-lighttpd-php-mysql. Your lighttpd web server is now running. You can test it in Safari. But you need to do some more work with php and mysql.
2. Mysql Configuration
Log in your IOS device and execute the following shell commands.
# bin/mysql_install_db –user=daemon
# /usr/local/bin/mysqladmin -u root password ‘new-password’
# /usr/local/bin/mysql_secure_installation
执行mysql_secure_installation
Change the root password? [Y/n]
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] n
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] n
# mysql -u root -p’yourpassword’
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection idis 8
Server version: 5.1.66 Source distribution
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the current input statement.
mysql>
mysql>
mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
+——————–+
2 rows in set (0.01 sec)
mysql>
3. PHP Configuration
Create File: /etc/php.ini
;This is an ‘EXAMPLE’ configuration file for PHP.
;Be careful with the socket path
mysql.default_socket = /tmp/mysql.sock
pdo_mysql.default_socket = /tmp/mysql.sock
mysqli.default_socket = /tmp/mysql.sock
;Limits
upload_max_filesize = 10M
post_max_size= 10M
;TimeZone
;You should simply replace ‘Europe/Berlin’ with the desired timezone.
;The full list of supported time zones is available here: http://www.php.net/manual/en/timezones.php
date.timezone = ‘UTC’
;I recommends to place following lines to /etc/php.d/security.ini (it will not be touched
;from a cydia packages update).
;========================================================================================
;Please have a look at http://www.cyberciti.biz/tips/php-security-best-practices-tutorial.html
;It is up to you to comment-out some directives.
;Make sure you log all php errors to a log file.
;Make sure that php and lighttpd have write permissions.
log_errors=Off
error_log=/var/log/lighttpd/php_scripts_error.log
;To restrict PHP information leakage disable expose_php.
;Have a check befor and after: curl -I http://your.iOS-Web.server/yourPHPsite.php
expose_php=Off
;Do not expose PHP error messages toall site visitors.
; display_errors=Off
;The allow_url_fopen option allows PHP’s file functions – such as file_get_contents() and the
;include and require statements – can retrieve data from remote locations using ftp or http
;protocols. Programmers frequently forget this and don’t do proper input filtering when passing
;user-provided data to these functions, opening them up to code injection vulnerabilities.
;A large number of code injection vulnerabilities reported in PHP-based web applications are
;caused by the combination of enabling allow_url_fopen and bad input filtering.
; allow_url_fopen=Off
;I also recommend to disable allow_url_include for security reasons:
; allow_url_include=Off
;If turned On, mysql_connect() and mysql_pconnect() ignore any arguments passed to them.
;Please note that you may have to make some changes to your code. Third party and open source
;application such as WordPress, and others may not work at all when sql.safe_mode enabled.
; sql.safe_mode=On
;It is also recommended that you turn off magic_quotes_gpc for all php 5.3.x installations
;as the filtering by it is ineffective and not very robust. mysql_escape_string() and
;custom filtering functions serve a better purpose (hat tip to Eric Hansen):
; magic_quotes_gpc=Off
;You can set maximum execution time of each php script, in seconds.
;Another recommend option is to set maximum amount of time each script
;may spend parsing request data, and maximum amount of memory a script may consume.
;GD picture converting needs a lot of memory. Be carefull with ‘memory_limit’
;Set in seconds:
; max_execution_time = 30
; max_input_time = 30
; memory_limit = 40M
The packages include configuration files for PHP in /etc/ and extension configuration files in /etc/php.d/
Create File: /etc/php.d/php.ini
;You can splite this file in separate INI files.
;If you do that, please remember the extension loading
;order of INI files (alphabetically).
extension=iconv.so
extension=mbstring.so
extension=curl.so
;The loading order is important
extension=sqlite3.so
extension=pdo_sqlite.so
;The loading order is important
extension=mysqlnd.so
extension=mysqli.so
extension=mysql.so
extension=pdo_mysql.so
;Must be loaded after mbstring.so
extension=exif.so
extension=gd.so
extension=zip.so
extension=bz2.so
extension=calendar.so
extension=mcrypt.so
extension=xsl.so
extension=openssl.so
Finally, input http://127.0.0.1/phpinfo.php in Safari, you’ll get a long PHP information page like this:
PHP Version 5.4.8 System
Darwin mengtaos-iPhone 10.4.0 Darwin Kernel Version 10.4.0: Wed Oct 20 20:08:31 PDT 2010; root:xnu-1504.58.28~3/RELEASE_ARM_S5L8920X iPhone2,1
Build Date
Nov 14 2012 17:33:08
Configure Command
‘./configure’
Server API
CGI/FastCGI
Virtual Directory Support
disabled
Configuration File (php.ini) Path
/etc
Loaded Configuration File
/etc/php.ini
Scan this dir for additional .ini files
/etc/php.d
Now, Enjoy this little web server!
2024年5月
« 2月    
 12345
6789101112
13141516171819
20212223242526
2728293031  

广告

分类目录

近期评论

标签

历史上的今天

    历史上的今天没有存档

文章归档