Ubuntu12.04上安装MySQL Server提示mysql-server : Depends:
yyyyzh@yzh:~$ sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
mysql-server : Depends: mysql-community-server (= 8.0.18-1ubuntu16.04) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).


apt-get -f install
照着提示走不久完事了 ( ̄△ ̄;)

Csdn user default icon
使用apache2 web-server的Ubuntu 12.04 php,mysql-server和phpmyadmin安装错误

<div class="post-text" itemprop="text"> <p>I have installed apache2 web-server and I want to install php, mysql and phpmyadmin in ubuntu 12.04 </p> <p>I followed this <strong><a href="https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu" rel="nofollow noreferrer">link</a></strong></p> <p>but I got this error </p> <pre><code>start: Job failed to start invoke-rc.d: initscript mysql, action "start" failed. No apport report written because the error message indicates its a followup error from a previous failure. dpkg: error processing mysql-server-5.5 (--configure): subprocess installed post-installation script returned error exit status 1 dpkg: dependency problems prevent configuration of mysql-server: mysql-server depends on mysql-server-5.5; however: Package mysql-server-5.5 is not configured yet. dpkg: error processing mysql-server (--configure): dependency problems - leaving unconfigured Errors were encountered while processing: mysql-server-5.5 mysql-server </code></pre> <p>I tried again and again but I didn't get any solution please help me </p> </div>

在Ubuntu 12.04中安装FFMpeg并在PHP-FFMpeg中使用它

<div class="post-text" itemprop="text"> <p>I have tried many many failed attempt to install FFMpeg in my Ubuntu 12.04. I used following links: <a href="http://www.mysql-apache-php.com/ffmpeg-install.htm" rel="nofollow">1</a>, <a href="http://blog.shineservers.com/installing-and-configuring-ffmpeg-and-ffpeg-php/" rel="nofollow">2</a>, <a href="https://www.ndchost.com/wiki/server-administration/install-ffmpeg" rel="nofollow">3</a> and many others.</p> <p>Then I need to use it in <a href="https://github.com/PHP-FFMpeg/PHP-FFMpeg" rel="nofollow">PHP-FFMpeg</a> And Then I need to deploy in Linux based server. This is my requirement.</p> <p>But after much trying, I just downloaded static build through this <a href="http://johnvansickle.com/ffmpeg/" rel="nofollow">link</a>.</p> <p>This helped me to successfully convert video and use FFMpeg through terminal in Ubuntu. But I cannot use it through PHP-FFMpeg library <strong>which I need to run</strong>. In docs of PHP-FFMpeg it is written <br></p> <blockquote> <p>This library requires a working FFMpeg install. You will need both FFMpeg and FFProbe binaries to use it. Be sure that these binaries can be located with system PATH to get the benefit of the binary detection, otherwise you should have to explicitely give the binaries path on load.</p> </blockquote> <p>and I am not getting this.</p> </div>

orm:schema-tool:create - 拒绝访问

<div class="post-text" itemprop="text"> <p>I am trying to add Doctrine to existing custom php application. The first issue that I've faced is the following:</p> <p>when trying to run </p> <pre><code>$ php vendor/bin/doctrine orm:schema-tool:create </code></pre> <p>I get <code>Access denied</code>.</p> <p>Here is the cli-config.php file that I am using:</p> <pre><code>&lt;?php use Doctrine\ORM\EntityManager; use Doctrine\ORM\Tools\Console\ConsoleRunner; use Doctrine\ORM\Tools\Setup; require_once "vendor/autoload.php"; $modelsPath = realpath(__DIR__.'/../model'); $config = Setup::createAnnotationMetadataConfiguration(array($modelsPath), true); // database configuration parameters $conn = array( 'driver' =&gt; 'pdo_mysql', 'host' =&gt; 'localhost', 'user' =&gt; 'root', 'password' =&gt; '', 'dbname' =&gt; 'database', ); return ConsoleRunner::createHelperSet(EntityManager::create($conn, $config)); </code></pre> <p>Where did I go wrong?</p> <p><strong>UPDATE</strong></p> <ul> <li>php version is 5.4.6, OS </li> <li>Ubuntu 12.04, </li> <li>Doctrine Command Line Interface version 2.4.2</li> <li>vendor/doctrine/orm/bin/doctrine file is set as executable and own by the same user as the one trying to run it</li> </ul> <p><strong>UPDATE</strong></p> <p>As per this <a href="http://www.doctrine-project.org/jira/browse/DDC-2486#comment-22763" rel="nofollow">discussion</a>, I've been using a wrong driver. Corrections made - no effect.</p> </div>


<div class="post-text" itemprop="text"> <p>I am setting a hash entry using phpredis which is pulling data from mysql; since i am migrating some data from my MySQL database to redis for faster access, since the amount of data/changes i am making in redis is large(4 GB), it is crashing after every 5-10 mins(variable). </p> <p>the log says:</p> <pre><code>[4464] 12 Mar 12:20:04 # Background saving terminated by signal 9 [4464] 12 Mar 12:20:04 * 10 changes in 300 seconds. Saving... [4464] 12 Mar 12:20:05 * Background saving started by pid 9212 [4464] 12 Mar 12:20:05 # Background saving terminated by signal 9 [4464] 12 Mar 12:20:05 * 10 changes in 300 seconds. Saving... [4464] 12 Mar 12:20:06 * Background saving started by pid 9214 [4464] 12 Mar 12:20:07 # Background saving terminated by signal 9 [4464] 12 Mar 12:20:07 * 10 changes in 300 seconds. Saving... [10975] 12 Mar 12:43:13 * Server started, Redis version 2.2.12 </code></pre> <p>Which makes me restart redis again and again, which very painfull i have already set vm.overcommit to 1.</p> <p>I am using AWS ec2 small instance with RAM 1.6 GB on Ubuntu 12.04 LTS.</p> <p>Please advice me some smart solution.</p> <p>Thanks in advance.</p> </div>

无法在Ubuntu 12.04中使用PHP移动文件

<div class="post-text" itemprop="text"> <p>Hi all this php code is perfectly working on windows but i am unable to move a attached file to a folder in ubuntu using this code.</p> <pre><code>&lt;?php $db=mysql_connect("localhost","root",""); mysql_select_db("iphone",$db) or die("Error mysql connection"); $path="event-image/"; $path=$path.basename($_FILES['image']['name']); if(move_uploaded_file($_FILES['image']['tmp_name'],$path)) { $ename=$_POST['ename']; $elocation=$_POST['elocation']; $date=$_POST['edate']; $stime=$_POST['stime']; $etime=$_POST['etime']; $website=$_POST['website']; $image=basename($_FILES['image']['name']); $sql="insert into event(ename,elocation,date,stime,etime,website,image) values('$ename','$elocation','$date','$stime','$etime','$website','$image')"; $result=mysql_query($sql,$db); } echo 'Message has been sent&lt;br&gt;'; ?&gt; </code></pre> </div>

Gearman:客户请求和工作人员接收之间3秒。 这是正常的吗?

<div class="post-text" itemprop="text"> <p>Environment:</p> <ul> <li>Ubuntu 12.04 Desktop &amp; Server</li> <li>PHP 5.3.10</li> <li>Gearman (libgearman 1.1.5 with PHP Extension 1.1.1)</li> <li>Multiple servers on LAN</li> </ul> <p>I've been working on distributed processes for some time. Most of these tools require DB access. Eventually this led to server/resource issues due to MySQL getting overwhelmed (as far as I can tell).</p> <p>I've tried a number of solutions and now I'm trying Gearman. I have queries being sent to workers and I'm getting the correct response back to the client. (I haven't yet tested out returning errors.)</p> <p>My problem is that my test code has 3 sql statements - all selects. Probably 4 times out of 5 when I run this test script 2 or the queries take 3 sec to return and 1 takes less 0.01 sec to complete. On the 5th attempt with this script all 3 queries take 3 sec. The query that takes less than 0.01 sec is often times the last query but not always. And I have a direct DB connection executing the same queries and they all return in the 0.002 sec range.</p> <p>This behavior doesn't appear to change whether I run 1 or up to 4 workers. The client is using doHigh.</p> <p>Specifically here are some times (in seconds or Unix Epoch time) from my latest test run:</p> <ul> <li>Execution Time of Worker: 0.00066</li> <li>Client Job Request Time: 1380128735.505</li> <li>Worker Job Received Time: 1380128744.3248</li> <li>Client Receive Result Time: 1380128744.3262</li> </ul> <p>Obviously this request took about 9 seconds not 3. The client and worker both reside on the same machine. The job server is open to the LAN so it is listening on 192.168.1.XX instead of Sending the job to a job server on a different machine (faster, more RAM, almost no load) the times are effectively the same.</p> <p>Is this the expected behavior of Gearman?</p> <p>Thanks</p> <p>Per suggestions on another forum I logged what was happening using --verbose=DEBUG. Long story short the gaps in time appear to be happening btwn Sent NOOP to 192.168.1... and 192.168.1... Ready POLLIN -&gt; ... Here is a relevant log excerpt (wish I knew how to format it better):</p> <blockquote> <p>INFO 2013-09-26 02:39:43.873141 [ main ] Accepted connection from DEBUG 2013-09-26 02:39:43.873200 [ 3 ] Received CON wakeup event -&gt; libgearman-server/gearmand_thread.cc:602 DEBUG 2013-09-26 02:39:43.873244 [ 3 ] setsockopt() 33 -&gt; libgearman-server/io.cc:809 DEBUG 2013-09-26 02:39:43.873276 [ 3 ] Watching POLLIN -&gt; libgearman-server/gearmand_thread.cc:151 INFO 2013-09-26 02:39:43.873292 [ 3 ] Gear connection made DEBUG 2013-09-26 02:39:43.873309 [ 3 ] Ready POLLIN -&gt; libgearman-server/gearmand_con.cc:118 DEBUG 2013-09-26 02:39:43.873333 [ 3 ] read 22 bytes -&gt; libgearman-server/io.cc:686 INFO 2013-09-26 02:39:43.873346 [ 3 ] Gear unpack DEBUG 2013-09-26 02:39:43.873363 [ 3 ] GEAR length: 0 gearmand_command_t: GEARMAN_COMMAND_OPTION_REQ -&gt; libgearman-server/plugins/protocol/gear/protocol.cc:248 DEBUG 2013-09-26 02:39:43.873375 [ 3 ] Received OPTION_REQ -&gt; libgearman-server/thread.cc:318 DEBUG 2013-09-26 02:39:43.873399 [ 3 ] Watching POLLIN -&gt; libgearman-server/gearmand_thread.cc:151 DEBUG 2013-09-26 02:39:43.873411 [ proc ] packet command OPTION_REQ -&gt; libgearman-server/server.cc:98 DEBUG 2013-09-26 02:39:43.873457 [ proc ] 'exceptions' -&gt; libgearman-server/server.cc:485 DEBUG 2013-09-26 02:39:43.873492 [<br> 3 ] Received RUN wakeup event -&gt; libgearman-server/gearmand_thread.cc:607 DEBUG 2013-09-26 02:39:43.873508 [ 3 ] GEAR length: 0 gearmand_command_t: GEARMAN_COMMAND_OPTION_RES -&gt; libgearman-server/plugins/protocol/gear/protocol.cc:274 DEBUG 2013-09-26 02:39:43.873551 [ 3 ] send() 22 bytes to peer -&gt; libgearman-server/io.cc:275 DEBUG 2013-09-26 02:39:43.873565 [ 3 ] Sent OPTION_RES to -&gt; libgearman-server/thread.cc:365 DEBUG 2013-09-26 02:39:43.873583 [ 3 ] Ready POLLIN -&gt; libgearman-server/gearmand_con.cc:118 DEBUG 2013-09-26 02:39:43.873599 [ 3 ] read 177 bytes -&gt; libgearman-server/io.cc:686 INFO 2013-09-26 02:39:43.873610 [ 3 ] Gear unpack DEBUG 2013-09-26 02:39:43.873635 [ 3 ] GEAR length: 118 gearmand_command_t: GEARMAN_COMMAND_SUBMIT_JOB_HIGH -&gt; libgearman-server/plugins/protocol/gear/protocol.cc:248 DEBUG 2013-09-26 02:39:43.873648 [ 3 ] Received SUBMIT_JOB_HIGH -&gt; libgearman-server/thread.cc:318 DEBUG 2013-09-26 02:39:43.873668 [ 3 ] Watching POLLIN -&gt; libgearman-server/gearmand_thread.cc:151 DEBUG 2013-09-26 02:39:43.873675 [ proc ] packet command SUBMIT_JOB_HIGH -&gt; libgearman-server/server.cc:98 DEBUG 2013-09-26 02:39:43.873696 [ proc ] Received submission, function:db_access unique:e692b4c2-2654-11e3-bc34-90e6baa255ea with 2 arguments -&gt; libgearman-server/server.cc:231 DEBUG 2013-09-26 02:39:43.873715 [ proc ] Comparing queue 0 to limit 0 for priority 0 -&gt; libgearman-server/job.cc:174 NOTICE 2013-09-26 02:39:43.873754 [ proc ] accepted,db_access,e692b4c2-2654-11e3-bc34-90e6baa255ea,0 -&gt; libgearman-server/server.cc:301 DEBUG 2013-09-26 02:39:43.873764 [<br> 3 ] Received RUN wakeup event -&gt; libgearman-server/gearmand_thread.cc:607 DEBUG 2013-09-26 02:39:43.873763 [ 4 ] Received RUN wakeup event -&gt; libgearman-server/gearmand_thread.cc:607 DEBUG 2013-09-26 02:39:43.873794 [ 3 ] GEAR length: 0 gearmand_command_t: GEARMAN_COMMAND_JOB_CREATED -&gt; libgearman-server/plugins/protocol/gear/protocol.cc:274 DEBUG 2013-09-26 02:39:43.873803 [ 4 ] GEAR length: 0 gearmand_command_t: GEARMAN_COMMAND_NOOP -&gt; libgearman-server/plugins/protocol/gear/protocol.cc:274 DEBUG 2013-09-26 02:39:43.873824 [ 3 ] send() 25 bytes to peer -&gt; libgearman-server/io.cc:275 DEBUG 2013-09-26 02:39:43.873838 [ 3 ] Sent JOB_CREATED to -&gt; libgearman-server/thread.cc:365 DEBUG 2013-09-26 02:39:43.873850 [ 4 ] send() 12 bytes to peer -&gt; libgearman-server/io.cc:275 DEBUG 2013-09-26 02:39:43.873865 [ 4 ] Sent NOOP to -&gt; libgearman-server/thread.cc:365 DEBUG 2013-09-26 02:39:47.032010 [<br> 4 ] Ready POLLIN -&gt; libgearman-server/gearmand_con.cc:118 DEBUG 2013-09-26 02:39:47.032061 [ 4 ] read 12 bytes -&gt; libgearman-server/io.cc:686 INFO 2013-09-26 02:39:47.032074 [ 4 ] Gear unpack DEBUG 2013-09-26 02:39:47.032086 [ 4 ] GEAR length: 0 gearmand_command_t: GEARMAN_COMMAND_GRAB_JOB_ALL -&gt; libgearman-server/plugins/protocol/gear/protocol.cc:248 DEBUG 2013-09-26 02:39:47.032098 [ 4 ] Received GRAB_JOB_ALL -&gt; libgearman-server/thread.cc:318 DEBUG 2013-09-26 02:39:47.032119 [ 4 ] Watching POLLIN -&gt; libgearman-server/gearmand_thread.cc:151 DEBUG 2013-09-26 02:39:47.032134 [ proc ] packet command GRAB_JOB_ALL -&gt; libgearman-server/server.cc:98 DEBUG 2013-09-26 02:39:47.032170 [ proc ] Jobs available for db_access: 1 -&gt; libgearman-server/gearmand_con.cc:291 DEBUG 2013-09-26 02:39:47.032200 [ proc ] Sending reduce submission, Partitioner: db_access(9) Reducer: (0) Unique: e692b4c2-2654-11e3-bc34-90e6baa255ea(36) with data sized (118) -&gt; libgearman-server/server.cc:607 DEBUG 2013-09-26 02:39:47.032239 [<br> 4 ] Received RUN wakeup event -&gt; libgearman-server/gearmand_thread.cc:607 DEBUG 2013-09-26 02:39:47.032254 [ 4 ] GEAR length: 118 gearmand_command_t: GEARMAN_COMMAND_JOB_ASSIGN_ALL -&gt; libgearman-server/plugins/protocol/gear/protocol.cc:274 DEBUG 2013-09-26 02:39:47.032290 [ 4 ] send() 192 bytes to peer -&gt; libgearman-server/io.cc:275 DEBUG 2013-09-26 02:39:47.032303 [ 4 ] Sent JOB_ASSIGN_ALL to -&gt; libgearman-server/thread.cc:365 DEBUG 2013-09-26 02:39:47.034398 [ 4 ] Ready<br> POLLIN -&gt; libgearman-server/gearmand_con.cc:118 DEBUG 2013-09-26 02:39:47.034416 [ 4 ] read 1926 bytes -&gt; libgearman-server/io.cc:686 INFO 2013-09-26 02:39:47.034427 [ 4 ] Gear unpack DEBUG 2013-09-26 02:39:47.034438 [ 4 ] GEAR length: 1900 gearmand_command_t: GEARMAN_COMMAND_WORK_COMPLETE -&gt; libgearman-server/plugins/protocol/gear/protocol.cc:248 DEBUG 2013-09-26 02:39:47.034462 [ 4 ] Received WORK_COMPLETE -&gt; libgearman-server/thread.cc:318 DEBUG 2013-09-26 02:39:47.034479 [ 4 ] Watching POLLIN -&gt; libgearman-server/gearmand_thread.cc:151 DEBUG 2013-09-26 02:39:47.034485 [ proc ] packet command WORK_COMPLETE -&gt; libgearman-server/server.cc:98 DEBUG 2013-09-26 02:39:47.034526 [ 3 ] Received RUN wakeup event -&gt; libgearman-server/gearmand_thread.cc:607 DEBUG 2013-09-26 02:39:47.034542 [ 3 ] GEAR length: 1900 gearmand_command_t: GEARMAN_COMMAND_WORK_COMPLETE -&gt; libgearman-server/plugins/protocol/gear/protocol.cc:274 DEBUG 2013-09-26 02:39:47.034577 [ 3 ] send() 1926 bytes to peer -&gt; libgearman-server/io.cc:275 DEBUG 2013-09-26 02:39:47.034591 [ 3 ] Sent WORK_COMPLETE to -&gt; libgearman-serve</p> </blockquote> <p>r/thread.cc:365</p> </div>


<div class="post-text" itemprop="text"> <p>After doing a lot of research and work, I am perplexed at this time on why my MySQL server keeps refusing connections. I have gone though many others who say to increase the max-connections, decreased the wait_timeout, and have been increasing the virtual machine's memory to 7 GB now, reserving 1.5 GB of memory in vCenter.</p> <p>I am running this on a HP Prolaint DL 360 G5 with two Intel Xeon E5405 and 16 GB of RAM running vSphere 5.5 with vCenter. The MySQL VM is running Ubuntu 12.04 on a Virtual Machine Minimal install, having:</p> <p>Active: 215 MB Granted: 3.65 GB Consumed: 1.66 GB Balloon: 2.88 GB</p> <p>CPU Maximum MHz: 344 CPU Avg MHz: 55.561</p> <p>Disk Usage Maximum (KBps): 10803 Disk Highest Latency: 46 Disk Average Latency: 2</p> <p>ulimit -n: 1024</p> <p>Amount of connections while refusing connection: 16</p> <p>I have apache with php, two openfire instances, teamspeak, and rsyslog connected to the database server. I have checked and none are using persistant connections.</p> <p>Any idea why this happens every few days?</p> <p>The my.cnf file:</p> <pre><code># # The MySQL database server configuration file. # # You can copy this to one of: # - "/etc/mysql/my.cnf" to set global options, # - "~/.my.cnf" to set user-specific options. # # One can use all long options that the program supports. # Run program with --help to get a list of available options and with # --print-defaults to see which it would actually understand and use. # # For explanations see # http://dev.mysql.com/doc/mysql/en/server-system-variables.html # This will be passed to all mysql clients # It has been reported that passwords should be enclosed with ticks/quotes # escpecially if they contain "#" chars... # Remember to edit /etc/mysql/debian.cnf when changing the socket location. [client] port = 3306 socket = /var/run/mysqld/mysqld.sock # Here is entries for some specific programs # The following values assume you have at least 32M ram # This was formally known as [safe_mysqld]. Both versions are currently parsed. [mysqld_safe] socket = /var/run/mysqld/mysqld.sock nice = 0 [mysqld] # # * Basic Settings # user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /mysql/mysql tmpdir = /tmp lc-messages-dir = /usr/share/mysql skip-external-locking # # Instead of skip-networking the default is now to listen only on # localhost which is more compatible and is not less secure. bind-address = # # * Fine Tuning # key_buffer = 16M max_allowed_packet = 16M thread_stack = 192K thread_cache_size = 8 wait_timeout = 360 # This replaces the startup script and checks MyISAM tables if needed # the first time they are touched myisam-recover = BACKUP max_connections = 1000 table_cache = 2000 #thread_concurrency = 10 # # * Query Cache Configuration # query_cache_limit = 20M query_cache_size = 32M # # * InnoDB Configuration - gac64k56 # innodb_buffer_pool_size = 2G join_buffer_size = 256K # # * Logging and Replication # # Both location gets rotated by the cronjob. # Be aware that this log type is a performance killer. # As of 5.1 you can enable the log at runtime! #general_log_file = /var/log/mysql/mysql.log #general_log = 1 # # Error log - should be very few entries. # log_error = /var/log/mysql/error.log # # Here you can see queries with especially long duration #log_slow_queries = /var/log/mysql/mysql-slow.log #long_query_time = 2 #log-queries-not-using-indexes # # The following can be used as easy to replay backup logs or for replication. # note: if you are setting up a replication slave, see README.Debian about # other settings you may need to change. #server-id = 1 #log_bin = /var/log/mysql/mysql-bin.log expire_logs_days = 10 max_binlog_size = 100M #binlog_do_db = include_database_name #binlog_ignore_db = include_database_name # # * InnoDB # # InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/. # Read the manual for more InnoDB related options. There are many! # # * Security Features # # Read the manual, too, if you want chroot! # chroot = /var/lib/mysql/ # # For generating SSL certificates I recommend the OpenSSL GUI "tinyca". # # ssl-ca=/etc/mysql/cacert.pem # ssl-cert=/etc/mysql/server-cert.pem # ssl-key=/etc/mysql/server-key.pem [mysqldump] quick quote-names max_allowed_packet = 16M [mysql] #no-auto-rehash # faster start of mysql but no tab completition [isamchk] key_buffer = 16M # # * IMPORTANT: Additional settings that can override those from this file! # The files must end with '.cnf', otherwise they'll be ignored. # !includedir /etc/mysql/conf.d/ </code></pre> </div>


<div class="post-text" itemprop="text"> <p>I want to install <code>Django Framework</code> on my Ubuntu(12.04)laptop, already running a <code>Apache-Php-MySQL</code> environment.</p> <p>I followed this tutorial:<a href="http://www.lennu.net/2012/05/14/django-deployement-installation-to-ubuntu-12-dot-04-server/" rel="nofollow">http://www.lennu.net/2012/05/14/django-deployement-installation-to-ubuntu-12-dot-04-server/</a></p> <p>I stopped at mod_WSGI installation to check if my old php project would not be affected from new apache config...well they are! When I try to run them browser not show sites but makes me download the file(ex index.php) of project and show nothing!</p> <p>What is going on here??</p> </div>

Go Web应用程序+ MySql驱动程序停止/超时

<div class="post-text" itemprop="text"> <p>UPDATE: After further diagnosis, there is a problem with the go-sql-driver/mysql I driver package. It turns out that the underlying tcp can't seem to detect a broken tcp connection. The full details are in the github issue in the <code>go-sql-driver/mysql</code> project below:</p> <p><a href="https://github.com/go-sql-driver/mysql/issues/257" rel="nofollow">https://github.com/go-sql-driver/mysql/issues/257</a></p> <p>--</p> <p>I am currently experiencing a <em>stalling</em> or <em>broken web</em> app after a period of idle between 15 to 48 minutes. The most critical issue is described below:</p> <ul> <li>Visit a URL, any url on the site, and load the page completely (as in, the page actually loads and the logs show a complete page has loaded).</li> <li>Close browser, and wait.</li> </ul> <p>A typical request is logged like this:</p> <pre><code>2014/07/13 15:29:54 INFO template rendering: index 2014/07/13 15:29:54 METRIC, URL: /, HANDLER TIME: 7.2339ms, CTX TIME: 5.0894ms, TOTAL TIME: 12.3258ms </code></pre> <p>After a long period of time (ranging from 15m to 48m), the system all of a sudden logs these lines below with no interaction - the web app has been idle this entire time:</p> <pre><code>[MySQL] 2014/07/13 16:00:09 packets.go:32: read tcp remote-mysql-server-address:3306: connection timed out [MySQL] 2014/07/13 16:00:09 packets.go:118: write tcp remote-mysql-server-address:3306: broken pipe 2014/07/13 16:00:10 INFO template rendering: index 2014/07/13 16:00:10 METRIC, URL: /, HANDLER TIME: 8.8574ms, CTX TIME: 31m19.2606723s, TOTAL TIME: 31m19.2695329s </code></pre> <p>Notice the "TOTAL TIME" is 31 minutes and 19 seconds? Also, notice the MySql driver error that is logged at the same time?</p> <p>There was no activity / no web request made. The web app was simply idle.</p> <p>The most critical issue is what comes next after these log messages: <strong><em>the very next web request is stalls completely, never returning a response</em></strong>:</p> <pre><code>user@govm1:~$ wget http://localhost --2014-07-13 17:11:18-- http://localhost/ Resolving localhost (localhost)... Connecting to localhost (localhost)||:80... connected. HTTP request sent, awaiting response... Read error (Connection timed out) in headers. Retrying. --2014-07-13 17:26:19-- (try: 2) http://localhost/ Connecting to localhost (localhost)||:80... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [text/html] Saving to: `index.html.4' [ &lt;=&gt; ] 6,310 --.-K/s in 0.001s 2014-07-13 17:26:20 (9.61 MB/s) - `index.html.4' saved [6310] </code></pre> <p>And it sits idle, no response, for 15 minutes until wget times out.</p> <p>Now, if I make a 2nd or 3rd request immediately after this one is stalled and anytime while it is stalled, the go web app responds and returns a full page for other requests. No issues. And then, the cycle starts over from the last request I make and let it site idle.</p> <p>After this 15m, you can guess exactly what is logged next:</p> <pre><code>[MySQL] 2014/07/13 17:26:57 packets.go:32: read tcp remote-mysql-server-address:3306: connection timed out [MySQL] 2014/07/13 17:26:57 packets.go:118: write tcp remote-mysql-server-address:3306: broken pipe 2014/07/13 17:26:57 INFO template rendering: index 2014/07/13 17:26:57 METRIC, URL: /, HANDLER TIME: 6.8938ms, CTX TIME: 15m39.1718434s, TOTAL TIME: 15m39.1787398s </code></pre> <p>Another 15m wait time.</p> <p>I eliminated Windows Azure, the Cluster VIP and Firewall/Linux VM running the go web app as an issue because I ran <code>wget http://localhost</code> locally on the same box, and I get this "stalled" request that never completes and never sends back anything.</p> <p>--</p> <p>There are a number of factors in my web app so I will try to outline them accordingly.</p> <p>Using:</p> <ul> <li>Go 1.3</li> <li>go-sql-driver/mysql ## Version 1.2 (2014-06-03)</li> <li>Ubuntu 12.04 LTS, ~June 2014 Updates</li> <li>Windows Azure</li> </ul> <p>Do note that the Linux box running MySql is a different Linux box running the cluster of GoLang apps - and they are in separate dedicated Cloud Services. The MySql vm is a single VM, no cluserting.</p> <p>Here is some related code:</p> <pre><code>// global handler for our DB var db *sql.DB // CLI parameter var dbdsn string func init() { flag.StringVar(&amp;dbdsn, "dbdsn", "root:root@tcp(localhost:3306)/prod?timeout=5s&amp;tls=false&amp;autocommit=true", "Specifies the MySql DSN connection.") flag.Parse() var err error db, err = sql.Open("mysql", dbdsn) if err != nil { log.Printf("ERROR in sql.Open(): %v", err) } //db.SetMaxIdleConns(5) // verify the DSN is setup properly1 err = db.Ping() if err != nil { panic("PANIC when pinging db: " + err.Error()) // proper error handling instead of panic in your app } } // ********** // * omitted is the Gorilla MUX router and http handler registrations // ********** func ArticleHandler(w http.ResponseWriter, r *http.Request, c *Context) (err error) { m := NewArticle(c) id := c.Vars["id"] var pid int var title, body, excerpt, date, slug, fi, fv, region, region_slug string err = db.QueryRow( "SELECT p.ID, p.post_title, p.post_content, p.post_excerpt, p.post_date, p.post_name, "+ "(SELECT fpim.meta_value FROM wp_postmeta fpim WHERE fpim.meta_key = '_wp_attached_file' AND fpim.post_id = (SELECT fpim2.meta_value FROM wp_postmeta fpim2 WHERE fpim2.post_id = p.ID AND fpim2.meta_key = '_thumbnail_id' LIMIT 1) LIMIT 1) AS featured_image, "+ "(SELECT fpim3.meta_value FROM wp_postmeta fpim3 WHERE fpim3.meta_key = 'fv_video' AND fpim3.post_id = p.ID LIMIT 1) AS featured_video, "+ "t.name as region, t.slug as region_slug "+ "FROM wp_posts p "+ "JOIN wp_term_relationships tr ON tr.object_id=p.ID "+ "JOIN wp_term_taxonomy tt ON tt.term_taxonomy_id=tr.term_taxonomy_id "+ "JOIN wp_terms t ON t.term_id=tt.term_id "+ "WHERE p.post_name=? AND p.post_type='post' AND p.post_status='publish' AND p.post_date &lt;= UTC_TIMESTAMP()"+ "AND tr.object_id=p.ID AND tt.parent = (SELECT t3.term_id FROM wp_terms t3 WHERE t3.name=? LIMIT 1) LIMIT 1", id, RegionsParentCategory). Scan(&amp;pid, &amp;title, &amp;body, &amp;excerpt, &amp;date, &amp;slug, &amp;fi, &amp;fv, &amp;region, &amp;region_slug) if err != nil { if err == sql.ErrNoRows { // snipped code for redirects // article was not found return handleNotFound(w, r, c) } else { log.Printf("ERROR in .Scan(): %v", err) } } else { m.Region = Region{ Name: region, Slug: region_slug, } m.Id = pid m.Title = title m.Body = template.HTML(body) // render the raw html m.Excerpt = excerpt m.Datetime = date m.Slug = slug m.FeaturedImageUrl = fi m.FeaturedVideoUrl = fv } web.RenderTemplate(w, "article", m) return } </code></pre> <h3>5 more DB queries, per request</h3> <p>In addition to this query, my "Context" you see being passed into the handler runs 4 to 6 additional SQL queries. Therefore, each "article" handler that loads runs about 5 to 7 SQL queries, minimal, using the exact same pattern and <code>*db</code> global variable you see above.</p> <h3>Timeouts / errors are always on the same DB query</h3> <p>Here's one of the "context" queries as a comparison:</p> <pre><code>rows2, err := db.Query( "SELECT p.post_title, p.post_name "+ "FROM wp_posts p "+ "WHERE p.post_type='page' AND p.post_status='publish' AND p.post_date &lt;= UTC_TIMESTAMP() "+ "AND p.post_parent = (SELECT p2.ID FROM wp_posts p2 WHERE p2.post_name=? LIMIT 1) "+ "ORDER BY p.menu_order", FooterPagesParentNameSlug) if err != nil { log.Printf("ERROR in AllPages .Query() : %v", err) } else { defer rows2.Close() c.AllFooterPages = make([]FooterPage, 0) for rows2.Next() { var name, slug string err := rows2.Scan(&amp;name, &amp;slug) if err != nil { log.Printf("ERROR in AllPages row.Scan() : %v", err) } else { p := FooterPage{ Page: Page{ Title: name, Slug: slug, }, } c.AllFooterPages = append(c.AllFooterPages, p) } } } </code></pre> <p>Nothing special there. </p> <p>I do call <code>defer rows2.Close()</code> only if there was no error. Perhaps that is part of the issue? This particular SQL query seems to log errors under load tests as <code>no response</code> or mysql driver timing out.</p> <h2>Questions</h2> <p>Why am I getting request timeouts logged in excess of 15 to 30 minutes, from an idle site? That seems like a bug with the mysql driver I am using, possibly holding a connection open. But, the last http request was successful and returned a complete page + template.</p> <p>I even have the Timeout set in the connection string, which is 5 seconds. Even if it is a problem with the mysql server, why the 15 minute timeout/request logged? Where did that request come from?</p> <p>It still could be a MySql driver issue, blocking the request from completing - maybe being blocked by the MySql dedicated VM and an issue there. If that is the case, then how come nothing is logged? What is this random timeout of 15m to 49m minutes? It is usually only 15m or 31m, but sometimes 48m is logged. </p> <p><strong>It is very interesting on the "15m" multiples there in the timeouts (@15m, 31m and 48m), allotting for some padding there in seconds.</strong></p> <p>Thanks in advance.</p> </div>


<div class="post-text" itemprop="text"> <p>I know this question has been asked many times, but in all other posts i searched, i just couldn't find the answer. I just cant seem to connect to the database.</p> <p>My OS is Ubuntu 12.04, if it helps.</p> <p>Here is my code for <code>config.php</code>:</p> <pre><code>&lt;?php define('DB_HOST','localhost'); define('DB_USER','root'); define('DB_PASS','121212aa'); define('DB_NAME','PHP-Wizard'); ?&gt; </code></pre> <p>And also <code>Database.php</code></p> <pre><code>&lt;?php class Database{ public $host = DB_HOST; public $username = DB_USER; public $password = DB_PASS; public $db_name = DB_NAME; public $link; public $error; /* * Class Constructor */ public function __construct(){ //Call Connect Function $this-&gt;connect(); } /* * Connector */ private function connect(){ $this-&gt;link = new mysqli($this-&gt;host, $this-&gt;username, $this-&gt;password, $this-&gt;db_name); if(!$this-&gt;link){ $this-&gt;error = "Connection Failed: ".$this-&gt;link-&gt;connect_error; return false; } } /* * Select */ public function select($query){ $result = $this-&gt;link-&gt;query($query) or die($this-&gt;link-&gt;error.__LINE__); if($result-&gt;num_rows &gt; 0){ return $result; } else { return false; } } /* * Insert */ public function insert($query){ $insert_row = $this-&gt;link-&gt;query($query) or die($this-&gt;link-&gt;error.__LINE__); //Validate Insert if($insert_row){ header("Location: index.php?msg=".urlencode('Record Added')); exit(); } else { die('Error : ('. $this-&gt;link-&gt;errno .') '. $this-&gt;link-&gt;error); } } /* * Update */ public function update($query){ $update_row = $this-&gt;link-&gt;query($query) or die($this-&gt;link-&gt;error.__LINE__); //Validate Insert if($update_row){ header("Location: index.php?msg=".urlencode('Record Updated')); exit(); } else { die('Error : ('. $this-&gt;link-&gt;errno .') '. $this-&gt;link-&gt;error); } } /* * Delete */ public function delete($query){ $delete_row = $this-&gt;link-&gt;query($query) or die($this-&gt;link-&gt;error.__LINE__); //Validate Insert if($delete_row){ header("Location: index.php?msg=".urlencode('Record Deleted')); exit(); } else { die('Error : ('. $this-&gt;link-&gt;errno .') '. $this-&gt;link-&gt;error); } } </code></pre> <p>And here is the error i get when i try to open <code>index.php</code></p> <pre><code>Warning: mysqli::mysqli(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in /opt/lampp/htdocs/Forum/Database.php on line 23 Warning: mysqli::query(): Couldn't fetch mysqli in /opt/lampp/htdocs/Forum/Database.php on line 35 Warning: Database::select(): Couldn't fetch mysqli in /opt/lampp/htdocs/Forum/Database.php on line 35 </code></pre> <p>Any answers as to why i cant connect to the Database?</p> </div>

简单的MySQL SELECT失败,错误1054未知列

<div class="post-text" itemprop="text"> <p>I did research on this question and nothing I've read in the MySQL manual, in MySQL bug reports, in Stack Overflow, or in other forums has helped so far. </p> <p>I have a simple mysql select query:</p> <pre class="lang-sql prettyprint-override"><code>SELECT * FROM `Toyota` WHERE `Toyota`.`CollisionEstimatingID` = '22028589'; </code></pre> <p>This query fails with mysql error code 1054 </p> <blockquote> <p>Unknown column <code>Toyota.CollisionEstimatingID</code> in the <code>WHERE</code> clause</p> </blockquote> <p>This column DOES exist, I've checked the spelling of the database, table and column at least 30 times now. I even deleted my database and reimported. I have tried it with the backticks and without backticks, with alias' and without alias' I've tried it with explicitly named table.column syntax, and without the explicit syntax, I've tried mixing and matching all the stuff I've mentioned (backticks on the table, but not the column, on the column but not the table name), and nothing seems to work. It fails when I execute it from the mysql CLI on Ubuntu 12.04, it fails from my PHP 5.3 code, and it fails inside of phpMyAdmin. I am ready to flip a table.</p> <p>When I try this though:</p> <pre class="lang-sql prettyprint-override"><code>SELECT * FROM `Toyota`; </code></pre> <p>This works without any problems? Good god, MySQL is such a tease... </p> <p>Here is the table setup as derived from <code>show create database Toyota;</code></p> <pre class="lang-sql prettyprint-override"><code>CREATE TABLE `Toyota` ( `CollisionEstimatingID` varchar(255) DEFAULT NULL, `OE_part_number` varchar(255) DEFAULT NULL, `Price` varchar(255) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 </code></pre> <p>An interesting note -- I wonder if it could be character encoding problems? I did get it to work ONCE in phpMyAdmin by using the <code>show create table Toyota</code> and deleting everything but the "CollisionEstimatingID" and used that to form the SELECT statement. But when I tried cutting and pasting, no dice.</p> <p>I tried recreating the database and tables using the utf8 character set to see if that would help, but it didn't help. I tried copying to text out of the phpMyAdmin window and into my source code -- that produced some funky characters at the beginning of the column name -- kinda like this: <code>&gt;&gt;?CollisionEstimatingID</code> only it was an 'i' with an umlaut + a double right chevron and an upside down question mark. </p> <p>I'm stumped. Anyone want to test their programming mettle and help a brother out?</p> </div>

使用Log4cxx日志输出至MySQL, 无法找到驱动错误

Hi, guys! 用log4cxx日志框架对log内容输出至数据库(MySQL)一直未成功,不知道是什么步骤出现了问题。希望大伙们能帮帮忙,或者有什么更好的日志系统可以推荐,谢谢各位了。 ^_^ --- **运行环境**: Ubuntu 12.04 32bit + Eclipse CDT **log4cxx** : apache-log4cxx-0.10.0 log4cxx支持两种ODBC选项(iODBC/unixODBC),这里选择了unixODBC形式进行管理 通过添加选项 ./configure --with-ODBC=unixODBC,编译通过. 之后对unixODBC的驱动和数据源进行配置,可以通过终端 _isql log4cxx_ 成功建立连接 但是代码中使用Log4cxx进行输出的时候一直报下面的错误 ``` log4cxx: Failed to connect to database. - [unixODBC][Driver Manager]Data source name not found, and no default driver specified ``` ``` 怀疑一: ``` > Ecplise中是否没有加环境变量; 查阅ODBC资料,在Eclipse中加入ODBCSYSINI,ODBCINSTINI,ODBCINI变量后,还是没有效果. ``` 怀疑二: ``` > log4cxx配置写的不对;这个有没有什么官方的写法,晕呐! --- 配置内容: **/etc/odbcinst.ini** ``` bash [MySQL] Description = MySQL Driver = /usr/lib/i386-linux-gnu/odbc/libmyodbc.so Setup = /usr/lib/i386-linux-gnu/odbc/libodbcmyS.so FileUsage = 1 ``` **/etc/odbc.ini** ``` c [log4cxx] Description = The Database for Logging System Trace = on TraceFile = stderr Driver = MySQL SERVER = localhost PORT = 3306 DATABASE = log USER = root PASSWORD = 56789 ``` **log4cxx.xml** ``` xml <appender name="OdbcMysqlAppender" class="org.apache.log4j.odbc.ODBCAppender"> <param name="URL" value="Driver={MySQL};Server=localhost;Database=log;User=root;Password=56789;" /> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="INSERT INTO logs (message) VALUES ('%d - %c - %p - %m')" /> </layout> </appender> <root> <priority value="all" /> <appender-ref ref="OdbcMysqlAppender" /> </root> ``` --- # 进展: ``` _Time: 20150702_ ``` 查看Log4cxx源码,采用数据库方式记录Log,使用的是ODBCAppender ``` src/main/cpp/odbcappender.cpp ``` 作者原先的代码采用的是 **SQLxxxW()** 进行DriverConnect和SQLExecDirect操作,根据ODBC的描述,有 **W** 修饰是采用Unicode编码方式。总之我一直陷在这,一直报找不到数据源。于是乎我将 ``` SQLxxxW() ``` 修改成 ``` SQLxxx() ``` 方式的调用,同时将原先``` SQLWCHAR ``` 修改成对应 ``` SQLCHAR ```,即采用非宽字节的操作方式,成功的找到数据源,并且可以进行调用。 不过这就导致了中文的问题了. **疑惑** 在odbcinst.ini中配置的Driver确实是libmyodbc5w.so,即驱动使用Unicode方式的呀! (*与之相对应的是libmyodbc5a.so*). 至今还不知道自己是哪里出错,作者不可能毫无依据的就采用 SQLxxxW() 形式进行ODBC连接的吧. --- 我在ODBCAppender.cpp中添加了 #define SQL_WCHART_CONVERT,否则make的时候过不去, 即 ``` c++ #if !defined(LOG4CXX) #define LOG4CXX 1 #endif #include <log4cxx/private/log4cxx_private.h> #if LOG4CXX_HAVE_ODBC #if defined(WIN32) || defined(_WIN32) #include <windows.h> #endif #define SQL_WCHART_CONVERT #include <sqlext.h> #endif ```


我想用lamp做一个B/S架构的在线c语言编译系统,在浏览器输入图1的C语言代码,显示如图2,若成功应该显示图3,图4是处理C语言代码的源码,图5是setuid.c的源码,这个 c语言文件是用来输出uid、euid和执行gcc命令。我觉得是gcc命令没法执行,提交代码 后并不能在服务器端看到inputexe文件,而在服务器端却可以执行gcc命令,服务器装在虚拟机上,环境为ubuntu12.04+apache2.2.22+php5.3.10-1+mysql。php安全模式、改文件权限、管道等方法我都试过了,还是不行,求大神帮忙! ![图1](https://img-ask.csdn.net/upload/201509/22/1442921886_260901.png) ![图2](https://img-ask.csdn.net/upload/201509/22/1442921867_493663.png) ![图3](https://img-ask.csdn.net/upload/201509/22/1442921889_19695.png) ![图4](https://img-ask.csdn.net/upload/201509/22/1442921970_232570.png) ![图5](https://img-ask.csdn.net/upload/201509/22/1442922202_89783.png)

如何在cakephp 3.0中运行文件shell作为服务器Docker的cron作业?

<div class="post-text" itemprop="text"> <p>I have a issue and need to someone help me. I'm deploying a application use framwork CakePHP 3.0. I created shell file in folder src/Shell. I used server Docker with mysql and fpm and nginx. My local is Linux Ubuntu 12.04 Now i want to run this file as cron job. But i didn' find any document about that. I hope someone will help me. Thank you so much.</p> </div>


<div class="post-text" itemprop="text"> <p>In Ubuntu 12.04 guest on Windows 8.1 host (using VirtualBox), a cloned application cannot connect to the host's database. Regardless of settings in parameter.yml the following occurs at login:</p> <blockquote> <p>SQLSTATE[28000] [1045] Access denied for user 'projectmana'@'localhost' (using password: YES)</p> </blockquote> <p>NB: login credentials are different from database credentials.</p> <h3>parameters.yml (in part)</h3> <pre><code>database_driver: pdo_mysql database_host: database_port: null database_name: projectmana database_user: root database_password: root's password </code></pre> <p>I have confirmed that guest OS has pdo_mysql installed. MySQL client in guest OS can connect to mysql at host's address with either root or projectmana credentials. I have also attempted the solution of adding PDO parameters as <a href="https://stackoverflow.com/questions/14288776/symfony2-with-doctrine-cannot-connect-to-remote-mysql-database">shown here</a> without success.</p> <h3>Update</h3> <p>I've also confirmed that PDO can connect to the host via</p> <pre><code>&lt;?php $dsn = 'mysql:dbname=projectmana;host='; $user = 'root'; $password = 'some password'; try { $dbh = new PDO($dsn, $user, $password); } catch (PDOException $e) { echo 'Connection failed: ' . $e-&gt;getMessage(); exit; } echo "We're connected!"; </code></pre> </div>

Laravel 4中的DB :: paginate失败

<div class="post-text" itemprop="text"> <p>I am running a typical query on a fairly large MariaDB 10.0.6 database (~2 million records), where I want to have only top few records returned. The 'where' statement I am using will match no more than 5-10 records.</p> <p>This statement fails:</p> <pre><code>$lucky = $this-&gt;post-&gt;select("ID")-&gt;where('luckynumber', '=', '12345')-&gt;paginate(1); </code></pre> <p>whereas this one works (<strong>the only difference is -&gt;paginate vs. first</strong>):</p> <pre><code>$lucky = $this-&gt;post-&gt;select("ID")-&gt;where('luckynumber', '=', '12345')-&gt;first(); </code></pre> <p>The log files suggest that I run out of memory (which I already increased to 512 MB):</p> <p>[2013-12-11 16:15:39] log.ERROR: 500 - Allowed memory size of 536870912 bytes exhausted (tried to allocate 532152320 bytes) @ /lucky/12345 exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Allowed memory size of 536870912 bytes exhausted (tried to allocate 532152320 bytes)' in /var/www/lbs/app/storage/views/f775c03b70963c0:109</p> <p>I am using Ubuntu Linux 12.04, nginx, php 5.5.6, </p> <p>What is the problem?</p> </div>

如何配置Varnish VCL文件以缓存OSCommerce站点?

<div class="post-text" itemprop="text"> <p>I'm building a simple server setup for developping purposes, with Nginx, PHP-FPM, APC, Varnish and MySQL, using Ubuntu Server 12.04.</p> <p>But now I want to deploy at this testing environment, an OSCommerce app. After some googling I couldn't find a way to properly configure OSCommerce with Varnish.</p> <p>Actually I have Varnish configured for Wordpress (varnish file and default.vcl file) like one from there (<a href="https://github.com/nicolargo/varnish-nginx-wordpress" rel="nofollow">GitHub-Nicolargo</a>) but just a little bit modded.</p> <p>So, should I use the same configuration for WP? If not, There's someone who knows how (or where should I find) to configure it properly for OSCommerce?</p> <p>Hugs</p> </div>


<div class="post-text" itemprop="text"> <p>I'm setting up nginx with php5-fpm on Ubuntu 12.04LTS for wordpress and phpMyAdmin.</p> <p>My phpMyAdmin locates in<code>/var/www/phpMyAdmin</code>, wordpress in <code>/home/user/workspace/wordpress</code>, MySQL at <code>/var/run/mysqld/mysqld.sock</code></p> <p>I want to map <code>/</code> to wordpress, <code>/phpmyadmin</code> to phpMyAdmin, so how can I achieve this??</p> <p>Wordpress seemed OK, but when accessing <code>/phpmyadmin</code>, the browser "downloads" the request as files...??</p> <p>This is my current nginx.conf:</p> <pre><code>server { listen 8000; root /home/user/workspace/wordpress; index index.html index.htm index.php;\ location ~* /phpmyadmin { #TODO: shall here be a tailing slash?? #TODO: root or alias??? } location ~ \..*/.*\.php$ { return 403; } location / { #TODO: show the following line be un-commented?? #try_files $uri $uri/ /index.php?q=$uri&amp;$args; # Uncomment to enable naxsi on this location # include /etc/nginx/naxsi.rules } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini fastcgi_intercept_errors on; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php;#TODO: could this being removed?? include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } #FIXME: and how to block all access to /home/user/workspace/wordpress/server.d/* #This doesn't work?? location /sever\.d { autoindex on; deny all; } </code></pre> <p>And, what permission should I set for both the directory <code>wordpress/</code> and <code>phpMyAdmin/</code> if all the servers are running as <code>www-data:www-data</code>?? Currently I set them as <code>755 user:www-data</code>, is that correct??</p> <p>I haven't set up server under linux yet, I was using those servers under WinXP, so I'm trying.</p> </div>

too long

<div class="post-text" itemprop="text"> <p>I'm running the exact same PHP script on two different servers as a web service for an app. One executes all queries (the one running 5.3.15) and the other (running 5.3.10) does not run certain queries. It creates a server error when I tell some of the queries to execute. </p> <p>The machine running 5.3.15 is a mac os x lion machine, and the other is and ubuntu 12.04. </p> <p>Do you guys have any idea what could be going wrong. Here are two examples of queries. The first one works on the php 5.3.10 and the second does not.</p> <p>Working: </p> <pre><code>$stmt = $this-&gt;db-&gt;prepare("SELECT DISTINCT b.id FROM a LEFT JOIN b ON a.item_id = v.id INNER JOIN c ON a.id = c.item_id LEFT JOIN d ON c.status_id = d.id WHERE d.property = 1"); </code></pre> <p>Server Error-ing: </p> <pre><code>$stmt = $this-&gt;db-&gt;prepare("SELECT a.id AS id, d.ordering AS ordering, d.name AS name2, a.service_id AS service_id, b.name AS name, c.name AS name1, a.due_date AS due_date, d.status AS status FROM a INNER JOIN b ON a.title_id = b.id LEFT JOIN c ON b.tv_show_id = c.id LEFT JOIN d ON a.status_id = d.id WHERE b.provider_id = ? AND (b.film_id= ? OR b.name LIKE CONCAT('%', ?, '%') OR c.name LIKE CONCAT('%', ?, '%')) LIMIT 2000"); </code></pre> <p>Note: I am <strong>very</strong> open to all sorts of critiques of these queries, but answers that only say that I'm messy or need to read up on sql will not be very helpful to me. Also, the database names are not actually just letters, I have changed them for security purposes. </p> <p>The problem is most likely to be in the functions used or something, as the code (before I quickly butchered it by changing around all the names) runs flawlessly in php 5.3.15. </p> <p>If the error makes no sense, then what else could be going wrong? I ran the queries straight in the mysql console and it worked perfectly, but when I bound_params and executed them based off of passed in variables, the second query fails. Any help is appreciated!!</p> <p>EDIT: </p> <p>The error message is: caught SIGTERM, shutting down - I'll look into that. Thank you to all commenters who helped!</p> </div>


今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...


何来 我,一个双非本科弟弟,有幸在 19 届的秋招中得到前东家华为(以下简称 hw)的赏识,当时秋招签订就业协议,说是入了某 java bg,之后一系列组织架构调整原因等等让人无法理解的神操作,最终毕业前夕,被通知调往其他 bg 做嵌入式开发(纯 C 语言)。 由于已至于校招末尾,之前拿到的其他 offer 又无法再收回,一时感到无力回天,只得默默接受。 毕业后,直接入职开始了嵌入式苦旅,由于从未...


文章目录Java概述何为编程什么是Javajdk1.5之后的三大版本JVM、JRE和JDK的关系什么是跨平台性?原理是什么Java语言有哪些特点什么是字节码?采用字节码的最大好处是什么什么是Java程序的主类?应用程序和小程序的主类有何不同?Java应用程序与小程序之间有那些差别?Java和C++的区别Oracle JDK 和 OpenJDK 的对比基础语法数据类型Java有哪些数据类型switc...


今天下午在朋友圈看到很多人都在发github的羊毛,一时没明白是怎么回事。 后来上百度搜索了一下,原来真有这回事,毕竟资源主义的羊毛不少啊,1000刀刷爆了朋友圈!不知道你们的朋友圈有没有看到类似的消息。 这到底是啥情况? 微软开发者平台GitHub 的一个区块链项目 Handshake ,搞了一个招募新会员的活动,面向GitHub 上前 25万名开发者派送 4,246.99 HNS币,大约价...


跳槽几乎是每个人职业生涯的一部分,很多HR说“三年两跳”已经是一个跳槽频繁与否的阈值了,可为什么市面上有很多程序员不到一年就跳槽呢?他们不担心影响履历吗? PayScale之前发布的**《员工最短任期公司排行榜》中,两家码农大厂Amazon和Google**,以1年和1.1年的员工任期中位数分列第二、第四名。 PayScale:员工最短任期公司排行榜 意外的是,任期中位数极小的这两家公司,薪资...



技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...


华为面试整体流程大致分为笔试,性格测试,面试,综合面试,回学校等结果。笔试来说,华为的难度较中等,选择题难度和网易腾讯差不多。最后的代码题,相比下来就简单很多,一共3道题目,前2题很容易就AC,题目已经记不太清楚,不过难度确实不大。最后一题最后提交的代码过了75%的样例,一直没有发现剩下的25%可能存在什么坑。 笔试部分太久远,我就不怎么回忆了。直接将面试。 面试 如果说腾讯的面试是挥金如土...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...


loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...


刚才邻居打了个电话说:喂小灰,你家wifi的密码是多少,我怎么连不上了。 我。。。 我也忘了哎,就找到了一个好办法,分享给大家: 第一种情况:已经连接上的wifi,怎么知道密码? 打开:控制面板\网络和 Internet\网络连接 然后右击wifi连接的无线网卡,选择状态 然后像下图一样: 第二种情况:前提是我不知道啊,但是我以前知道密码。 此时可以利用dos命令了 1、利用netsh wlan...





总结了 150 余个神奇网站,你不来瞅瞅吗?



提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...






私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...




如果世界上都是这种不思进取的软件公司,那别说大部分程序员只会写 3 年代码,恐怕就没有程序员这种职业。

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...






本文作者用对比非常鲜明的两个开发团队的故事,讲解了敏捷开发之道 —— 如果你的团队缺乏统一标准的环境,那么即使勤劳努力,不仅会极其耗时而且成果甚微,使用...




当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...


HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...






爬取彼岸桌面网站较为简单,用到了requests、lxml、Beautiful Soup4