Showing posts with label error. Show all posts
Showing posts with label error. Show all posts

Thursday, August 8, 2019

PHP: connect to mysql

首先要確保以下幾點︰
1. apache有沒有允許連接到接口,可以查看host設置->Directory->Allow from all
2. 數據庫的用戶有沒有權限在第二個host登入,如果沒有權限可能會出︰
Caught exception: SQLSTATE[HY000] [2013] Lost connection to MySQL server at 'reading initial communication packet', system error: 0
如果真的有這個錯誤,請到用戶權限新增在這個host。
可參考這裏︰https://manage.accuwebhosting.com/knowledgebase/2200/How-to-Allow-Remote-Connection-to-MySQL-Server-in-Windows.html

Monday, August 5, 2019

./boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or directory

修改/boost_1_67_0/tools/build/src/tools/python.jam 547行
else
{
  includes ?= $(prefix)/include/python$(version)m ;

/lib64/libc.so.6: version `GLIBC_2.18' not found

wget http://mirrors.ustc.edu.cn/gnu/libc/glibc-2.18.tar.gz
tar -zxvf glibc-2.18.tar.gz
mkdir build
cd build
../configure --prefix=/usr
make -j4
sudo make install

reference: https://www.jianshu.com/p/513e01fbd3e0

ImportError: cannot import name create_connection

pip install websocket-client

ImportError: libboost_regex.so.1.65.0: cannot open shared object file: No such file or directory

Error message: ImportError: libboost_regex.so.1.65.0: cannot open shared object file: No such file or directory

解決過程︰
wget https://dl.bintray.com/boostorg/release/1.65.0/source/boost_1_65_0.tar.gz
tar zxvf boost_1_65_0.tar.gz
cd boost_1_65_0
sudo ./bootstrap.sh
sudo ./b2
sudo ./b2 install

sudo cp -rf boost/ /usr/include/
sudo cp -rf stage/lib/* /usr/lib64

Tuesday, July 30, 2019

運行C編寫的程序出錯︰/usr/lib/libstdc++.so.6: version `CXXABI_1.3.9' not found

find / -name "libstdc++.so.*"

cp /usr/local/src/gcc-6.3.0/gcc-build-6.3.0/i686-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.22 /usr/lib/

rm -rf libstdc++.so.6

ln -s libstdc++.so.6.0.22 libstdc++.so.6

Reference: https://blog.csdn.net/ZX714311728/article/details/69628836

Thursday, July 25, 2019

Tuesday, July 9, 2019

docker: nvidia-docker 運行起來報錯

nvidia-docker
# /usr/bin/nvidia-docker: line 34: /usr/bin/docker: Permission denied
# /usr/bin/nvidia-docker: line 34: /usr/bin/docker: Success

解決方案︰
sudo semanage fcontext -a -t container_runtime_exec_t /usr/bin/nvidia-docker
sudo restorecon -v /usr/bin/nvidia-docker

Reference:
https://github.com/NVIDIA/nvidia-docker/issues/814#issuecomment-466916779

Tuesday, June 25, 2019

Error: PHP install with Pear

錯誤提示︰
Fatal error: Cannot use result of built-in function in write context in D:\xampp\php\pear\Archive\Tar.php on line 639

修正方案︰修改路徑中Tar.php 639行改為,
$v_att_list = func_get_args();

錯誤提示︰
Fatal error: Uncaught Error: Class 'Net_SMTP' not found in D:\xampp\php\pear\Mail\smtp.php:366
修正方案︰
安裝pear install Net_SMTP

Wednesday, June 5, 2019

MySQL: phpmyadmin錯誤

修改 /usr/share/phpmyadmin/libraries/plugin_interface.lib.php 第551 行

修改前︰
if ($options != null && count((array)$options) > 0) {
修改後︰
if ($options != null && count($options) > 0) {

Reference:
https://medium.com/@chaloemphonthipkasorn/%E0%B9%81%E0%B8%81%E0%B9%89-bug-phpmyadmin-php7-2-ubuntu-16-04-92b287090b01

Error information:
Warning in ./libraries/plugin_interface.lib.php#551 count():
Parameter must be an array or an object that implements Countable


MySQL: 在phpmyadmin錯誤

在查找DB時一直報錯,原來是代碼問題。
打開 /usr/share/phpmyadmin/libraries/sql.lib.php 至613行
更改前︰
((empty($analyzed_sql_results['select_expr']))
 || (count($analyzed_sql_results['select_expr'] == 1)
&& ($analyzed_sql_results['select_expr'][0] == '*')))
更改後︰
((empty($analyzed_sql_results['select_expr']))
 || (count($analyzed_sql_results['select_expr']) == 1)
&& ($analyzed_sql_results['select_expr'][0] == '*'))

再用sudo service apache2 restart就完成修正。


Reference: https://stackoverflow.com/questions/48001569/phpmyadmin-count-parameter-must-be-an-array-or-an-object-that-implements-co

Error infomation:

Warning in ./libraries/sql.lib.php#613 count():
Parameter must be an array or an object that implements Countable
Backtrace
./libraries/sql.lib.php#2128: PMA_isRememberSortingOrder(array) ./libraries/sql.lib.php#2079: PMA_executeQueryAndGetQueryResponse( array, boolean true, string 'text', string 'courses', NULL, NULL, NULL, NULL, NULL, NULL, string '', string './themes/pmahomme/img/', NULL, NULL, NULL, string 'SELECT * FROM `courses`', NULL, NULL, ) ./sql.php#221: PMA_executeQueryAndSendQueryResponse( array, boolean true, string 'text', string 'courses', NULL, NULL, NULL, NULL, NULL, NULL, string '', string './themes/pmahomme/img/', NULL, NULL, NULL, string 'SELECT * FROM `courses`', NULL, NULL, )

Friday, November 9, 2018

Error: Invalid command 'Allow', perhaps misspelled ...

在httpd-vhosts.conf中配置了目錄環境,但報錯說Allow不能識別︰
<VirtualHost *:18040>
    ServerName xx.xx.xx.xx
DocumentRoot "C:/server/phpMyAdmin"
<Directory "C:/server/phpMyAdmin">
Options FollowSymLinks IncludesNOEXEC Indexes
DirectoryIndex index.html index.php index.htm
Allow from all
Require all granted
</Directory>
</VirtualHost>

網上查找一下發現在httpd.conf有一個模組被註解了︰
LoadModule access_compat_module modules/mod_access_compat.so
解除註解就可以了。

Reference: Apache启动 报Invalid command 'order', perhaps misspelled or defined by a module not included

Error: ERROR 1406 (22001) at line 4950: Data too long for column 'xx' at row 1

因為舊DB導入新版本的mysql中所導致,執行下面設定就可以解決︰
SET @@global.sql_mode= 'NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';

Reference: “Data too long for column” - why?

Thursday, November 8, 2018

Friday, June 15, 2018

Git: The remote end hung up unexpectedly

今天用git push時出現
$ git push
Counting objects: 40, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (35/35), done.
error: RPC failed; curl 56 Recv failure: Connection was reset
fatal: The remote end hung up unexpectedly
Writing objects: 100% (40/40), 1.65 MiB | 1.45 MiB/s, done.
Total 40 (delta 11), reused 0 (delta 0)
fatal: The remote end hung up unexpectedly
Everything up-to-date

查找了一下發現原因是上傳時的文件太大導致不允許上傳。
找了一下知道了解決方案︰
  1. 在.git目錄下有一個config文件,打開它。
  2. 在後面加上
    • [http]
    • postBuffer = 524288000
  3. 完成
Reference: git 推送出现 "fatal: The remote end hung up unexpectedly" 解决方案

或者可以用Bash輸入
git config --global http.postBuffer 157286400

Monday, December 11, 2017

ERROR: java.lang.IllegalStateException: getOutputStream() has already been called for this response

最近遇到一個問題超難搞的,就是這個︰
SEVERE: Servlet.service() for servlet [jsp] in context with path ... threw exception [java.lang.IllegalStateException: getOutputStream() has already been called for this response] with root cause
at org.apache.catalina.connector.Response.getWriter(Response.java:678)
at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:213)
at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:125)
at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:118)
at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:194)
at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:126)
at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:80)

就是用JSP直接打開一個系統存在的PDF文件這麼簡單,但卻弄了很久也沒解決。
打開PDF的方法可參考這個︰Displaying pdf in jsp

其實JSP是打開了PDF文件,但同時JSF請求了getWriter,而getOutputStream被JSP用了,所以JSF無法使用getWriter而報錯。

暫時方法找不到,先不管了。

Wednesday, November 16, 2016

Python: ImportError: No module named AAA.BBB


Traceback (most recent call last):
  File "train.py", line 14, in <module>
    from AAA.BBB import
ImportError: No module named AAA.BBB

在執行Python時遇到這個問題,找不到某一個路徑下的包,原因是沒有告訴它這個文件在哪裏。
解決方案︰輸入指令export PYTHONPATH=/path/,其中path就是包含AAA.BBB文件的地方了。