php,windows,apache,xampp,gzipRelated issues-Collection of common programming errors
waiwai933
php exception exception-handling throw
I’m trying to use exceptions in PHP as a way of avoiding multiple if-then-else blocks. However, when I try to catch the exception, I get the error Parse error: syntax error, unexpected T_CATCH in /directory/functions.php on line 66. Am I doing something wrong with my throwing and catching?function doThis($sSchool, $sDivision, $sClass, $sUsername, $sCode,$query1,$query2) {connectDb();global $dbConnection;$sDivisionIdArray = mysqli_query($dbConnection,$query1);if ($sDivisionIdArray==false){throw n
Galen
php mvc
i know that everything is going through the controller.but i often read articles that says something like this:user interacts with the view controller asks the model to change its state model notifies the view when its sate has changedi dont get the 3rd one. why saying that the model notifies the view, when it actually is notifying the controller and the controller is notifying the view?
Phil Jackson
php upload
Im using BluImp file uploader. Greate little script that I’ve used forever.Now I have scoured there forum and cant find anything but after debugging, I believe it is more of a permissions/restrictions/settings problem.Once the upload has appeared to have finished, an error is returned:Error: SyntaxError: Unexpected end of inputAfter debugging it is cause by any functions writing to the server, i.e. file_put_contents, move_upload_file….The file is 1.47 mbmy additional ini alterations are max_ex
maxgee
php html mysql table variables
I am trying to get this data to go into a table so I can view it better on my website and I dont really understand how to combing PHP and HTML and I was getting this error Parse error: syntax error, unexpected ‘;’ I dont know if I combine them wrong so here is my code and tell me if I need to supply more than this line of code. <h2>Featured Event’s</h2> <body> <table cellpadding=”10″> <tbody> <?php echo ?><td><?php $eventname ?></td><?php
Bojangles
php mysql jquery-ui
This seemed simply but i’m running into a problem. I’m building an autocomplete drop down box using jquery ui. It works fine with static information but when i try put dynamic data from mysql in the array it freaks out.Parse error: syntax error, unexpected T_DO, expecting ‘)’ on line 46Line 46 is the do in the array$items = array(do { $row_Recordset1[‘ARTIST’]; } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); );I’ve searched the net but I can’t find anything relating to problems w
ZyteX
php html compiler-errors echo
I have a long HTML code which I’m echoing out through the echo code. However I get an error and if I remove the code on all the lines where it says there’s an error I get an error on the body instead. When I try to connect to my page I get this error: ( ! ) Parse error: syntax error, unexpected $end inC:\wamp\www\Legendary\new\usersettings.php on line 670http://fiddle.jshell.net/n4a6W/** EDIT ** I just noticed one of the errors, but the errors with almost all of the is still there…
teresko
php yii optional-parameters yii-cmodel
I am trying to modify 1 controller to work with 2 models. This is what I have done with loadModel function in my controllerpublic function loadModel($id, $_model) {if (isset($_model)){$model=$_model::model()->findByPk($id); // syntax error, unexpected “::”if($model===null)throw new CHttpException(404,’The requested page does not exist.’);return $model;} else {$model=Foods::model()->findByPk($id);if($model===null)throw new CHttpException(404,’The requested page does not exist.’);return $mod
JDelage
php ajax json
All,I’m trying to pass a stringified json object as a GET parameter but the receiving URL seems unable to decode it, I am not sure why.Here is the relevant code:Client side Json object production (works fine): function createJson(){ // This works fine. It creates a json objects with three elements, the third being an array. //(omitted code for brevity)return jsonData; }Client side ajax call (works fine):function recordSetGet(jsonData){request = createRequest();var rawSet=JSON.stringify(jsonDat
Colin
php parsing
I’ve finally started to learn PHP and I quite have trouble with it. I am trying to make a website change its stylesheet according to the moment of the day (day, twilight, night) and I’ve taken this approach:<?php$lt = localtime();if ($lt[2]>=6 && $lt[2]<=16)echo(‘<link href=”style.css” rel=”stylesheet” type=”text/css” />’);elsif ($lt[2]>=17 && $lt[2]<=21)echo(‘<link href=”style_twilight.css” rel=”stylesheet” type=”text/css” />’);elseecho(‘<link href=
psniffer
php versions
i wrote a small program to help me study, it works fine on the localhost, but when i upload it i get an error message that has me stumped the line i get the error with is below<?php echo “Num # : ” . ($_SESSION[‘monster’]->getQuestionNumber()[$q]) .” of ”. $_SESSION[‘monster’] -> getTotalQuestions() . “<BR>”;?>on the local host i have PHP Version 5.4.4-14+deb7u5on the remote server i have PHP Version 5.2.6the error i get is Parse error: syntax error, unexpected
Milen A. Radev
windows batch-file for-loop
I’ve put together the batch file below; I don’t have much experience with batch files and I can’t figure out why the file fails with an error message stating that the: DO command was unexpected.Looking at the following code, does anyone know what I did wrong? Thanks.@ECHO OFF REM Set arguments supplied by Subversion SET REPOS = %1 SET REV = %2REM Set working directory path SET WORKSPACE = D:\apache\htdocsREM Assign changes to variable SET CHANGES = svnlook changed %REPOS% -r %REV% REM Update
tieTYT
windows git svn cygwin
I ran git svn clone about 24 hours ago and it’s still running without an end in sight. When I ls the destination directory, there’s nothing in there but a .git folder. Is there a way to prove that this command is actually making progress and not stuck in an infinite loop?I’m running this command on windows 7 with cygwin. The part that concerns me the most is I keep seeing messages like this over and over again:W: Refspec glob conflict (ref: refs/remotes/trunk@8286): expected path: branches/tr
raven
windows
Group policy prevents several configuration settings on my Windows 7 / Vista machines. Since my domain account is a member of the local Administrators group on these boxes, is there still a way to override them locally?For instance, GP prevents changing the power management option “Turn off the display” (even changing it from cmd fails: POWERCFG -X -monitor-timeout-ac 60 => “An unexpected error condition has occurred. Unable to perform operation. You may not have permission to perform this op
Contango
c++ windows visual-studio
I’m trying to wrap my head around the internals of Windows memory management at the OS level.Is it true that when memory is allocated, it always triggers a page fault behind the scenes? Does this imply that the only way to stop soft page faults is to stop allocating new memory within the process?DefinitionsI define “memory allocation” as any form of malloc, i.e. new, LocalAlloc, VirtualAlloc, HeapAlloc, etc.I define a “page fault” as the process of mapping memory from the OS pool into the proces
Óscar López
windows powershell scheme racket cmd.exe
I am trying to make a stand-alone Racket executable on the Windows platform. How do I go about running raco from the windows command line? I’m not familiar with it.If I use the documentation and enter the following command into cmd.exe:raco exe –gui main.rktcmd.exe tells me:’raco’ is not recognized as an internal or external command, operable program or batch file.Substituting in raco.exe tells me the same thing.I also tried typing:’C:\Program Files\Racket\raco.exe’ exe –gui .\main.rktinto pow
RaptorFactor
c++ windows boost stl iterator
I wish to define a custom iterator which uses a value type that can not be copied.The rationale for this is that the iterator will be responsible for module enumeration under Windows, and I’m using the CreateToolhelp32Snapshot/Module32First/Module32Next APIs to avoid having to preprocess the entire module list (e.g. Each iterator increment should advance to the next module in the list on demand to avoid unnecessary overhead.). The problem with this is that these APIs require the use of a ‘HANDLE
Benjamin
python windows path
Getting an unexpected result with os.path on Windows XP, Python 2.6.6:a = “D:\temp\temp.txt” os.path.dirname(a) >>> ‘D:’ # Would expect ‘D:\temp’ os.path.normpath(a) >>> ‘D:\temp\test.txt’ os.path.basename(a) >>> ‘\temp\test.txt’ #Would expect ‘test.txt’ a.replace(“\\”, “/”) >>>’D:\temp\test.txt’ # Would expect ‘D:/temp/test.txt’Can someone explain what is going on? How can I get the correct / expected behaviour? Why can’t I replace the backslashes with front
Cristian
windows file batch-file
I really can’t find what’s the problem with the syntax of this scriptThere’s something wrong with the if blocks but I can’t see what is the issue.@ECHO offset PROJECT=C:/ws/UI/Trunky/plugins/. set EXE=grails set MVN=mvn set DEP=–refresh-dependencies set CLEAN=clean set ASSET=ProcessAssets -Dgrails.env=production -DRESOURCE_PATH=./assets set TEST=test-app unit: –non-interactive set FIXJS=-s ./hudson-config/settings.xml package set INPUT=”%1″IF “%1” == “-dep”(ECHO %EXE% %DEP%ECHO “Refreshing dep
user2705939
c windows multithreading winapi windows-7
i have a threadProcvoid* ThreadProc(void* xyz) {//do some work.. }now from the main thread.. i call this thread and do not wish to wait for it to finishWaitForSingleObject(hThread, 0)now my flow of program is succh that the case may arrive where first call to thread is not finished and 2nd time same ThreadProc() is called.So … 1. How does OS handles this scenario? Will this kind of program give unexpected results? 2. If this is wrong way of doing it, what is the correct way?Because ultimately
Jake M
windows command-line batch-file
I am attempting to pass command line arguments to a console application(Computer Language Compiler). My Problem: The argument I am passing contains a hyphen character and it is causing an error “- was unexpected command/character”.This is the command line argument I am using(12d.exe is the application/compiler):12d.exe “C:/Staff – Name/abc.4dm”It seems that its looking at the ‘-‘ as a command and not part of a directory/string. Maybe I can use a batch file to perform this command line and reform
Aaron A
php wordpress apache apc mod-fcgid
I have a rather “bloated” WordPress install that is throwing some errors with apache + mod_Fcgid + apc.I have several other WordPress sites running under this configuration with no issues, but this particular site randomly throws “internal error” in the admin interface and spits out logs like:[Thu Mar 07 03:37:06 2013] [error] [client 1.2.3.4] Premature end of script headers: php5-fcgi, referer: http://www.example.com/wp-admin/themes.php [Thu Mar 07 03:37:08 2013] [error] mod_fcgid: process /hom
Rich
apache .htaccess
I have this setup in my htdocs:htdocs htdocs/somedir htdocs/somedir/process.php htdocs/somedir/.htaccessThis is the .htaccess code:RewriteEngine on RewriteRule ^([^/]*)$ process.php?var=$1 [L]What I believe is that this rule tells apache to start from the right-most letter and keep storing it unless it encounters a / So, in URL http://127.0.0.1/somedir/foo, $1 should be foo. Right?But when I go to this URL: http://127.0.0.1/somedir/foo, a print_r($_GET) in process.php outputs this:Array ([var] =
marc esher
apache iis browser http-headers browser-cache
Everything I read about “expires” headers (http://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/, eg) indicates that when taking advantage of caching in this manner, you need to “fingerprint” your file names so that when your static assets change, the browser will stop using the version from cache and instead fetch the new one.However, in my tests with IIS7 as the backend webserver, and using IE 7, FF, and Chrome browsers, I did not need to do so. If I changed the f
Sumurai8
php apache .htaccess codeigniter error-handling
My website has been slowed down a little last couple of days. I’ve looked into my error log and found lots of these:[Mon Sep 30 00:09:53 2013] [error] [client 66.249.66.205] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use ‘LimitInternalRecursion’ to increase the limit if necessary. Use ‘LogLevel debug’ to get a backtrace. [Mon Sep 30 00:09:53 2013] [debug] core.c(3120): [client 66.249.66.205] r->uri = /home/mysitecom/domains/mysite.com/public_html/
Popcorn
java apache http post http-post
I’m trying to send this in java:curl -H “Content-Type:application/json” -XPOST ‘http://www.foo.com/foo’ -d ‘{“rootURL”: “http://www.subway.com”}’Here’s the code I have:HttpClient client = new DefaultHttpClient();HttpPost post = new HttpPost(“http://www.foo.com/foo”);post.setHeader(“Content-Type”, “application/json”);List<NameValuePair> urlParameters = new ArrayList<NameValuePair>();urlParameters.add(new BasicNameValuePair(“rootURL”, “http://www.subway.com”));post.setEntity(new UrlEnc
user974967
apache svn dreamhost
I tried googling this but I haven’t come up with anything. I set up an SVN server using Dreamhost’s system and it said everything was created successfully. But now when I try to import (note that I am replacing mysite.com with my actual site):svn import MySource http://svn.mysite.com/myproject -m “Initial import” –username paulI get an error: svn: E175002: Unable to connect to a repository at URL ‘http://svn.mysite.com/myproject’ svn: E175002: Server sent unexpected return value (500 Internal S
MrJ
apache mod-rewrite
I’m really new at this mod_rewrite stuff and I’m trying to clean up the url from a new application.I have 2 types of URL in the site. They are always one of the formats below:http://www.site.com/dreams.php?page=view&p=23 http://www.site.com/dreams.php?page=view&p=20 http://www.site.com/dreams.php?page=contact http://www.site.com/dreams.php?page=contestsNow in my main page (dreams.php) I always check to see if $page is set to display the content. How do I client my url to have:http://www.
Rook
php apache
While looking over the doc’s for urldecode() I came across this note:The superglobals $_GET and $_REQUESTare already decoded. Using urldecode()on an element in $_GET or $_REQUESTcould have unexpected and dangerousresults.This is the reason why a get variable with the value of %26 ends up being &. Are there any other auto-magical decode routines other than urldecode()? Perhaps decoding that is only done because of configuration or negotiation?
jerrygarciuh
php wordpress apache .htaccess mod-rewrite
I’m trying to track down some unexpected 404s in a hybrid WordPress/custom code site. Since the 404s are redirected I’m not seeing the original request in the access_logs.What is a good way to track these given WordPress’ rewrite_rules are in the mix?.htaccess is just WP# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>
Grzegorz Motyl
apache .htaccess joomla
I can’t setup joomla in my servers subdirectory. In server’s main dir i have .htaccess :<IfModule mod_rewrite.c>RewriteCond %{HTTP_HOST} joomlasite.domaniew.plRewriteCond %{REQUEST_URI} !^/joomlasiteRewriteRule ^(.*)$ one/$1 [L]RewriteRule ^$ app/webroot/ [L]RewriteRule (.*) app/webroot/$1 [L] </IfModule>and in joomlasite subdir i have .htaccess:<IfModule mod_rewrite.c>RewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.
Anonymous the Great
html xampp w3c
I just got my free web hosting set up (trigoblocks.comuf.com), I connected via FileZilla FTP and uploaded my files. The error I get is “Parse error: syntax error, unexpected T_STRING in /home/a3639879/public_html/header.php on line 1”. Header.php line 1-2: <?xml version=”1.0″ encoding=”UTF-8″?> <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN””DTD/xhtml1-strict.dtd”>I do not get this error while on localhost with XAMPP.
user1546650
php xampp
$row = mysql_fetch_row($result);echo <<<_END <pre> <ul> <li> $row[2] <li> <ul> </pre> _END;The error is:Parse error: syntax error, unexpected ‘<<‘ (T_SL) in C:\xampp\htdocs\mobile\home.php on line 64I dont understand what is wrong? The _END: is on the far left with no white spaces
deceze
php xampp syntax-error
<?php if(isset($error)) {$echo ‘<div id=”errors”>’.$error.'</div>’; }?>I don’t know what is the error but because of it I cannot procced in my project please somebody help me with it.
James
mysql xampp
I recently reinstalled XAMPP to get PHP5.5I created a new database when doing this, importing it via an SQL export created by phpMyAdmin. (It is a copy of a live database to allow me to develop on my localhost).After installing and restarting the PC everything worked.At the end of the day I shutdown and went away. When I next turned the computer on. I got a MySQL shutdown unexpected error. Thinking it could be the new installation I reinstalled again. After restarting the PC after the resin
SimplePhi
php xampp
First time asking a question. PHP Amateur. Details: I am working on an eCommerce web project. The following is code contained in a file called config.php in a folder titled ‘inc’. Its purpose to define file and directory paths so that they need not be repeated when using the incude() function in other files. Problem: The CSS fails to render and also links break when hosted on XAMPP or the campus web server, but when hosted on a proper domain e.g www.myproject.com, it displays perfectly fine and
Fred -ii-
php html index xampp
So doing a simple registration into database, but the value of First Name and Last Name is getting unexpected index but account type username is fine.HTML code:<form method=”post” enctype=”multipart/form-data” action=”signIn.php”><h3>Create Your Account</h3>Account Type<select name=”accountType”> <option>Rentors</option><option>Homeowners</option></select>First Name: <input type=”text” name”Fname” size=”40″>Last Name:<
Menello
php xampp moodle
I have a XAMPP 1.7.7 install that I am trying to run Moodle off of. This exact Moodle code works on an Amazon EC2 server, but when I try to run it off my XAMPP server, it gives an error: HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfil the request.This started happening today. Last Friday I was happily working away on this project; now I can’t do anything! I’ve done some Googling, and in the process of such I have checked f
Stefano Palazzo
xampp
I copied the xampp zip onto the desktop and executed this in a terminal: sudo tar xvfz xampp-linux-1.5.3a.tar.gz -C /optWhen i tried to install xampp, I am getting this error tar (child): xampp-linux-1.5.3a.tar.gz: Cannot open: No such file or directory tar (child): Error is not recoverable: exiting now tar: Child returned status 2 tar: Error is not recoverable: exiting nowAny help will be appreciated. Thanks in advance.
Ittai
eclipse tomcat jvm xampp java-home
I have a web-app, built and compiled in Eclipse, which I want to deploy to my Tomcat 6 (I want to do it manually) and I get a UnsupportedClassVersionError exception which means the JVM tomcat is running is older than the one my eclipse is running. After some checking I see that in the tomcat manager window it says: JVM Version-1.5.0_20-b02 and in my eclipse: Java-Installed JREs- default is pointing at the JDK which is defined as my JAVA_HOME env-var and the one used in my path as the env-var (It
zur4ik
php apache logging xampp xdebug
I’m running some php file every 2 minutes via Windows Task Scheduler, but time-to-time I get notification about low space on my drive D:.After check I found that in XAMPP tmp folder located on D:\XAMPP\tmp are lot of files with names similar to: cachegrind.out.1381478803-D__xampp_htdocs_Real_Estate_App_index_php and size of each file is more than 144 MB.These files have content: ==== NEW PROFILING FILE ============================================== version: 1 creator: xdebug 2.2.3 cmd: D:\xampp\
Gromix
node.js express gzip zombie.js node.js-connect
I have an Express.js app that uses connect-asssets to serve JS and CSS:app.configure(function() {app.set(‘port’, 3000);app.set(‘views’, path.join(__dirname, ‘views’));app.set(‘view engine’, ‘ejs’);app.use(connectAssets({src: path.join(__dirname, ‘assets’)})); });I’m trying to use Zombie.js for acceptance testing, but keep getting SyntaxError: Unexpected token ILLEGAL whenever it tries to parse a Javascript file. If I replace connect-assets with express.static, then the acceptance tests work perf
Bober02
java zip gzip
i am trying to solve a simple problem – creating an empty GZip file using Java, so that no excpetion is raised when trying to read from it. if I do:Files.createFile(outPutFile); new PrintWriter(new GZIPOutputStream(new FileOutputStream(outPutFile.toFile())), true).close();It solves the problem – i guess the GZipOutputStream stores some furthr data in the file. is there a more succinct way to achieve the above i.e. not getting Unexpected end of Zlib archive exception?
franzlorenzon
debugging vim gzip sniffing mod-deflate
For debugging purposes I sniffed some requests and responses from my server/client. The compression is enabled so the responses are sent in gzip format. I know that probably I could just disable mod_deflate, but… out of curiosity, is there a way to decompress the gzipped response right in vim?Here’s an example of a response:HTTP/1.1 200 OK Date: Tue, 09 Jul 2013 08:00:18 GMT Server: Apache/2.2.14 (Ubuntu) X-Powered-By: PHP/5.3.2-1ubuntu4.19 Content-Disposition: inline; filename=”combo” Last-Mo
webjay
php json nginx gzip fastcgi
I have recently moved from Lighttpd to Nginx and while everything seems speedy and good, JSON output is invalid.At least that’s what I think and when I test it, JSONLint sayssyntax error, unexpected TINVALID at line 1when I test my JSON output: http://bit.ly/fLCxoxI have tested internally that the data is ok by var_dump(json_decode(json_encode(data)));Here’s my nginx.conf.Any help would be great.thx, Jacob
MagiSun
java gzip objectinputstream
I currently have a simple system set up where an ObjectInputStream reads directly from a GZIPInputStream which is attached to a client Socket’s input stream:InputStream stream = s.getInputStream();GZIPInputStream gis = new GZIPInputStream(stream);ObjectInputStream input = new ObjectInputStream(gis);System.out.println(input);return input;The problem with this is, the ObjectInputStream attempts to read the stream header and begins blocking the thread. Why is this happening, and/or how can I stop t
Kevin
perl curl gzip
im trying to use the system curl to post gzipped data to a server but i keep ending up with strange errors`curl -sS -X POST -H “Content-Type: application/gzip” –data-binary $data $url`gives curl: no URL specified!and`curl -sS -X POST -H “Content-Type: application/gzip” –data-binary “$data” $url`gives sh: -c: line 0: unexpected EOF while looking for matching `”‘ sh: -c: line 1: syntax error: unexpected end of file
itsadok
python http gzip
I use the following python code to download web pages from servers with gzip compression:url = “http://www.v-gn.de/wbb/” import urllib2 request = urllib2.Request(url) request.add_header(‘Accept-encoding’, ‘gzip’) response = urllib2.urlopen(request) content = response.read() response.close()import gzip from StringIO import StringIO html = gzip.GzipFile(fileobj=StringIO(content)).read()This works generally, but for the specified URL fails with a struct.error exception. I get a similar result if I
Luca Martinetti
gzip sharpziplib decompress
I’m getting this error while trying to decompress some GZ files with #ZipLib 0.85.5Those file are not corrupted, I’m able to decompress it correctly using 7-Zip.ICSharpCode.SharpZipLib.SharpZipBaseException Unexpected EOFAny idea? Thanks
Fredrik
php javascript .htaccess gzip
Okay, So I’ve googled a couple of pages and come up with the following solution:Add this in .htaccess#Active GZIP for php-files php_flag zlib.output_compression On php_value zlib.output_compression_level 5and this for .js and .css:AddHandler application/x-httpd-php .css .js php_value auto_prepend_file /Library/WebServer/Documents/blog/code/Helpers/ContentHeader.phpWhich will execute .js as well as .css as php scripts. The second row includes the following page:<?php$pathInfo = pathinfo($_SER
daydreamer
java gzip
I have a Object as private String name; private int age; private String country; // getters and settersand functions are protected void write(@Nonnull final Document document, @Nonnull final OutputStream stream) throws PersistenceException {try {jaxbContext.createMarshaller().marshal(document, stream);} catch (final JAXBException e) {LOGGER.error(e.getMessage(), e);throw new PersistenceException(“Failed to marshall document ” + docment.getUniqueId() + “: ” + e.getMessage(), e);}}I convert this i
Web site is in building