php,wordpress,plugins,command-line,crontabRelated issues-Collection of common programming errors


  • Kermit
    php windows-server-2008-r2 iis7 sql-server-2008-r2
    I am having difficulties getting the SQL Server extension to work with PHP on Windows Server. The installation went fine and I’m able to load phpinfo through the browser. However, when I enable php_sqlsrv_54_ts.dll, it throws a 500 – Internal server error. There are no errors logged to the PHP log.Here are the steps I’ve performed:Followed the PHP manual install guide and configuring IIS to process PHP requests Downloaded & installed Microsoft Drivers 3.0 for PHP for SQL Server Downloaded &a

  • ElvisLikeBear
    php sql sql-server sql-server-2008
    I’m using PDO’s to connect to a Microsoft Server running in azure and I keep receiving the error:This is the function that I’ve written (insertUser):private function generateSalt() {return dechex(mt_rand(0, 4453456454)) . dechex(mt_rand(0, 543545435)); }private function hashPassword($originalPassword, $salt) {for($round = 0; $round < 65536; $round++){$password = hash(‘sha256’, $password . $salt);}return $password; }private function insertUser() {$salt = $this->generateSalt();$password = $

  • Jacket
    php internationalization gettext
    I know there are lots of posts for internationalization, but this is something I didn’t found while searching.I have a PHP Web application, which is pretty big right now. It’s developed actively for 4 years and wasn’t built with internationalization in mind. Text is everywhere – in plain HTML, in PHP variables, in echo’s, in the DB…Now I’m familiar with the concept of gettext and this is what i plan to use for the internationalization project of the application. However the app is not written

  • darkheir
    php jpeg jfif
    When I’m trying to save an image using the native php function imagecreatefromjpeg sometimes I have the following error:gd-jpeg, libjpeg: recoverable error: Warning: unknown JFIF revision number 2.01What I understand (I could be wrong) is that the JFIF version is higher than the one supported by the native php function.How could I process the image or at least fail gracefully? (Today the page is showing a HTTP 500 error)

  • mitai
    php codeigniter form-validation native
    I want to use a central CI setup for multiple sites. The way I handle this is I created a package called MPACK and added it to autoload in the config file of each site.Folder Structure:/main/system (CI 2 System folder)/MPACK/site1/applicationsite2/applicationInside this MPACK I have share libraries, models, helpers, etc.However, I would like to have an extended MY_Form_Validation that would be common to ALL sites. Adding the class file to /MPACK/libraries fails. Adding it to /site1/application w

  • xles
    php yii
    I’m playing around with the Yii framework, and decided to do some file foo with the finfo class in php, like so:$finfo = new finfo(FILEINFO_MIME);This should work without issue (and it works just fine outside of Yii), I don’t see why it shouldn’t. However, this isn’t the case, Yii attempts to autoload the finfo class causing the obvious error:include(finfo.php): failed to open stream: No such file or directoryIs there a way to beat Yii into submission?Edit: I still haven’t figured out why it cr

  • David Rodrigues
    php mysql
    Is there any function in MySQL that is similar to function substr_count() of PHP? Actually I need to know how many items are in a set (eg. 1,2,3 is 3 items).In a search, I found nothing that was native to this. So I made a workaround with the methods LENGTH() and REPLACE().SELECT LENGTH(“1,2,3,4”) – LENGTH(REPLACE(“1,2,3,4”, “,”, “”)) + 1;But it fail set is empty. But I can solve that with a simple IF().So, I’m searching for some more native, like, for instance:SELECT SUBSTR_COUNT(“,”, “1,2,3,4”

  • palacsint
    php beginner security file static
    I am new to Code Review and PHP.Last night I made the below image uploading class. It was the first time I made a file uploader to be used on a real site, so I thought I would share it here and on Github to get some reviews, hoping if I can perfect it with your help, I will use the class on all my future projects. <?php /*** A small, secure & fast image uploader class written in all-static* class to give an extra boost in performance.* @author Simon _eQ <https://github.com/simon-eQ

  • Orangepill
    php template
    This is the second submission for Code Review for this project but since the API changed considerably I felt it should not be taped onto the original post. To see the original post and comment see Potential Problems with this templating technique .First off the goals motivation for this technique is to reduce the number of iterative includes of a template there by bypassing a lot of the i/o bottle neck that can occur, especially in I/O bound environments. Overwhelmingly the biggest eyesore in th

  • Kriem
    php javascript jquery jwplayer
    I sometimes get this error in my jwplayer: TypeError: non-native scope objectThis means that one video out of multiple videos I have has failed to load. This makes it unreliable. My question is that is there a way to make it more reliable and permanently fix this error?Below is code:<?php$key = $_GET[‘key’]; $i = $_GET[‘i’]; $v = $_GET[‘v’];?> <div id=”myElement-<?php echo $key.’-‘.$i; ?>”>Loading the player…<script type=”text/javascript”> jwplayer(“myElement-<?php e

  • Michelle Cantin
    javascript jquery wordpress wordpress-theming
    My custom JQuery file as well as Masonry Jquery are linked but not working.You can see that it links correctly in the source file: view-source:http://michellecantin.ca/test/features/notification-boxes/JQuery is also linked and I’m pretty sure it is working.Why aren’t my scripts working?ps: I use it in a wordpress theme.

  • Kelly
    php wordpress footer
    I created a child theme for twenty twelve and added some stuff in there. Now locally it looks fine, the footer is showing up normally.Though when I added my theme to my server and selected it as a theme the footer is not showing. When I look at the source code the footer is not being loaded.Now I have my page.php like this;<?php /*** The template for displaying all pages** This is the template that displays all pages by default.* Please note that this is the WordPress construct of pages* and

  • user2657760
    wordpress menu widget sidebar two-columns
    I am trying to create a Custom Menu Widget that has two columns (i.e., wherein I can select two different menus and have them display side-by-side within a single sidebar widget). I found a tutorial on how to create a two column text widget, however I cannot figure out how to edit the Custom Menu widget functions to add and implement an additional menu — my attempts to create an additional menu variable (i.e., “$menus1” and “$menus2” below) break WordPress (“unexpected T string” error). Does

  • HTML Ninja
    php arrays wordpress foreach admin
    am working on a wordpress admin panel using startbox admin panel, where I want to list all categories with slug and name inside an array but it seems impossible for me to make it work, here is my code$args = array( ‘type’ => ‘post’, ‘child_of’ => 0, ‘parent’ => ”, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘hide_empty’ => 1, ‘hierarchical’ => 1, ‘exclude’

  • jschne88
    javascript php jquery ajax wordpress
    I am using this script to load pages on my site (WordPress CMS). In order to execute javascript scripts on the page, I have to include them in the above script, otherwise they will not load. Here is what I have:$.ajax({url: url,success: function(data, textStatus, jqXHR){/* Other Stuff to load page, etc. */var feed = new Instafeed({get: ‘user’,userId: <?php echo get_post_meta( get_the_ID(), ‘instagramuserID’, true ); ?>,accessToken: ‘<?php echo get_post_meta( get_the_ID(), ‘instagramTo

  • Ivelyne Jacout
    php mysql wordpress
    Odd problem, let me try and explain it clearly. I wrote a WordPress plugin, and it’s been installed on dozens of servers without issue. A client tried to install it today, and they received the following error Parse error: syntax error, unexpected ‘}’ in /sitepathhere/wp-content/plugins/myplugin/insert.php on line 302 The function was outputting text via an echo rather than returning text. Fine, I changed it to return the text and all worked ok for that part. Then the admin panel and front end

  • mugur
    javascript php wordpress updates
    I have this situation where I load some javascript that also contains some php code. The website is not designed by me so I do not know why the developer did chose this way.I have to load a file named functions.js.php and the loading script looks like this:<script type=’text/javascript’ src=’http://www.somewebsite.com/wp-content/themes/theme/js/functions.js.php?ver=1.0′></script>The script was working ok up to a WordPress update to the last version and also a series of plugins.I figu

  • Chris
    php wordpress
    In a WordPress page template I have the following code in an effort to replicate a successful archive page:<?php $args = array( ‘post_type’ => ‘casestudies’, ‘posts_per_page’ => 12 ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post();echo ‘<div class=”casestudy”><a href=”<?php the_permalink() ?>” class=”anchor- hover”>’.get_the_post_thumbnail( $post->ID, ‘180,180’ ).'</div></a>’; echo ‘<span class=”details”><

  • user3041174
    php wordpress
    Im trying to have different text appear under the footer bar, per page on my WP site.I create a new footer(s) uploaded it and edited the page.php and replaced the get_footer with this code here:<?php if ( is_page(’11’) ) { ?> <?php include(TEMPLATEPATH.’/footer2.php’);?> <?php } else { ?> <?php include(TEMPLATEPATH.’/footer.php’);?> <?php } ?>It works as I need it for doing the one page. I need to add a few more pages though. Everything I try adding to the above cod

  • Jonathan
    database wordpress plugins wordpress-plugin wordpress-plugin-dev
    I’m currently writing a plugin for a customer, and while it’s usually working good, I found that dbDelta does not allow me to create the table I need on plugin activation.I’m running the below code to bind the activation function:register_activation_hook(__FILE__, ‘adminInstallation’);And this is the function itself:function adminInstallation(){global $wpdb;$objectEquipment = ‘wp_object_equipment’;$equipmentSQL = “CREATE TABLE “.$objectEquipment.” (id mediumint(9) NOT NULL AUTO_INCREMENT,name ti

  • Shivam S.Kara
    javascript android phonegap plugins native-methods
    I am new on phonegap and android. I created a plugin in phonegap and android to call native function using javascrip.My coode is as below.plugin/BannerLink.jsvar BannerLink = {callNativeFunction: function (success, fail, resultType) {//alert(resultType);return Cordova.exec( success, fail,”org.apache.cordova.example.BannerLink”, “nativeFunction”, [resultType]);alert(resultType);} };My html view filefunction bannerPressed(link){alert(link.rel);//window.location.href=link.rel;//window.open(link.

  • Stéphane Péchard
    ios plugins cordova
    I have some values generated from my native code that I would like to pass to phonegap. These data are generated in real time and are not directly influenced by the user’s actions through the phonegap gui.My native code is part of a plugin that I made.What is the best way to approach this? I want to have a function to send data over anytime and have a listener on the cordova side. I’m using Cordova 1.5 with Xcode 4.3.Here is what I have so far:swipe.js:var swipe={callNativeFunction: function (s

  • Gooshan
    plugins cordova build sencha-touch
    I successfully add and then build a Sencha Touch app with Cordova plugins. However, when I decide to add a plugin later and then build again, the build fails. Is it so that you add plugins only before running sencha app build native or there is another issue. I get the following in console[INF] [shellscript] ** BUILD FAILED ** [INF] [shellscript] [INF] [shellscript] [INF] [shellscript] The following build commands failed: [INF] [shellscript] CompileC build/swigmunk.build/Debug-iphonesimul

  • Anas Azeem
    plugins cordova worklight
    I try to make a cordova plugin in IBM worklight.Javascript:HelloWorld = { sayHello: function (success, fail, resultType) { Cordova.exec( success, fail, “HelloWorld”, “HelloWorld”, [resultType]);} };function callFunction() {HelloWorld.sayHello(basarili, basarisiz, “sinan”); }Java:package com.Cordova1; import org.apache.cordova.api.CordovaPlugin; import org.json.JSONArray;import android.util.Log; public class HelloWorld extends CordovaPlugin {public boolean execute(String arg0, JSONArray arg1,

  • Matthew Xerri
    plugins svn
    I have a blog with all the plugins I need committed to an internal svn repository. WordPress is showing that some plugins need to be updated but when I do, WordPress will delete the folder for that plugin so the .svn files are deleted as well. This will break the repository for that plugin. Any way around this?

  • Mild Fuzz

  • glosrob
    c# plugins dynamics-crm-2011 dynamics-crm crm
    I am looking to build a fairly simple plug in that calculates the amount of “units” used & remaining. I have two custom entites (Parent) bc_learninglicences & ( Child) bc_llbalance, the plug – in fires on create of bc_llbalance and another for update. bc_llbalance: Containsbc_learninglicense (Look up field on parent entite bc_learninglicences / bc_name)bc_units (units that are used by this record)bc_learninglicences: Contains bc_namebc_unitsquantity (This is set to the total qty of units

  • Jonathan
    database wordpress plugins wordpress-plugin wordpress-plugin-dev
    I’m currently writing a plugin for a customer, and while it’s usually working good, I found that dbDelta does not allow me to create the table I need on plugin activation.I’m running the below code to bind the activation function:register_activation_hook(__FILE__, ‘adminInstallation’);And this is the function itself:function adminInstallation(){global $wpdb;$objectEquipment = ‘wp_object_equipment’;$equipmentSQL = “CREATE TABLE “.$objectEquipment.” (id mediumint(9) NOT NULL AUTO_INCREMENT,name ti

  • Will
    gwt grails plugins module share
    I have seen in different posts how GWT modules can be shared across different projects.E.g. How to use source code of one gwt application in to another applicationMy Case is a little more specific, as I’m having two Grails+GWT Plugins: projectA and projectB.projectA contains java beans in src/java that are both used in the Grails services as well as in the src/gwt code. I have defined a module.gwt.xml that contains the paths to my java beans, which my main module (EntryPoint.gwt.xml) inherits. T

  • poonam
    python qgis plugins
    I am working with python plugins for QGIS same as rt sql layer.I developed the plugin and copied into local repository *C:\Documents and Settings\comp90.qgis\python\plugins*. When i open QGIS exe,connection is established ans all the tables are listed.But when i try to open my query builder form,it gives me error sayingQDialog.__init__(self, parent) TypeError: QDialog(QWidget parent=None, Qt.WindowFlags flags=0): argument 1 has unexpected type ‘QgisInterface’My code of query builder form is a

  • Vi0
    calls command-line
    How to make or receive a call from console?Expecting something like this, UNIX-style:make_call +3750291234567 < played_data.wav > recorded_data.wavwait_for_call < played_data.wav > recorded_data.wav 2> call_info.txtPreferably this should have no side effects like sounds from the device. The phone is Xperia X10 (for which the call recording is reported to be working).I want calls to be scriptable like other Linux things I’ve got used to.

  • KodeSeeker
    command-line java
    Possible Duplicate:Cannot execute Java program: UnsupportedClassVersionError I’m a newbie to Ubuntu and Im looking to run Java code from the command line. Ive checked that path as well. The interesting thing is the code compiles but fails to runie.user@ubuntu:~/py-scripts$ javac Main.java’ works well.but when I do .`user@ubuntu:~/py-scripts$ java MainI get the following errorException in thread “main” java.lang.UnsupportedClassVersionError: Main : Unsupported major.minor version 51.0 at java.l

  • Gilles
    command-line networking process ip netstat
    I am trying to run weblogic server on my linux machine and I am getting the following error :ERROR: transport error 202: bind failed: Address already in use ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510) JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:690] FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)I think that the error means that the debugger p

  • matandked
    windows command-line
    I know that over whole Internet there was many topics about windows command line, but it’s still not enough for me. Although I haven’t got any problems when I’m writing loops in real programming language like Python to check all subfolders, I am unable to do it under windows CMD. I’m really annoyed (and really sorry if I am annoying you).I tried both /r and /d switches, but I can’t accomplish simply operation – get a list of files in subfolders:for /d %%p in (“pathHERE*.jpg”) DO echo %%pI get an

  • rsk82
    javascript windows node.js command-line jslint
    I mean to run it like this:node.exe lint.js my_js_file.jsAnd then get output to a console.What do I need to download ? Do I need just to save http://www.jslint.com/ to disk and then grab some attached js file or I need to look for special version for node.js ?

  • JohnLBevan
    windows command-line batch-file pipes
    Is it possible to output the result of a command to a variable when using pipes?Example batch file script:@echo off cls echo Script Started setlocal enableextensions ::prove that functionality works without pipes call:OutputCommandToVariable “set computername” demo echo.%demo%::prove that the command itself works call:IsServiceStartAutoDebug “MyComputerName” “wuauserv”::now try it for real call:IsServiceStartAuto “MyComputerName” “wuauserv”::done goto:end:IsServiceStartAuto call:OutputCommandToV

  • Chowlett
    ruby-on-rails command-line
    Whenever I try to type the command: bundle exec rspec spec/requests/static_pages_spec.rbIt comes up with this error message:/var/lib/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load’: /home/nathan/Rails_Projects/sample_app/spec/requests/static_pages_spec.rb:40: syntax error, unexpected kEND, expecting $end (SyntaxError)from /var/lib/gems/1.8/gems/rspec-core-2.11.1/lib/rspec/core/configuration.rb:780:in `load_spec_files’from /var/lib/gems/1.8/gems/rspec-core-2.11.1/lib

  • nneonneo
    php command-line cron
    So I have a cronjob which executes a PHP script like so:0 0 * * * /usr/local/bin/php -f /home/mysite/mysite.com/cronjobs/renewal_email.phpIf I issue the same command from the command line it runs without error and running with the l flag shows no syntax errors. However cron emails the following: Parse error: syntax error, unexpected T_OBJECT_OPERATORThe line in question is $courses[$t->CourseNumber] = $t->course()->CourseName;Does this limited amount of info raise any red flags? Anyon

  • Ferdy
    java sql-server command-line bcp
    When running BCP from my Java application it exits with status code 0 when 1 is expected. I run bcp with an invalid combination of data and formatting file and bcp gives the following error:Starting copy… SQLState = 22005, NativeError = 0 Error = [Microsoft][SQL Server Native Client 10.0]Invalid character value for cast specificationBCP copy in failedBCP however exits with exit code 0 and not 1, as i suspect. Now it is extremely difficult to see if something failed while running BCP. Exitting

  • BCS
    command-line cron
    I have a script that I’m trying to run from cron. When I run it from bash, it work just fine. However when I let cron do it’s thing, I get a:myscript.sh: line 122: syntax error: unexpected end of fileWhat I want is a way to run a command as if it was a cron job, but do it in my shell.As a side note: does anyone know what would be differnt under cron? (the script already has a #!/bin/sh line)To answer my own question: I added this to my crontab:* * * * * bcs for ((i=$(date +\%M); i==$(d

  • Jason
    java mysql crontab jdk
    So as the title states, Ive got an issue with Crontab and my Java program connecting to a remote MySQL database.The program itself is quite simple: it connects to the database, grabs two tables (users & passwords), then assigns that to a temporary variable and pushes the variable output to a shell script that creates a new user w/ home directory and a password.The program itself works when run manually, however when I try to run the program through Crontab, it fails to connect to the databas

  • Hunt
    php cron crontab
    i want a write a php script which can start , stop , enable and disable cron job. I want to create one interactive jquery page which will asynchronously send a request to php file which will stop , start , enable and disable the jobi have searched so many threads but still didn’t get a proper way and i have looked following solutions and thread.start stop cron jobi tried to implement the solution provided by J. Bruni but when i try to execute ./cron.php activate i am getting following errors ./

  • Danack
    bash amazon-ec2 crontab subshell
    I’m creating a server in Amazon ec2 and passing it a bash script as userdata, which is run when the server first boots. It includes a command to add a line to crontab for a user using the answer given here.directory=”/home/intahwebz/current/tools/amazon/” command=”cd $directory && sh backupSQLToS3.sh” job=”15 1 */2 * * $command” cat <(fgrep -i -v “$command” <(crontab -u intahwebz -l)) <(echo “$job”) | crontab -u intahwebz -This script appears to work fine during bootup as it dis

  • Pubby
    php profiling monitoring crontab
    I have a rather large number of cronjobs on a webserver that are ran with varying levels of niceness.It appears that some of them are requiring an unexpected number of CPU cycles on the test database. Of course, I can see what jobs rant at 16:30, but due to the number of crons, my task would be much easier if I had a log like this:Dec 19 02:13:09 /var/crons/cron1 [user cpu time used] [system cpu time used] [peak mem] ..Is there a utility that I could just add before the crontab, like so:*/6

  • fedorqui
    crontab
    I have been trying to make a cron entry for a shell script:50 */4 * * * /path/script-file.sh > /dev/null 2>&1aimed to run the script at HH:50 at a frequency of 4 hours. But this errors out with the message:crontab: error on previous line; unexpected character found in line.crontab: errors detected in input, no crontab file generated.I removed the “/4” and the error vanished, but I know that cron does allow this format. Does anybody know what the issue could be?Thank you very much for a

  • Simons0n
    bash cron crontab sudo du
    i have got a bash file which i want to toggle via the sudo crontab list. Problem is, that it does not work, because when i run the script with sudo, there is a syntax error message on this line:size=(`du -h $backupDir –summarize`)If i run the same script without, i have to type the sudo pw, but it works without any problems. I allready tried a few variations with brackets, with or without backticks, with or without spaces, etc but nothing helped. The error message is:Syntax error: “(” unexpecte

  • vikash
    linux shell cron crontab
    I have created a shell script named “script.sh” which reads an arrays elements and prints it on terminal. The script is as follows:arr=(“hello” “world”) for i in ${arr[@]} do echo $i; doneIt gives expected output i.e ‘Hello World’ on executing it in terminal, but if I schedule the same script in crontab jobs to get executed automatically every minute and store the output in another file,the job fails and gives /home/vikash/script.sh: 1: Syntax error: “(” unexpected error.The crontab job to exec

  • Adéline
    php mysql cron lamp crontab
    i am trying to build a php script to process data manually to later convert it to a cronjob. this script also get data from mysql and 3rd party soap. when i try to run it from command line i have an error and the script does not run.it shows:./test.php: line 1: ?php: No such file or directory Enter a number: ./test.php: line 5: syntax error near unexpected token `(‘ ./test.php: line 5: `$line = trim(fgets(STDIN));’here’s what i have in my script:echo ‘Enter a number:’;$line = trim(fgets(STDIN));

  • Felix Yan
    php cron crontab
    I have set up a cron job in cpanel in a standard way. I am trying to run a php file, when the email is delivered it gives me errors:/home/shoes/public_html/webPages/products/time.php: line 1: syntax error near unexpected token `(‘ /home/shoes/public_html/webPages/products/time.php: line 1: `<?php include (‘../../database/config.php’); ?>How can I get this php script running perfectly? As when I load this using browser it gives out the actual result but not in cron.

  • Palace Chan
    unix cron crontab
    In the commandline I am able to do cp htlog.out test.$(date ‘+%m%d%Y’)but when I try to crontab it like this:37 17 * * 1-5 cd the/dir && cp htlog.out test.$(date “+%m%d%Y”)It fails with the following message from the CRON DAEMON:/bin/sh: -c: line 0: unexpected EOF while looking for matching `”‘ /bin/sh: -c: line 1: syntax error: unexpected end of fileAnd I do have endlines after the command. What is wrong with that crontab entry?

Web site is in building